r30 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential tutti-persistence/src/main/resources tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config tutti-persistence-
Author: tchemit Date: 2012-12-06 18:03:05 +0100 (Thu, 06 Dec 2012) New Revision: 30 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/30 Log: - rename entity (no more Ben suffix) - introduce table ui api - continue species batch frequencies ui Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png Removed: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java trunk/tutti-persistence/src/main/resources/META-INF/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,25 +24,26 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; +import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import org.nuiton.util.ApplicationConfig; import java.io.Closeable; @@ -57,72 +58,142 @@ */ public interface TuttiPersistence extends Closeable { + //------------------------------------------------------------------------// + //-- Technical methods --// + //------------------------------------------------------------------------// + String getImplementationName(); void open(ApplicationConfig config) throws IOException; void close() throws IOException; - List<WeightCategoryBean> getAllWeightCategories(); + //------------------------------------------------------------------------// + //-- Referential methods --// + //------------------------------------------------------------------------// - List<SexBean> getAllSex(); + List<WeightCategory> getAllWeightCategory(); - List<SpeciesBean> getAllSpecies(); + List<Sex> getAllSex(); - List<SeaStateBean> getAllSeaStates(); + List<Species> getAllSpecies(); - List<StrataBean> getAllStratas(); + List<SeaState> getAllSeaState(); - List<BeaufortScaleBean> getAllBeaufortScales(); + List<Strata> getAllStrata(); - List<SurveyBean> getAllSurveys(); + List<BeaufortScale> getAllBeaufortScale(); - List<ZoneBean> getAllZones(); + List<Zone> getAllZone(); - List<CountryBean> getAllCountries(); + List<Country> getAllCountry(); - List<VesselBean> getAllVessels(); + List<Vessel> getAllVessel(); - List<GearBean> getAllGears(); + List<Gear> getAllGear(); - List<UserBean> getAllUsers(); + List<TuttiUser> getAllTuttiUser(); - List<CampaignBean> getAllCampaigns(String surveyId); + //------------------------------------------------------------------------// + //-- Survey methods --// + //------------------------------------------------------------------------// - List<TraitBean> getAllTraits(String campaignId); + List<Survey> getAllSurvey(); - List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId); + Survey getSurvey(String surveyId); - List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId); + Survey createSurvey(Survey bean); - List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId); + Survey saveSurvey(Survey bean); - List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId); + //------------------------------------------------------------------------// + //-- Campaign methods --// + //------------------------------------------------------------------------// - List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId); + List<Campaign> getAllCampaign(String surveyId); - SurveyBean getSurvey(String surveyId); + Campaign getCampaign(String campaignId); - CampaignBean getCampaign(String campaignId); + Campaign createCampaign(Campaign bean); - TraitBean getTrait(String traitId); + Campaign saveCampaign(Campaign bean); - TraitSpeciesCatchBean getTraitSpeciesCatch(String id); + //------------------------------------------------------------------------// + //-- Trait methods --// + //------------------------------------------------------------------------// - SurveyBean createSurvey(SurveyBean bean); + List<Trait> getAllTrait(String campaignId); - SurveyBean saveSurvey(SurveyBean bean); + Trait getTrait(String traitId); - CampaignBean createCampaign(CampaignBean bean); + Trait createTrait(Trait bean); - CampaignBean saveCampaign(CampaignBean bean); + Trait saveTrait(Trait bean); - TraitBean createTrait(TraitBean bean); + //------------------------------------------------------------------------// + //-- Species Batch methods --// + //------------------------------------------------------------------------// - TraitBean saveTrait(TraitBean bean); + List<SpeciesBatch> getAllSpeciesBatch(String traitId); - TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean); + SpeciesBatch getSpeciesBatch(String id); - TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean); + SpeciesBatch createSpeciesBatch(SpeciesBatch bean); + SpeciesBatch saveSpeciesBatch(SpeciesBatch bean); + + List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency( + String speciesBatchId); + + List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, + List<SpeciesBatchFrequency> frequencies); + + //------------------------------------------------------------------------// + //-- Benthos Batch methods --// + //------------------------------------------------------------------------// + + List<BenthosBatch> getAllBenthosBatch(String traitId); + + BenthosBatch getBenthosBatch(String id); + + BenthosBatch createBenthosBatch(BenthosBatch bean); + + BenthosBatch saveBenthosBatch(BenthosBatch bean); + + //------------------------------------------------------------------------// + //-- Plancton Batch methods --// + //------------------------------------------------------------------------// + + List<PlanctonBatch> getAllPlanctonBatch(String traitId); + + PlanctonBatch getPlanctonBatch(String id); + + PlanctonBatch createPlanctonBatch(PlanctonBatch bean); + + PlanctonBatch savePlanctonBatch(PlanctonBatch bean); + + //------------------------------------------------------------------------// + //-- Macrodechet Batch methods --// + //------------------------------------------------------------------------// + + List<MacroDechetBatch> getAllMacroDechetBatch(String traitId); + + MacroDechetBatch getMacroDechetBatch(String id); + + MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean); + + MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean); + + //------------------------------------------------------------------------// + //-- Accidentel Batch methods --// + //------------------------------------------------------------------------// + + List<AccidentelBatch> getAllAccidentelBatch(String traitId); + + AccidentelBatch getAccidentelBatch(String id); + + AccidentelBatch createAccidentelBatch(AccidentelBatch bean); + + AccidentelBatch saveAccidentelBatch(AccidentelBatch bean); + } Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,48 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.Serializable; - -/** - * Abstract tutti bean. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public abstract class AbstractTuttiBean implements Serializable { - - private static final long serialVersionUID = 1L; - - protected String id; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,48 @@ +package fr.ifremer.tutti.persistence.entities; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.io.Serializable; + +/** + * Abstract tutti entity. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractTuttiEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + protected String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,134 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; - -import java.util.List; - -/** - * To represent a campaign. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class CampaignBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected SurveyBean survey; - - protected CountryBean country; - - protected String name; - - protected String surveyPart; - - protected List<VesselBean> vessel; - - protected List<GearBean> gear; - - protected List<UserBean> headOfMission; - - protected List<UserBean> headOfSortRoom; - - protected String comment; - - public SurveyBean getSurvey() { - return survey; - } - - public void setSurvey(SurveyBean survey) { - this.survey = survey; - } - - public CountryBean getCountry() { - return country; - } - - public void setCountry(CountryBean country) { - this.country = country; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSurveyPart() { - return surveyPart; - } - - public void setSurveyPart(String surveyPart) { - this.surveyPart = surveyPart; - } - - public List<VesselBean> getVessel() { - return vessel; - } - - public void setVessel(List<VesselBean> vessel) { - this.vessel = vessel; - } - - public List<GearBean> getGear() { - return gear; - } - - public void setGear(List<GearBean> gear) { - this.gear = gear; - } - - public List<UserBean> getHeadOfMission() { - return headOfMission; - } - - public void setHeadOfMission(List<UserBean> headOfMission) { - this.headOfMission = headOfMission; - } - - public List<UserBean> getHeadOfSortRoom() { - return headOfSortRoom; - } - - public void setHeadOfSortRoom(List<UserBean> headOfSortRoom) { - this.headOfSortRoom = headOfSortRoom; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - -} Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,38 @@ +package fr.ifremer.tutti.persistence.entities; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * For any bean which can have a comment. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public interface CommentAware { + + String getComment(); + + void setComment(String comment); +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,40 @@ +package fr.ifremer.tutti.persistence.entities; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.referential.Species; + +/** + * For any bean which relies to a {@link Species}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public interface SpeciesAware { + + Species getSpecies(); + + void setSpecies(Species species); +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,47 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Represents a strata. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class StrataBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,68 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; - -/** - * To represent a survey. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SurveyBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - protected String comment; - - protected ZoneBean zone; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public ZoneBean getZone() { - return zone; - } - - public void setZone(ZoneBean zone) { - this.zone = zone; - } -} Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,473 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; - -import java.util.Date; -import java.util.List; - -/** - * To represent a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class TraitBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected CampaignBean campaign; - - protected Integer stationNumber; - - protected Integer traitNumber; - - protected Date date; - - protected StrataBean strate; - - protected Float gearShootingStartLatitude; - - protected Float gearShootingStartLongitude; - - protected Date gearShootingStartTime; - - protected Float gearShootingStartDepth; - - protected Float gearShootingEndLatitude; - - protected Float gearShootingEndLongitude; - - protected Date gearShootingEndTime; - - protected Float gearShootingEndDepth; - - protected BeaufortScaleBean beaufortScale; - - protected Integer windDirection; - - protected SeaStateBean seaState; - - protected Float ouvertureHorizontale; - - protected Float ouvertureVerticale; - - protected boolean geometrieMesuree; - - protected Float longueurFunes; - - protected Float longueurBras; - - protected boolean systemeFermetureCul; - - protected boolean traitRectiligne; - - protected Float distanceChalutee; - - protected Float duree; - - protected boolean traitValid; - - protected String localite; - - protected String comment; - - protected List<UserBean> saisisseur; - - protected Float gearShootingStartSurfaceTemperature; - - protected Float gearShootingEndSurfaceTemperature; - - protected Float gearShootingStartBottomTemperature; - - protected Float gearShootingEndBottomTemperature; - - protected Float averageBottomTemperature; - - protected Float gearShootingStartSurfaceSalinity; - - protected Float gearShootingEndSurfaceSalinity; - - protected Float gearShootingStartBottomSalinity; - - protected Float gearShootingEndBottomSalinity; - - protected Float averageBottomSalinity; - - protected Float speciesTotalWeight; - - protected Float speciesTotalVracWeight; - - protected Float speciesSampleVracWeight; - - protected Float speciesTotalHorsVracWeight; - - public CampaignBean getCampaign() { - return campaign; - } - - public void setCampaign(CampaignBean campaign) { - this.campaign = campaign; - } - - public Integer getStationNumber() { - return stationNumber; - } - - public void setStationNumber(Integer stationNumber) { - this.stationNumber = stationNumber; - } - - public Integer getTraitNumber() { - return traitNumber; - } - - public void setTraitNumber(Integer traitNumber) { - this.traitNumber = traitNumber; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public Float getGearShootingStartLatitude() { - return gearShootingStartLatitude; - } - - public void setGearShootingStartLatitude(Float gearShootingStartLatitude) { - this.gearShootingStartLatitude = gearShootingStartLatitude; - } - - public Float getGearShootingStartLongitude() { - return gearShootingStartLongitude; - } - - public void setGearShootingStartLongitude(Float gearShootingStartLongitude) { - this.gearShootingStartLongitude = gearShootingStartLongitude; - } - - public Date getGearShootingStartTime() { - return gearShootingStartTime; - } - - public void setGearShootingStartTime(Date gearShootingStartTime) { - this.gearShootingStartTime = gearShootingStartTime; - } - - public Float getGearShootingStartDepth() { - return gearShootingStartDepth; - } - - public void setGearShootingStartDepth(Float gearShootingStartDepth) { - this.gearShootingStartDepth = gearShootingStartDepth; - } - - public Float getGearShootingEndLatitude() { - return gearShootingEndLatitude; - } - - public void setGearShootingEndLatitude(Float gearShootingEndLatitude) { - this.gearShootingEndLatitude = gearShootingEndLatitude; - } - - public Float getGearShootingEndLongitude() { - return gearShootingEndLongitude; - } - - public void setGearShootingEndLongitude(Float gearShootingEndLongitude) { - this.gearShootingEndLongitude = gearShootingEndLongitude; - } - - public Date getGearShootingEndTime() { - return gearShootingEndTime; - } - - public void setGearShootingEndTime(Date gearShootingEndTime) { - this.gearShootingEndTime = gearShootingEndTime; - } - - public Float getGearShootingEndDepth() { - return gearShootingEndDepth; - } - - public void setGearShootingEndDepth(Float gearShootingEndDepth) { - this.gearShootingEndDepth = gearShootingEndDepth; - } - - public Float getOuvertureHorizontale() { - return ouvertureHorizontale; - } - - public void setOuvertureHorizontale(Float ouvertureHorizontale) { - this.ouvertureHorizontale = ouvertureHorizontale; - } - - public Float getOuvertureVerticale() { - return ouvertureVerticale; - } - - public void setOuvertureVerticale(Float ouvertureVerticale) { - this.ouvertureVerticale = ouvertureVerticale; - } - - public boolean getGeometrieMesuree() { - return geometrieMesuree; - } - - public void isGeometrieMesuree(boolean geometrieMesuree) { - this.geometrieMesuree = geometrieMesuree; - } - - public Float getLongueurFunes() { - return longueurFunes; - } - - public void setLongueurFunes(Float longueurFunes) { - this.longueurFunes = longueurFunes; - } - - public Float getLongueurBras() { - return longueurBras; - } - - public void setLongueurBras(Float longueurBras) { - this.longueurBras = longueurBras; - } - - public boolean getSystemeFermetureCul() { - return systemeFermetureCul; - } - - public void setSystemeFermetureCul(boolean systemeFermetureCul) { - this.systemeFermetureCul = systemeFermetureCul; - } - - public boolean isTraitRectiligne() { - return traitRectiligne; - } - - public void setTraitRectiligne(boolean traitRectiligne) { - this.traitRectiligne = traitRectiligne; - } - - public Float getDistanceChalutee() { - return distanceChalutee; - } - - public void setDistanceChalutee(Float distanceChalutee) { - this.distanceChalutee = distanceChalutee; - } - - public Float getDuree() { - return duree; - } - - public void setDuree(Float duree) { - this.duree = duree; - } - - public boolean isTraitValid() { - return traitValid; - } - - public void setTraitValid(boolean traitValid) { - this.traitValid = traitValid; - } - - public String getLocalite() { - return localite; - } - - public void setLocalite(String localite) { - this.localite = localite; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public List<UserBean> getSaisisseur() { - return saisisseur; - } - - public void setSaisisseur(List<UserBean> saisisseur) { - this.saisisseur = saisisseur; - } - - public StrataBean getStrate() { - return strate; - } - - public void setStrate(StrataBean strate) { - this.strate = strate; - } - - public BeaufortScaleBean getBeaufortScale() { - return beaufortScale; - } - - public void setBeaufortScale(BeaufortScaleBean beaufortScale) { - this.beaufortScale = beaufortScale; - } - - public Integer getWindDirection() { - return windDirection; - } - - public void setWindDirection(Integer windDirection) { - this.windDirection = windDirection; - } - - public SeaStateBean getSeaState() { - return seaState; - } - - public void setSeaState(SeaStateBean seaState) { - this.seaState = seaState; - } - - public Float getGearShootingStartSurfaceTemperature() { - return gearShootingStartSurfaceTemperature; - } - - public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) { - this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature; - } - - public Float getGearShootingEndSurfaceTemperature() { - return gearShootingEndSurfaceTemperature; - } - - public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) { - this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature; - } - - public Float getGearShootingStartBottomTemperature() { - return gearShootingStartBottomTemperature; - } - - public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) { - this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature; - } - - public Float getGearShootingEndBottomTemperature() { - return gearShootingEndBottomTemperature; - } - - public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) { - this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature; - } - - public Float getAverageBottomTemperature() { - return averageBottomTemperature; - } - - public void setAverageBottomTemperature(Float averageBottomTemperature) { - this.averageBottomTemperature = averageBottomTemperature; - } - - public Float getGearShootingStartSurfaceSalinity() { - return gearShootingStartSurfaceSalinity; - } - - public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) { - this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity; - } - - public Float getGearShootingEndSurfaceSalinity() { - return gearShootingEndSurfaceSalinity; - } - - public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) { - this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity; - } - - public Float getGearShootingStartBottomSalinity() { - return gearShootingStartBottomSalinity; - } - - public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) { - this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity; - } - - public Float getGearShootingEndBottomSalinity() { - return gearShootingEndBottomSalinity; - } - - public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) { - this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity; - } - - public Float getAverageBottomSalinity() { - return averageBottomSalinity; - } - - public void setAverageBottomSalinity(Float averageBottomSalinity) { - this.averageBottomSalinity = averageBottomSalinity; - } - - public Float getSpeciesTotalWeight() { - return speciesTotalWeight; - } - - public void setSpeciesTotalWeight(Float speciesTotalWeight) { - this.speciesTotalWeight = speciesTotalWeight; - } - - public Float getSpeciesTotalVracWeight() { - return speciesTotalVracWeight; - } - - public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) { - this.speciesTotalVracWeight = speciesTotalVracWeight; - } - - public Float getSpeciesSampleVracWeight() { - return speciesSampleVracWeight; - } - - public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) { - this.speciesSampleVracWeight = speciesSampleVracWeight; - } - - public Float getSpeciesTotalHorsVracWeight() { - return speciesTotalHorsVracWeight; - } - - public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) { - this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight; - } -} Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,143 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; - -/** - * Represents a benthos catch while a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class TraitBenthosCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware { - - private static final long serialVersionUID = 1L; - - /** - * When catch was observed. - * - * @since 0.2 - */ - protected TraitBean trait; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Is the species need to be confirmed?. - * - * @since 0.2 - */ - protected boolean speciesToConfirm; - - /** - * Is catch is vrac or horsVrac?. - * - * @since 0.2 - */ - protected VracHorsVracEnum vracHorsVrac; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - /** - * Sample weight. - * - * @since 0.2 - */ - protected Float sampleWeight; - - /** - * Elevation ratio. - * - * @since 0.2 - */ - protected Float elevationRatio; - - public TraitBean getTrait() { - return trait; - } - - public void setTrait(TraitBean trait) { - this.trait = trait; - } - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - this.species = species; - } - - public boolean isSpeciesToConfirm() { - return speciesToConfirm; - } - - public void setSpeciesToConfirm(boolean speciesToConfirm) { - this.speciesToConfirm = speciesToConfirm; - } - - public VracHorsVracEnum getVracHorsVrac() { - return vracHorsVrac; - } - - public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { - this.vracHorsVrac = vracHorsVrac; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - - public Float getSampleWeight() { - return sampleWeight; - } - - public void setSampleWeight(Float sampleWeight) { - this.sampleWeight = sampleWeight; - } - - public Float getElevationRatio() { - return elevationRatio; - } - - public void setElevationRatio(Float elevationRatio) { - this.elevationRatio = elevationRatio; - } -} \ No newline at end of file Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,84 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; - -/** - * Represents a capture accidentel catch while a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class TraitCaptureAccidentelCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{ - - private static final long serialVersionUID = 1L; - - /** - * When catch was observed. - * - * @since 0.2 - */ - protected TraitBean trait; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - public TraitBean getTrait() { - return trait; - } - - public void setTrait(TraitBean trait) { - this.trait = trait; - } - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - this.species = species; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - -} \ No newline at end of file Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,38 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * For any bean which relies to a {@link TraitBean}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public interface TraitCatchBeanAware { - - TraitBean getTrait(); - - void setTrait(TraitBean trait); -} Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,84 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; - -/** - * Represents a macro dechet catch while a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class TraitMacroDechetCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{ - - private static final long serialVersionUID = 1L; - - /** - * When catch was observed. - * - * @since 0.2 - */ - protected TraitBean trait; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - public TraitBean getTrait() { - return trait; - } - - public void setTrait(TraitBean trait) { - this.trait = trait; - } - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - this.species = species; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - -} \ No newline at end of file Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,84 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; - -/** - * Represents a plancton catch while a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class TraitPlanctonCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{ - - private static final long serialVersionUID = 1L; - - /** - * When catch was observed. - * - * @since 0.2 - */ - protected TraitBean trait; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - public TraitBean getTrait() { - return trait; - } - - public void setTrait(TraitBean trait) { - this.trait = trait; - } - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - this.species = species; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - -} \ No newline at end of file Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,220 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; - -/** - * Represents a catch of species while a trait. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware { - - private static final long serialVersionUID = 1L; - - /** - * When catch was observed. - * - * @since 0.2 - */ - protected TraitBean trait; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Is the species need to be confirmed?. - * - * @since 0.2 - */ - protected boolean speciesToConfirm; - - /** - * Is catch is vrac or horsVrac?. - * - * @since 0.2 - */ - protected VracHorsVracEnum vracHorsVrac; - - /** - * Weight category (can be null). - * - * @since 0.2 - */ - protected WeightCategoryBean weightCategory; - - /** - * Sex (can be null). - * - * @since 0.2 - */ - protected SexBean sex; - - /** - * Maturity (can be null). - * - * @since 0.2 - */ - protected Float maturity; - - /** - * Age (can be null). - * - * @since 0.2 - */ - protected Float age; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - /** - * Sample weight. - * - * @since 0.2 - */ - protected Float sampleWeight; - - /** - * Elevation ratio. - * - * @since 0.2 - */ - protected Float elevationRatio; - - /** - * Comment on this catches. - * - * @since 0.2 - */ - protected String comment; - - public TraitBean getTrait() { - return trait; - } - - public void setTrait(TraitBean trait) { - this.trait = trait; - } - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - this.species = species; - } - - public Boolean getSpeciesToConfirm() { - return speciesToConfirm; - } - - public void setSpeciesToConfirm(Boolean speciesToConfirm) { - this.speciesToConfirm = speciesToConfirm; - } - - public VracHorsVracEnum getVracHorsVrac() { - return vracHorsVrac; - } - - public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { - this.vracHorsVrac = vracHorsVrac; - } - - public WeightCategoryBean getWeightCategory() { - return weightCategory; - } - - public void setWeightCategory(WeightCategoryBean weightCategory) { - this.weightCategory = weightCategory; - } - - public SexBean getSex() { - return sex; - } - - public void setSex(SexBean sex) { - this.sex = sex; - } - - public Float getMaturity() { - return maturity; - } - - public void setMaturity(Float maturity) { - this.maturity = maturity; - } - - public Float getAge() { - return age; - } - - public void setAge(Float age) { - this.age = age; - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - this.weight = weight; - } - - public Float getSampleWeight() { - return sampleWeight; - } - - public void setSampleWeight(Float sampleWeight) { - this.sampleWeight = sampleWeight; - } - - public Float getElevationRatio() { - return elevationRatio; - } - - public void setElevationRatio(Float elevationRatio) { - this.elevationRatio = elevationRatio; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } -} Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,89 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import java.util.Collection; - -/** - * Usefull method around tutti beans. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class TuttiBeans { - - public static <B extends AbstractTuttiBean> boolean isNew(B bean) { - return bean.getId() == null; - } - - public static <B extends AbstractTuttiBean> Predicate<B> newIdPredicate(String id) { - return new IdPredicate<B>(id); - } - - public static <B extends AbstractTuttiBean & TraitCatchBeanAware> Predicate<B> newTraitIdPredicate(String id) { - return new TraitIdPredicate<B>(id); - } - - public static <B extends AbstractTuttiBean> B findById(Collection<B> beans, - String id) { - B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull(); - return result; - } - - protected TuttiBeans() { - // helper class does not instanciate - } - - protected static class IdPredicate<B extends AbstractTuttiBean> implements Predicate<B> { - - private final String id; - - public IdPredicate(String id) { - this.id = id; - } - - @Override - public boolean apply(B input) { - return id.equals(input.getId()); - } - } - - protected static class TraitIdPredicate<B extends AbstractTuttiBean & TraitCatchBeanAware> implements Predicate<B> { - - private final String id; - - public TraitIdPredicate(String id) { - this.id = id; - } - - @Override - public boolean apply(B input) { - return id.equals(input.getTrait().getId()); - } - } -} Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,128 @@ +package fr.ifremer.tutti.persistence.entities; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.base.Function; +import com.google.common.base.Predicate; +import com.google.common.base.Throwables; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import fr.ifremer.tutti.persistence.entities.data.TraitAware; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Usefull method around tutti entities. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class TuttiEntities { + + protected TuttiEntities() { + // helper class does not instanciate + } + + public static <B extends AbstractTuttiEntity> List<String> toIds(List<B> list) { + List<String> result = list == null ? + Collections.<String>emptyList() : + Lists.transform(list, new Function<B, String>() { + @Override + public String apply(B input) { + return input.getId(); + } + }); + return result; + } + + public static <B extends AbstractTuttiEntity> Map<String, B> splitById(Iterable<B> list) { + return Maps.uniqueIndex(list, GET_ID); + } + + public static final Function<AbstractTuttiEntity, String> GET_ID = new Function<AbstractTuttiEntity, String>() { + @Override + public String apply(AbstractTuttiEntity input) { + return input.getId(); + } + }; + + public static <B extends AbstractTuttiEntity> boolean isNew(B bean) { + return bean.getId() == null; + } + + public static <B extends AbstractTuttiEntity> Predicate<B> newIdPredicate(String id) { + return new IdPredicate<B>(id); + } + + public static <B extends AbstractTuttiEntity & TraitAware> Predicate<B> newTraitIdPredicate(String id) { + return new TraitIdPredicate<B>(id); + } + + public static <B extends AbstractTuttiEntity> B findById(Iterable<B> beans, + String id) { + B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull(); + return result; + } + + protected static class IdPredicate<B extends AbstractTuttiEntity> implements Predicate<B> { + + private final String id; + + public IdPredicate(String id) { + this.id = id; + } + + @Override + public boolean apply(B input) { + return id.equals(input.getId()); + } + } + + protected static class TraitIdPredicate<B extends AbstractTuttiEntity & TraitAware> implements Predicate<B> { + + private final String id; + + public TraitIdPredicate(String id) { + this.id = id; + } + + @Override + public boolean apply(B input) { + return id.equals(input.getTrait().getId()); + } + } + + public static <B extends AbstractTuttiEntity> B newEntity(B entity) { + try { + Class<B> aClass = (Class<B>) entity.getClass(); + return aClass.newInstance(); + } catch (Exception e) { + throw Throwables.propagate(e); + } + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,34 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public enum VracHorsVracEnum { - VRAC, - HORS_VRAC -} Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,108 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.referential.Species; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class AbstractTraitBatch extends AbstractTuttiEntity implements TraitAware { + + private static final long serialVersionUID = 1L; + + /** + * When batch was observed. + * + * @since 0.2 + */ + protected Trait trait; + + /** + * Species observed. + * + * @since 0.2 + */ + protected Species species; + + /** + * Observed weight. + * + * @since 0.2 + */ + protected Float weight; + + /** + * Comment. + * + * @since 0.2 + */ + protected String comment; + + @Override + public final Trait getTrait() { + return trait; + } + + @Override + public final void setTrait(Trait trait) { + this.trait = trait; + } + + @Override + public final Species getSpecies() { + return species; + } + + @Override + public final void setSpecies(Species species) { + this.species = species; + } + + @Override + public final String getComment() { + return comment; + } + + @Override + public final void setComment(String comment) { + this.comment = comment; + } + + @Override + public final Float getWeight() { + return weight; + } + + @Override + public final void setWeight(Float weight) { + this.weight = weight; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AbstractTraitBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,37 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * Represents a accidentel batch. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class AccidentelBatch extends AbstractTraitBatch { + + private static final long serialVersionUID = 1L; + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/AccidentelBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,96 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * Represents a benthos batch. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class BenthosBatch extends AbstractTraitBatch { + + private static final long serialVersionUID = 1L; + + /** + * Is the species need to be confirmed?. + * + * @since 0.2 + */ + protected boolean speciesToConfirm; + + /** + * Is catch is vrac or horsVrac?. + * + * @since 0.2 + */ + protected VracHorsVracEnum vracHorsVrac; + + /** + * Sample weight. + * + * @since 0.2 + */ + protected Float sampleWeight; + + /** + * Elevation ratio. + * + * @since 0.2 + */ + protected Float elevationRatio; + + public boolean isSpeciesToConfirm() { + return speciesToConfirm; + } + + public void setSpeciesToConfirm(boolean speciesToConfirm) { + this.speciesToConfirm = speciesToConfirm; + } + + public VracHorsVracEnum getVracHorsVrac() { + return vracHorsVrac; + } + + public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { + this.vracHorsVrac = vracHorsVrac; + } + + public Float getSampleWeight() { + return sampleWeight; + } + + public void setSampleWeight(Float sampleWeight) { + this.sampleWeight = sampleWeight; + } + + public Float getElevationRatio() { + return elevationRatio; + } + + public void setElevationRatio(Float elevationRatio) { + this.elevationRatio = elevationRatio; + } +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BenthosBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,138 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.CommentAware; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; + +import java.util.List; + +/** + * To represent a campaign. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Campaign extends AbstractTuttiEntity implements CommentAware { + + private static final long serialVersionUID = 1L; + + protected Survey survey; + + protected Country country; + + protected String name; + + protected String surveyPart; + + protected List<Vessel> vessel; + + protected List<Gear> gear; + + protected List<TuttiUser> headOfMission; + + protected List<TuttiUser> headOfSortRoom; + + protected String comment; + + public Survey getSurvey() { + return survey; + } + + public void setSurvey(Survey survey) { + this.survey = survey; + } + + public Country getCountry() { + return country; + } + + public void setCountry(Country country) { + this.country = country; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurveyPart() { + return surveyPart; + } + + public void setSurveyPart(String surveyPart) { + this.surveyPart = surveyPart; + } + + public List<Vessel> getVessel() { + return vessel; + } + + public void setVessel(List<Vessel> vessel) { + this.vessel = vessel; + } + + public List<Gear> getGear() { + return gear; + } + + public void setGear(List<Gear> gear) { + this.gear = gear; + } + + public List<TuttiUser> getHeadOfMission() { + return headOfMission; + } + + public void setHeadOfMission(List<TuttiUser> headOfMission) { + this.headOfMission = headOfMission; + } + + public List<TuttiUser> getHeadOfSortRoom() { + return headOfSortRoom; + } + + public void setHeadOfSortRoom(List<TuttiUser> headOfSortRoom) { + this.headOfSortRoom = headOfSortRoom; + } + + @Override + public String getComment() { + return comment; + } + + @Override + public void setComment(String comment) { + this.comment = comment; + } + +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Campaign.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,37 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * Represents a macro dechet batch. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class MacroDechetBatch extends AbstractTraitBatch { + + private static final long serialVersionUID = 1L; + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/MacroDechetBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,36 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * Represents a plancton batch. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class PlanctonBatch extends AbstractTraitBatch { + + private static final long serialVersionUID = 1L; +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/PlanctonBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java (from rev 27, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,160 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; + +/** + * Represents a species batch. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SpeciesBatch extends AbstractTraitBatch { + + private static final long serialVersionUID = 1L; + + /** + * Is the species need to be confirmed?. + * + * @since 0.2 + */ + protected boolean speciesToConfirm; + + /** + * Is catch is vrac or horsVrac?. + * + * @since 0.2 + */ + protected VracHorsVracEnum vracHorsVrac; + + /** + * Weight category (can be null). + * + * @since 0.2 + */ + protected WeightCategory weightCategory; + + /** + * Sex (can be null). + * + * @since 0.2 + */ + protected Sex sex; + + /** + * Maturity (can be null). + * + * @since 0.2 + */ + protected Float maturity; + + /** + * Age (can be null). + * + * @since 0.2 + */ + protected Float age; + + /** + * Sample weight. + * + * @since 0.2 + */ + protected Float sampleWeight; + + /** + * Elevation ratio. + * + * @since 0.2 + */ + protected Float elevationRatio; + + public Boolean getSpeciesToConfirm() { + return speciesToConfirm; + } + + public void setSpeciesToConfirm(Boolean speciesToConfirm) { + this.speciesToConfirm = speciesToConfirm; + } + + public VracHorsVracEnum getVracHorsVrac() { + return vracHorsVrac; + } + + public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { + this.vracHorsVrac = vracHorsVrac; + } + + public WeightCategory getWeightCategory() { + return weightCategory; + } + + public void setWeightCategory(WeightCategory weightCategory) { + this.weightCategory = weightCategory; + } + + public Sex getSex() { + return sex; + } + + public void setSex(Sex sex) { + this.sex = sex; + } + + public Float getMaturity() { + return maturity; + } + + public void setMaturity(Float maturity) { + this.maturity = maturity; + } + + public Float getAge() { + return age; + } + + public void setAge(Float age) { + this.age = age; + } + + public Float getSampleWeight() { + return sampleWeight; + } + + public void setSampleWeight(Float sampleWeight) { + this.sampleWeight = sampleWeight; + } + + public Float getElevationRatio() { + return elevationRatio; + } + + public void setElevationRatio(Float elevationRatio) { + this.elevationRatio = elevationRatio; + } + +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatch.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,98 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents sampling frequency inside a {@link SpeciesBatch}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesBatchFrequency extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + /** + * Batch. + * + * @since 0.2 + */ + protected SpeciesBatch batch; + + /** + * Length step. + * + * @since 0.2 + */ + protected Float lengthStep; + + /** + * Count of fishes for this lengthStep. + * + * @since 0.2 + */ + protected Integer number; + + /** + * Weight of fishes. + * + * @since 0.2 + */ + protected Float weight; + + public SpeciesBatch getBatch() { + return batch; + } + + public void setBatch(SpeciesBatch batch) { + this.batch = batch; + } + + public Float getLengthStep() { + return lengthStep; + } + + public void setLengthStep(Float lengthStep) { + this.lengthStep = lengthStep; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Float getWeight() { + return weight; + } + + public void setWeight(Float weight) { + this.weight = weight; + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchFrequency.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a strata. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Strata extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Strata.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,72 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.CommentAware; +import fr.ifremer.tutti.persistence.entities.referential.Zone; + +/** + * To represent a survey. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Survey extends AbstractTuttiEntity implements CommentAware { + + private static final long serialVersionUID = 1L; + + protected String name; + + protected String comment; + + protected Zone zone; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String getComment() { + return comment; + } + + @Override + public void setComment(String comment) { + this.comment = comment; + } + + public Zone getZone() { + return zone; + } + + public void setZone(Zone zone) { + this.zone = zone; + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Survey.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,477 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.CommentAware; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; + +import java.util.Date; +import java.util.List; + +/** + * To represent a trait. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Trait extends AbstractTuttiEntity implements CommentAware { + + private static final long serialVersionUID = 1L; + + protected Campaign campaign; + + protected Integer stationNumber; + + protected Integer traitNumber; + + protected Date date; + + protected Strata strate; + + protected Float gearShootingStartLatitude; + + protected Float gearShootingStartLongitude; + + protected Date gearShootingStartTime; + + protected Float gearShootingStartDepth; + + protected Float gearShootingEndLatitude; + + protected Float gearShootingEndLongitude; + + protected Date gearShootingEndTime; + + protected Float gearShootingEndDepth; + + protected BeaufortScale beaufortScale; + + protected Integer windDirection; + + protected SeaState seaState; + + protected Float ouvertureHorizontale; + + protected Float ouvertureVerticale; + + protected boolean geometrieMesuree; + + protected Float longueurFunes; + + protected Float longueurBras; + + protected boolean systemeFermetureCul; + + protected boolean traitRectiligne; + + protected Float distanceChalutee; + + protected Float duree; + + protected boolean traitValid; + + protected String localite; + + protected String comment; + + protected List<TuttiUser> saisisseur; + + protected Float gearShootingStartSurfaceTemperature; + + protected Float gearShootingEndSurfaceTemperature; + + protected Float gearShootingStartBottomTemperature; + + protected Float gearShootingEndBottomTemperature; + + protected Float averageBottomTemperature; + + protected Float gearShootingStartSurfaceSalinity; + + protected Float gearShootingEndSurfaceSalinity; + + protected Float gearShootingStartBottomSalinity; + + protected Float gearShootingEndBottomSalinity; + + protected Float averageBottomSalinity; + + protected Float speciesTotalWeight; + + protected Float speciesTotalVracWeight; + + protected Float speciesSampleVracWeight; + + protected Float speciesTotalHorsVracWeight; + + public Campaign getCampaign() { + return campaign; + } + + public void setCampaign(Campaign campaign) { + this.campaign = campaign; + } + + public Integer getStationNumber() { + return stationNumber; + } + + public void setStationNumber(Integer stationNumber) { + this.stationNumber = stationNumber; + } + + public Integer getTraitNumber() { + return traitNumber; + } + + public void setTraitNumber(Integer traitNumber) { + this.traitNumber = traitNumber; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public Float getGearShootingStartLatitude() { + return gearShootingStartLatitude; + } + + public void setGearShootingStartLatitude(Float gearShootingStartLatitude) { + this.gearShootingStartLatitude = gearShootingStartLatitude; + } + + public Float getGearShootingStartLongitude() { + return gearShootingStartLongitude; + } + + public void setGearShootingStartLongitude(Float gearShootingStartLongitude) { + this.gearShootingStartLongitude = gearShootingStartLongitude; + } + + public Date getGearShootingStartTime() { + return gearShootingStartTime; + } + + public void setGearShootingStartTime(Date gearShootingStartTime) { + this.gearShootingStartTime = gearShootingStartTime; + } + + public Float getGearShootingStartDepth() { + return gearShootingStartDepth; + } + + public void setGearShootingStartDepth(Float gearShootingStartDepth) { + this.gearShootingStartDepth = gearShootingStartDepth; + } + + public Float getGearShootingEndLatitude() { + return gearShootingEndLatitude; + } + + public void setGearShootingEndLatitude(Float gearShootingEndLatitude) { + this.gearShootingEndLatitude = gearShootingEndLatitude; + } + + public Float getGearShootingEndLongitude() { + return gearShootingEndLongitude; + } + + public void setGearShootingEndLongitude(Float gearShootingEndLongitude) { + this.gearShootingEndLongitude = gearShootingEndLongitude; + } + + public Date getGearShootingEndTime() { + return gearShootingEndTime; + } + + public void setGearShootingEndTime(Date gearShootingEndTime) { + this.gearShootingEndTime = gearShootingEndTime; + } + + public Float getGearShootingEndDepth() { + return gearShootingEndDepth; + } + + public void setGearShootingEndDepth(Float gearShootingEndDepth) { + this.gearShootingEndDepth = gearShootingEndDepth; + } + + public Float getOuvertureHorizontale() { + return ouvertureHorizontale; + } + + public void setOuvertureHorizontale(Float ouvertureHorizontale) { + this.ouvertureHorizontale = ouvertureHorizontale; + } + + public Float getOuvertureVerticale() { + return ouvertureVerticale; + } + + public void setOuvertureVerticale(Float ouvertureVerticale) { + this.ouvertureVerticale = ouvertureVerticale; + } + + public boolean getGeometrieMesuree() { + return geometrieMesuree; + } + + public void isGeometrieMesuree(boolean geometrieMesuree) { + this.geometrieMesuree = geometrieMesuree; + } + + public Float getLongueurFunes() { + return longueurFunes; + } + + public void setLongueurFunes(Float longueurFunes) { + this.longueurFunes = longueurFunes; + } + + public Float getLongueurBras() { + return longueurBras; + } + + public void setLongueurBras(Float longueurBras) { + this.longueurBras = longueurBras; + } + + public boolean getSystemeFermetureCul() { + return systemeFermetureCul; + } + + public void setSystemeFermetureCul(boolean systemeFermetureCul) { + this.systemeFermetureCul = systemeFermetureCul; + } + + public boolean isTraitRectiligne() { + return traitRectiligne; + } + + public void setTraitRectiligne(boolean traitRectiligne) { + this.traitRectiligne = traitRectiligne; + } + + public Float getDistanceChalutee() { + return distanceChalutee; + } + + public void setDistanceChalutee(Float distanceChalutee) { + this.distanceChalutee = distanceChalutee; + } + + public Float getDuree() { + return duree; + } + + public void setDuree(Float duree) { + this.duree = duree; + } + + public boolean isTraitValid() { + return traitValid; + } + + public void setTraitValid(boolean traitValid) { + this.traitValid = traitValid; + } + + public String getLocalite() { + return localite; + } + + public void setLocalite(String localite) { + this.localite = localite; + } + + @Override + public String getComment() { + return comment; + } + + @Override + public void setComment(String comment) { + this.comment = comment; + } + + public List<TuttiUser> getSaisisseur() { + return saisisseur; + } + + public void setSaisisseur(List<TuttiUser> saisisseur) { + this.saisisseur = saisisseur; + } + + public Strata getStrate() { + return strate; + } + + public void setStrate(Strata strate) { + this.strate = strate; + } + + public BeaufortScale getBeaufortScale() { + return beaufortScale; + } + + public void setBeaufortScale(BeaufortScale beaufortScale) { + this.beaufortScale = beaufortScale; + } + + public Integer getWindDirection() { + return windDirection; + } + + public void setWindDirection(Integer windDirection) { + this.windDirection = windDirection; + } + + public SeaState getSeaState() { + return seaState; + } + + public void setSeaState(SeaState seaState) { + this.seaState = seaState; + } + + public Float getGearShootingStartSurfaceTemperature() { + return gearShootingStartSurfaceTemperature; + } + + public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) { + this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature; + } + + public Float getGearShootingEndSurfaceTemperature() { + return gearShootingEndSurfaceTemperature; + } + + public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) { + this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature; + } + + public Float getGearShootingStartBottomTemperature() { + return gearShootingStartBottomTemperature; + } + + public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) { + this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature; + } + + public Float getGearShootingEndBottomTemperature() { + return gearShootingEndBottomTemperature; + } + + public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) { + this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature; + } + + public Float getAverageBottomTemperature() { + return averageBottomTemperature; + } + + public void setAverageBottomTemperature(Float averageBottomTemperature) { + this.averageBottomTemperature = averageBottomTemperature; + } + + public Float getGearShootingStartSurfaceSalinity() { + return gearShootingStartSurfaceSalinity; + } + + public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) { + this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity; + } + + public Float getGearShootingEndSurfaceSalinity() { + return gearShootingEndSurfaceSalinity; + } + + public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) { + this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity; + } + + public Float getGearShootingStartBottomSalinity() { + return gearShootingStartBottomSalinity; + } + + public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) { + this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity; + } + + public Float getGearShootingEndBottomSalinity() { + return gearShootingEndBottomSalinity; + } + + public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) { + this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity; + } + + public Float getAverageBottomSalinity() { + return averageBottomSalinity; + } + + public void setAverageBottomSalinity(Float averageBottomSalinity) { + this.averageBottomSalinity = averageBottomSalinity; + } + + public Float getSpeciesTotalWeight() { + return speciesTotalWeight; + } + + public void setSpeciesTotalWeight(Float speciesTotalWeight) { + this.speciesTotalWeight = speciesTotalWeight; + } + + public Float getSpeciesTotalVracWeight() { + return speciesTotalVracWeight; + } + + public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) { + this.speciesTotalVracWeight = speciesTotalVracWeight; + } + + public Float getSpeciesSampleVracWeight() { + return speciesSampleVracWeight; + } + + public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) { + this.speciesSampleVracWeight = speciesSampleVracWeight; + } + + public Float getSpeciesTotalHorsVracWeight() { + return speciesTotalHorsVracWeight; + } + + public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) { + this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight; + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Trait.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java (from rev 25, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,45 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.CommentAware; +import fr.ifremer.tutti.persistence.entities.SpeciesAware; + +/** + * For any bean which relies to a {@link Trait}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public interface TraitAware extends SpeciesAware, CommentAware { + + Trait getTrait(); + + void setTrait(Trait trait); + + Float getWeight(); + + void setWeight(Float weigth); +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/TraitAware.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,34 @@ +package fr.ifremer.tutti.persistence.entities.data; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public enum VracHorsVracEnum { + VRAC, + HORS_VRAC +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/VracHorsVracEnum.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a beaufort scale. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class BeaufortScale extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScale.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a beaufort scale. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class BeaufortScaleBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a country. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Country extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Country.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a country. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class CountryBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a gear. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Gear extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Gear.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a gear. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class GearBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents the sea state. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SeaState extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaState.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents the sea state. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SeaStateBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,48 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a sex. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Sex extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Sex.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,48 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a sex. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SexBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,58 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a fishes species. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Species extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String codeMemo; + + protected String genusSpecies; + + public String getCodeMemo() { + return codeMemo; + } + + public void setCodeMemo(String codeMemo) { + this.codeMemo = codeMemo; + } + + public String getGenusSpecies() { + return genusSpecies; + } + + public void setGenusSpecies(String genusSpecies) { + this.genusSpecies = genusSpecies; + } +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Species.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,58 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a fishes species. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SpeciesBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String codeMemo; - - protected String genusSpecies; - - public String getCodeMemo() { - return codeMemo; - } - - public void setCodeMemo(String codeMemo) { - this.codeMemo = codeMemo; - } - - public String getGenusSpecies() { - return genusSpecies; - } - - public void setGenusSpecies(String genusSpecies) { - this.genusSpecies = genusSpecies; - } -} Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a user. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class TuttiUser extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/TuttiUser.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a user. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class UserBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a vessel. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Vessel extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Vessel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a vessel. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class VesselBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a weight category. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class WeightCategory extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategory.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a weight category. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class WeightCategoryBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java (from rev 29, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,49 @@ +package fr.ifremer.tutti.persistence.entities.referential; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; + +/** + * Represents a survey zone. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Zone extends AbstractTuttiEntity { + + private static final long serialVersionUID = 1L; + + protected String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/Zone.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,49 +0,0 @@ -package fr.ifremer.tutti.persistence.entities.referential; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; - -/** - * Represents a survey zone. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class ZoneBean extends AbstractTuttiBean { - - private static final long serialVersionUID = 1L; - - protected String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} \ No newline at end of file Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,18 +25,18 @@ */ import com.google.common.collect.ArrayListMultimap; -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import java.util.List; import java.util.UUID; @@ -49,7 +49,7 @@ */ public class TuttiPersistenceDevFixtures { - protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache; + protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache; public TuttiPersistenceDevFixtures() { @@ -57,240 +57,240 @@ cache = ArrayListMultimap.create(); - ZoneBean b; - b = new ZoneBean(); + Zone b; + b = new Zone(); b.setId(UUID.randomUUID().toString()); b.setName("zone1"); - cache.put(ZoneBean.class, b); + cache.put(Zone.class, b); - b = new ZoneBean(); + b = new Zone(); b.setId(UUID.randomUUID().toString()); b.setName("zone2"); - cache.put(ZoneBean.class, b); + cache.put(Zone.class, b); - CountryBean c; - c = new CountryBean(); + Country c; + c = new Country(); c.setId(UUID.randomUUID().toString()); c.setName("France"); - cache.put(CountryBean.class, c); + cache.put(Country.class, c); - c = new CountryBean(); + c = new Country(); c.setId(UUID.randomUUID().toString()); c.setName("Espagne"); - cache.put(CountryBean.class, c); + cache.put(Country.class, c); - VesselBean v; + Vessel v; - v = new VesselBean(); + v = new Vessel(); v.setId(UUID.randomUUID().toString()); v.setName("THALASSA"); - cache.put(VesselBean.class, v); + cache.put(Vessel.class, v); - v = new VesselBean(); + v = new Vessel(); v.setId(UUID.randomUUID().toString()); v.setName("THALASSA-II"); - cache.put(VesselBean.class, v); + cache.put(Vessel.class, v); - GearBean g; + Gear g; - g = new GearBean(); + g = new Gear(); g.setId(UUID.randomUUID().toString()); g.setName("Gear-1"); - cache.put(GearBean.class, g); + cache.put(Gear.class, g); - g = new GearBean(); + g = new Gear(); g.setId(UUID.randomUUID().toString()); g.setName("Gear-2"); - cache.put(GearBean.class, g); + cache.put(Gear.class, g); - UserBean u; + TuttiUser u; - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Vincent Badts"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Jean claude Mahet"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Luisa Metral"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Jean Hervé Bourdeix"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Ysabelle Cheret"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - u = new UserBean(); + u = new TuttiUser(); u.setId(UUID.randomUUID().toString()); u.setName("Blandine Brisset"); - cache.put(UserBean.class, u); + cache.put(TuttiUser.class, u); - BeaufortScaleBean bs; + BeaufortScale bs; - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Calme"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Très légère brise"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Petite brise"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Jolie brise"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Vent frais"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Grand frais"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Coup de vent"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - bs = new BeaufortScaleBean(); + bs = new BeaufortScale(); bs.setId(UUID.randomUUID().toString()); bs.setName("Fort coup de vent"); - cache.put(BeaufortScaleBean.class, bs); + cache.put(BeaufortScale.class, bs); - SeaStateBean st; + SeaState st; - st = new SeaStateBean(); + st = new SeaState(); st.setId(UUID.randomUUID().toString()); st.setName("Mer calme"); - cache.put(SeaStateBean.class, st); + cache.put(SeaState.class, st); - st = new SeaStateBean(); + st = new SeaState(); st.setId(UUID.randomUUID().toString()); st.setName("Mer agitée"); - cache.put(SeaStateBean.class, st); + cache.put(SeaState.class, st); - SpeciesBean sp; + Species sp; - sp = new SpeciesBean(); + sp = new Species(); sp.setId(UUID.randomUUID().toString()); sp.setCodeMemo("BAR"); sp.setGenusSpecies("Bar"); - cache.put(SpeciesBean.class, sp); + cache.put(Species.class, sp); - sp = new SpeciesBean(); + sp = new Species(); sp.setId(UUID.randomUUID().toString()); sp.setCodeMemo("CHIN"); sp.setGenusSpecies("Chinchard"); - cache.put(SpeciesBean.class, sp); + cache.put(Species.class, sp); - sp = new SpeciesBean(); + sp = new Species(); sp.setId(UUID.randomUUID().toString()); sp.setCodeMemo("FLE"); sp.setGenusSpecies("Flet"); - cache.put(SpeciesBean.class, sp); + cache.put(Species.class, sp); - sp = new SpeciesBean(); + sp = new Species(); sp.setId(UUID.randomUUID().toString()); sp.setCodeMemo("LIM"); sp.setGenusSpecies("Limande"); - cache.put(SpeciesBean.class, sp); + cache.put(Species.class, sp); - SexBean se; - se = new SexBean(); + Sex se; + se = new Sex(); se.setId(UUID.randomUUID().toString()); se.setName("Male"); - cache.put(SexBean.class, se); + cache.put(Sex.class, se); - se = new SexBean(); + se = new Sex(); se.setId(UUID.randomUUID().toString()); se.setName("Femelle"); - cache.put(SexBean.class, se); + cache.put(Sex.class, se); - se = new SexBean(); + se = new Sex(); se.setId(UUID.randomUUID().toString()); se.setName("Indéterminé"); - cache.put(SexBean.class, se); + cache.put(Sex.class, se); - WeightCategoryBean wc; + WeightCategory wc; - wc = new WeightCategoryBean(); + wc = new WeightCategory(); wc.setId(UUID.randomUUID().toString()); wc.setName("Petit"); - cache.put(WeightCategoryBean.class, wc); + cache.put(WeightCategory.class, wc); - wc = new WeightCategoryBean(); + wc = new WeightCategory(); wc.setId(UUID.randomUUID().toString()); wc.setName("Gros"); - cache.put(WeightCategoryBean.class, wc); + cache.put(WeightCategory.class, wc); } - public List<ZoneBean> zone() { - return getData(ZoneBean.class); + public List<Zone> zone() { + return getData(Zone.class); } - public List<CountryBean> country() { - return getData(CountryBean.class); + public List<Country> country() { + return getData(Country.class); } - public List<VesselBean> vessel() { - return getData(VesselBean.class); + public List<Vessel> vessel() { + return getData(Vessel.class); } - public List<GearBean> gear() { - return getData(GearBean.class); + public List<Gear> gear() { + return getData(Gear.class); } - public List<UserBean> user() { - return getData(UserBean.class); + public List<TuttiUser> user() { + return getData(TuttiUser.class); } - public List<StrataBean> strata() { - return getData(StrataBean.class); + public List<Strata> strata() { + return getData(Strata.class); } - public List<SeaStateBean> seaState() { - return getData(SeaStateBean.class); + public List<SeaState> seaState() { + return getData(SeaState.class); } - public List<BeaufortScaleBean> beaufortScale() { - return getData(BeaufortScaleBean.class); + public List<BeaufortScale> beaufortScale() { + return getData(BeaufortScale.class); } - public List<SpeciesBean> species() { - return getData(SpeciesBean.class); + public List<Species> species() { + return getData(Species.class); } - public List<SexBean> sex() { - return getData(SexBean.class); + public List<Sex> sex() { + return getData(Sex.class); } - public List<WeightCategoryBean> weightCategory() { - return getData(WeightCategoryBean.class); + public List<WeightCategory> weightCategory() { + return getData(WeightCategory.class); } - protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) { + protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) { List<B> result = (List<B>) cache.get(entityType); return result; } Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,33 +25,35 @@ */ +import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig; -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitCatchBeanAware; -import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; +import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.data.TraitAware; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -66,6 +68,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.List; +import java.util.Map; import java.util.UUID; /** @@ -80,35 +83,41 @@ private static final Log log = LogFactory.getLog(TuttiPersistenceDevImpl.class); - protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache = ArrayListMultimap.create(); + protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache = ArrayListMultimap.create(); - public static final List<Class<? extends AbstractTuttiBean>> TYPES = Lists.newArrayList( - BeaufortScaleBean.class, - CampaignBean.class, - CountryBean.class, - GearBean.class, - SeaStateBean.class, - SexBean.class, - SpeciesBean.class, - SurveyBean.class, - TraitBean.class, - TraitBenthosCatchBean.class, - TraitSpeciesCatchBean.class, - TraitPlanctonCatchBean.class, - TraitMacroDechetCatchBean.class, - TraitCaptureAccidentelCatchBean.class, - UserBean.class, - VesselBean.class, - WeightCategoryBean.class, - ZoneBean.class + public static final List<Class<? extends AbstractTuttiEntity>> TYPES = Lists.newArrayList( + BeaufortScale.class, + Campaign.class, + Country.class, + Gear.class, + SeaState.class, + Sex.class, + Species.class, + Survey.class, + Trait.class, + BenthosBatch.class, + SpeciesBatch.class, + SpeciesBatchFrequency.class, + PlanctonBatch.class, + MacroDechetBatch.class, + AccidentelBatch.class, + TuttiUser.class, + Vessel.class, + WeightCategory.class, + Zone.class ); + protected TuttiPersistenceDevConfig config; + + //------------------------------------------------------------------------// + //-- Technical methods --// + //------------------------------------------------------------------------// + @Override public String getImplementationName() { return "Persistence Dev implementation"; } - protected TuttiPersistenceDevConfig config; @Override public void open(ApplicationConfig config) throws IOException { @@ -125,7 +134,7 @@ TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures(); - for (Class<? extends AbstractTuttiBean> entityType : TYPES) { + for (Class<? extends AbstractTuttiEntity> entityType : TYPES) { loadEntities(entityType, fixtures); } } @@ -133,89 +142,122 @@ @Override public void close() throws IOException { - for (Class<? extends AbstractTuttiBean> entityType : cache.keySet()) { + for (Class<? extends AbstractTuttiEntity> entityType : cache.keySet()) { persistToFile(entityType); } } + //------------------------------------------------------------------------// + //-- Referential methods --// + //------------------------------------------------------------------------// + @Override - public List<WeightCategoryBean> getAllWeightCategories() { - List<WeightCategoryBean> result = getDataInNewList(WeightCategoryBean.class); + public List<WeightCategory> getAllWeightCategory() { + List<WeightCategory> result = + getDataInNewList(WeightCategory.class); return result; } @Override - public List<SexBean> getAllSex() { - List<SexBean> result = getDataInNewList(SexBean.class); + public List<Sex> getAllSex() { + List<Sex> result = getDataInNewList(Sex.class); return result; } @Override - public List<SpeciesBean> getAllSpecies() { - List<SpeciesBean> result = getDataInNewList(SpeciesBean.class); + public List<Species> getAllSpecies() { + List<Species> result = getDataInNewList(Species.class); return result; } @Override - public List<SurveyBean> getAllSurveys() { - List<SurveyBean> result = getDataInNewList(SurveyBean.class); + public List<Zone> getAllZone() { + List<Zone> result = getDataInNewList(Zone.class); return result; } @Override - public List<ZoneBean> getAllZones() { - List<ZoneBean> result = getDataInNewList(ZoneBean.class); + public List<Country> getAllCountry() { + List<Country> result = getDataInNewList(Country.class); return result; } @Override - public List<CountryBean> getAllCountries() { - List<CountryBean> result = getDataInNewList(CountryBean.class); + public List<Vessel> getAllVessel() { + List<Vessel> result = getDataInNewList(Vessel.class); return result; } @Override - public List<VesselBean> getAllVessels() { - List<VesselBean> result = getDataInNewList(VesselBean.class); + public List<Gear> getAllGear() { + List<Gear> result = getDataInNewList(Gear.class); return result; } @Override - public List<GearBean> getAllGears() { - List<GearBean> result = getDataInNewList(GearBean.class); + public List<TuttiUser> getAllTuttiUser() { + List<TuttiUser> result = getDataInNewList(TuttiUser.class); return result; } + @Override + public List<SeaState> getAllSeaState() { + List<SeaState> result = getDataInNewList(SeaState.class); + return result; + } @Override - public List<UserBean> getAllUsers() { - List<UserBean> result = getDataInNewList(UserBean.class); + public List<Strata> getAllStrata() { + List<Strata> result = getDataInNewList(Strata.class); return result; } @Override - public List<SeaStateBean> getAllSeaStates() { - List<SeaStateBean> result = getDataInNewList(SeaStateBean.class); + public List<BeaufortScale> getAllBeaufortScale() { + List<BeaufortScale> result = + getDataInNewList(BeaufortScale.class); return result; } + + //------------------------------------------------------------------------// + //-- Survey methods --// + //------------------------------------------------------------------------// + @Override - public List<StrataBean> getAllStratas() { - List<StrataBean> result = getDataInNewList(StrataBean.class); + public List<Survey> getAllSurvey() { + List<Survey> result = getDataInNewList(Survey.class); return result; } @Override - public List<BeaufortScaleBean> getAllBeaufortScales() { - List<BeaufortScaleBean> result = getDataInNewList(BeaufortScaleBean.class); + public Survey getSurvey(String surveyId) { + Survey result = getBean(Survey.class, surveyId); return result; } @Override - public List<CampaignBean> getAllCampaigns(final String surveyId) { - List<CampaignBean> result = Lists.newArrayList(Iterables.filter(getData(CampaignBean.class), new Predicate<CampaignBean>() { + public Survey createSurvey(Survey bean) { + Survey result = create(Survey.class, bean); + return result; + } + + @Override + public Survey saveSurvey(Survey bean) { + Survey result = save(Survey.class, bean); + return result; + } + + + //------------------------------------------------------------------------// + //-- Campaign methods --// + //------------------------------------------------------------------------// + + @Override + public List<Campaign> getAllCampaign(final String surveyId) { + List<Campaign> result = Lists.newArrayList(Iterables.filter(getData(Campaign.class), new Predicate<Campaign>() { @Override - public boolean apply(CampaignBean input) { + public boolean apply(Campaign input) { return surveyId.equals(input.getSurvey().getId()); } })); @@ -223,10 +265,32 @@ } @Override - public List<TraitBean> getAllTraits(final String campaignId) { - List<TraitBean> result = Lists.newArrayList(Iterables.filter(getData(TraitBean.class), new Predicate<TraitBean>() { + public Campaign getCampaign(String campaignId) { + Campaign result = getBean(Campaign.class, campaignId); + return result; + } + + @Override + public Campaign createCampaign(Campaign bean) { + Campaign result = create(Campaign.class, bean); + return result; + } + + @Override + public Campaign saveCampaign(Campaign bean) { + Campaign result = save(Campaign.class, bean); + return result; + } + + //------------------------------------------------------------------------// + //-- Trait methods --// + //------------------------------------------------------------------------// + + @Override + public List<Trait> getAllTrait(final String campaignId) { + List<Trait> result = Lists.newArrayList(Iterables.filter(getData(Trait.class), new Predicate<Trait>() { @Override - public boolean apply(TraitBean input) { + public boolean apply(Trait input) { return campaignId.equals(input.getCampaign().getId()); } })); @@ -234,113 +298,225 @@ } @Override - public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(final String traitId) { - return getAllTraitFilterCatches(TraitSpeciesCatchBean.class, traitId); + public Trait getTrait(String traitId) { + Trait result = TuttiEntities.findById(getData(Trait.class), traitId); + return result; } @Override - public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) { - return getAllTraitFilterCatches(TraitBenthosCatchBean.class, traitId); + public Trait createTrait(Trait bean) { + Trait result = create(Trait.class, bean); + return result; } @Override - public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) { - return getAllTraitFilterCatches(TraitPlanctonCatchBean.class, traitId); + public Trait saveTrait(Trait bean) { + Trait result = save(Trait.class, bean); + return result; } + //------------------------------------------------------------------------// + //-- Species Batch methods --// + //------------------------------------------------------------------------// + @Override - public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) { - return getAllTraitFilterCatches(TraitMacroDechetCatchBean.class, traitId); + public List<SpeciesBatch> getAllSpeciesBatch(final String traitId) { + List<SpeciesBatch> result = getAllTraitFilterBatches( + SpeciesBatch.class, traitId); + return result; } @Override - public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) { - return getAllTraitFilterCatches(TraitCaptureAccidentelCatchBean.class, traitId); + public SpeciesBatch getSpeciesBatch(String id) { + SpeciesBatch result = getBean(SpeciesBatch.class, id); + return result; } @Override - public SurveyBean getSurvey(String surveyId) { - SurveyBean result = TuttiBeans.findById(getData(SurveyBean.class), surveyId); + public SpeciesBatch createSpeciesBatch(SpeciesBatch bean) { + SpeciesBatch result = create(SpeciesBatch.class, bean); return result; } @Override - public CampaignBean getCampaign(String campaignId) { - CampaignBean result = TuttiBeans.findById(getData(CampaignBean.class), campaignId); + public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) { + SpeciesBatch result = save(SpeciesBatch.class, bean); return result; } @Override - public TraitBean getTrait(String traitId) { - TraitBean result = TuttiBeans.findById(getData(TraitBean.class), traitId); + public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(final String speciesBatchId) { + List<SpeciesBatchFrequency> result = Lists.newArrayList(Iterables.filter(getData(SpeciesBatchFrequency.class), new Predicate<SpeciesBatchFrequency>() { + @Override + public boolean apply(SpeciesBatchFrequency input) { + return speciesBatchId.equals(input.getBatch().getId()); + } + })); return result; } @Override - public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) { - TraitSpeciesCatchBean result = TuttiBeans.findById(getData(TraitSpeciesCatchBean.class), id); + public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, + List<SpeciesBatchFrequency> frequencies) { + + // get back existing data + List<SpeciesBatchFrequency> existingData = + getAllSpeciesBatchFrequency(speciesBatchId); + + // index them by id + Map<String, SpeciesBatchFrequency> existingById = + TuttiEntities.splitById(existingData); + + List<SpeciesBatchFrequency> result = Lists.newArrayList(); + + for (SpeciesBatchFrequency toSave : frequencies) { + + SpeciesBatchFrequency saved; + + if (TuttiEntities.isNew(toSave)) { + + // must create it + saved = new SpeciesBatchFrequency(); + } else { + + // get existing data + saved = existingById.get(toSave.getId()); + } + + // persist it + persist(SpeciesBatchFrequency.class, toSave, saved); + + // store it back in result + result.add(saved); + } + return result; } + //------------------------------------------------------------------------// + //-- Benthos Batch methods --// + //------------------------------------------------------------------------// + @Override - public SurveyBean createSurvey(SurveyBean bean) { - SurveyBean result = new SurveyBean(); - persist(SurveyBean.class, bean, result); + public List<BenthosBatch> getAllBenthosBatch(String traitId) { + List<BenthosBatch> result = getAllTraitFilterBatches( + BenthosBatch.class, traitId); return result; } @Override - public SurveyBean saveSurvey(SurveyBean bean) { - SurveyBean result = getSurvey(bean.getId()); - persist(SurveyBean.class, bean, result); + public BenthosBatch getBenthosBatch(String id) { + BenthosBatch result = getBean(BenthosBatch.class, id); return result; } @Override - public CampaignBean createCampaign(CampaignBean bean) { - CampaignBean result = new CampaignBean(); - persist(CampaignBean.class, bean, result); + public BenthosBatch createBenthosBatch(BenthosBatch bean) { + BenthosBatch result = create(BenthosBatch.class, bean); return result; } @Override - public CampaignBean saveCampaign(CampaignBean bean) { - CampaignBean result = getCampaign(bean.getId()); - persist(CampaignBean.class, bean, result); + public BenthosBatch saveBenthosBatch(BenthosBatch bean) { + BenthosBatch result = save(BenthosBatch.class, bean); return result; } + //------------------------------------------------------------------------// + //-- Plancton Batch methods --// + //------------------------------------------------------------------------// + @Override - public TraitBean createTrait(TraitBean bean) { - TraitBean result = new TraitBean(); - persist(TraitBean.class, bean, result); + public List<PlanctonBatch> getAllPlanctonBatch(String traitId) { + List<PlanctonBatch> result = getAllTraitFilterBatches( + PlanctonBatch.class, traitId); return result; + } @Override - public TraitBean saveTrait(TraitBean bean) { - TraitBean result = getTrait(bean.getId()); - persist(TraitBean.class, bean, result); + public PlanctonBatch getPlanctonBatch(String id) { + PlanctonBatch result = getBean(PlanctonBatch.class, id); return result; } @Override - public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) { - TraitSpeciesCatchBean result = new TraitSpeciesCatchBean(); - persist(TraitSpeciesCatchBean.class, bean, result); + public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) { + PlanctonBatch result = create(PlanctonBatch.class, bean); return result; } @Override - public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) { - TraitSpeciesCatchBean result = getTraitSpeciesCatch(bean.getId()); - persist(TraitSpeciesCatchBean.class, bean, result); + public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) { + PlanctonBatch result = save(PlanctonBatch.class, bean); return result; } - protected <B extends AbstractTuttiBean> void persist(Class<B> beanType, - B source, B target) { + //------------------------------------------------------------------------// + //-- Macrodechet Batch methods --// + //------------------------------------------------------------------------// + @Override + public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) { + List<MacroDechetBatch> result = getAllTraitFilterBatches( + MacroDechetBatch.class, traitId); + return result; + } + + @Override + public MacroDechetBatch getMacroDechetBatch(String id) { + MacroDechetBatch result = getBean(MacroDechetBatch.class, id); + return result; + } + + @Override + public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) { + MacroDechetBatch result = create(MacroDechetBatch.class, bean); + return result; + } + + @Override + public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) { + MacroDechetBatch result = save(MacroDechetBatch.class, bean); + return result; + } + + //------------------------------------------------------------------------// + //-- Accidentel Batch methods --// + //------------------------------------------------------------------------// + + @Override + public List<AccidentelBatch> getAllAccidentelBatch(String traitId) { + List<AccidentelBatch> result = getAllTraitFilterBatches( + AccidentelBatch.class, traitId); + return result; + } + + @Override + public AccidentelBatch getAccidentelBatch(String id) { + AccidentelBatch result = getBean(AccidentelBatch.class, id); + return result; + } + + @Override + public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) { + AccidentelBatch result = create(AccidentelBatch.class, bean); + return result; + } + + @Override + public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) { + AccidentelBatch result = save(AccidentelBatch.class, bean); + return result; + } + + //------------------------------------------------------------------------// + //-- Internal methods --// + //------------------------------------------------------------------------// + + protected <B extends AbstractTuttiEntity> void persist(Class<B> beanType, + B source, B target) { + BinderFactory.newBinder(beanType).copyExcluding( source, target, "id"); if (source.getId() == null) { @@ -352,8 +528,8 @@ persistToFile(beanType); } - protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType, - TuttiPersistenceDevFixtures fix + protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType, + TuttiPersistenceDevFixtures fix ) throws IOException { File storageFile = getStorageFile(entityType); @@ -390,8 +566,8 @@ return result; } - protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType, - List<B> defaultList) throws IOException { + protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType, + List<B> defaultList) throws IOException { File storageFile = getStorageFile(entityType); List<B> result; @@ -432,7 +608,7 @@ return result; } - protected <B extends AbstractTuttiBean> void persistToFile(Class<B> entityType) { + protected <B extends AbstractTuttiEntity> void persistToFile(Class<B> entityType) { List<B> entities = getDataInNewList(entityType); File storageFile = getStorageFile(entityType); @@ -456,19 +632,41 @@ } } - protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) { + protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) { List<B> result = (List<B>) cache.get(entityType); return result; } - protected <B extends AbstractTuttiBean> List<B> getDataInNewList(Class<B> entityType) { + protected <B extends AbstractTuttiEntity> List<B> getDataInNewList(Class<B> entityType) { List<B> result = getData(entityType); return Lists.newArrayList(result); } - protected <B extends AbstractTuttiBean & TraitCatchBeanAware> List<B> getAllTraitFilterCatches(Class<B> beanType, String traitId) { - List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), TuttiBeans.newTraitIdPredicate(traitId))); + protected <B extends AbstractTuttiEntity & TraitAware> List<B> getAllTraitFilterBatches(Class<B> beanType, String traitId) { + Predicate<B> predicate = TuttiEntities.newTraitIdPredicate(traitId); + List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), predicate)); return result; } + protected <B extends AbstractTuttiEntity> B create(Class<B> type, B bean) { + Preconditions.checkNotNull(bean, "Can't persist a null bean"); + B result = TuttiEntities.newEntity(bean); + persist(type, bean, result); + return result; + } + + protected <B extends AbstractTuttiEntity> B save(Class<B> type, B bean) { + Preconditions.checkNotNull(bean, "Can't persist a null bean"); + String id = bean.getId(); + Preconditions.checkNotNull(id, "Can't save a bean with null id"); + B result = getBean(type, id); + persist(type, bean, result); + return result; + } + + protected <B extends AbstractTuttiEntity> B getBean(Class<B> type, String id) { + B result = TuttiEntities.findById(getData(type), id); + return result; + } + } Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-12-06 17:03:05 UTC (rev 30) @@ -37,11 +37,11 @@ public enum TuttiPersistenceDevConfigOption implements ApplicationConfig.OptionDef { STORAGE_DIRECTORY("tutti.persistence.storageDirectory", - "Répertoire où sont stoquées les données", - "${tutti.data.directory}/devStorage", - File.class, - true, - true + "Répertoire où sont stoquées les données", + "${tutti.data.directory}/devStorage", + File.class, + true, + true ); /** Configuration key. */ Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java =================================================================== --- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ */ import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig; -import fr.ifremer.tutti.persistence.entities.SurveyBean; +import fr.ifremer.tutti.persistence.entities.data.Survey; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -84,7 +84,7 @@ Assert.assertTrue(storageDirectory.exists()); TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures(); - Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size()); + Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size()); } @Test @@ -97,11 +97,11 @@ persistence.open(config.getConfig()); TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures(); - Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size()); + Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size()); persistence.close(); Assert.assertTrue(storageDirectory.exists()); - Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size()); + Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size()); } @Test @@ -114,12 +114,12 @@ persistence.open(config.getConfig()); Assert.assertTrue(storageDirectory.exists()); - int size = persistence.getAllSurveys().size(); + int size = persistence.getAllSurvey().size(); - SurveyBean s = new SurveyBean(); + Survey s = new Survey(); s.setId("46de4ba5-3be6-4ab6-9f39-586b8e491fda"); s.setName("Serie 3"); - s.setZone(persistence.getAllZones().get(0)); + s.setZone(persistence.getAllZone().get(0)); persistence.createSurvey(s); @@ -128,7 +128,7 @@ persistence.open(config.getConfig()); - Assert.assertEquals(size + 1, persistence.getAllSurveys().size()); + Assert.assertEquals(size + 1, persistence.getAllSurvey().size()); } public static File getTestSpecificDirectory(Class<?> testClassName, Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,20 +24,20 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import org.nuiton.util.decorator.Decorator; import org.nuiton.util.decorator.DecoratorProvider; @@ -55,7 +55,7 @@ public static final String SPECIES_BY_GENUS = "byGenus"; - public static final String BY_NAME= "byName"; + public static final String BY_NAME = "byName"; /** Delegate decorator provider. */ protected DecoratorProvider decoratorProvider; @@ -84,23 +84,23 @@ @Override protected void loadDecorators() { - registerMultiJXPathDecorator(SurveyBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(CampaignBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - "); - registerMultiJXPathDecorator(ZoneBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(VesselBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(CountryBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(GearBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(UserBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(BeaufortScaleBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(SeaStateBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(StrataBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(SexBean.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(SpeciesBean.class, "${codeMemo}#${genusSpecies}$s", "#", " - "); - registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_CODE, "${codeMemo}$s"); - registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_GENUS, "${genusSpecies}$s"); - registerJXPathDecorator(WeightCategoryBean.class, BY_NAME, "${name}$s"); - registerJXPathDecorator(SexBean.class, BY_NAME, "${name}$s"); + registerMultiJXPathDecorator(Survey.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Campaign.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Trait.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - "); + registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Vessel.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Country.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Gear.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(TuttiUser.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(BeaufortScale.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(SeaState.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Strata.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Sex.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Species.class, "${codeMemo}#${genusSpecies}$s", "#", " - "); + registerJXPathDecorator(Species.class, SPECIES_BY_CODE, "${codeMemo}$s"); + registerJXPathDecorator(Species.class, SPECIES_BY_GENUS, "${genusSpecies}$s"); + registerJXPathDecorator(WeightCategory.class, BY_NAME, "${name}$s"); + registerJXPathDecorator(Sex.class, BY_NAME, "${name}$s"); } }; } @@ -109,17 +109,17 @@ n_("tutti.property.name"); n_("tutti.property.stationNumber"); n_("tutti.property.date"); - n_("tutti.property.surveyBean"); - n_("tutti.property.campaignBean"); - n_("tutti.property.traitBean"); - n_("tutti.property.zoneBean"); - n_("tutti.property.vesselBean"); - n_("tutti.property.countryBean"); - n_("tutti.property.gearBean"); - n_("tutti.property.userBean"); - n_("tutti.property.beaufortScaleBean"); - n_("tutti.property.seaStateBean"); - n_("tutti.property.strataBean"); + n_("tutti.property.survey"); + n_("tutti.property.campaign"); + n_("tutti.property.trait"); + n_("tutti.property.zone"); + n_("tutti.property.vessel"); + n_("tutti.property.country"); + n_("tutti.property.gear"); + n_("tutti.property.user"); + n_("tutti.property.beaufortScale"); + n_("tutti.property.seaState"); + n_("tutti.property.strata"); n_("tutti.property.codeMemo"); n_("tutti.property.genusSpecies"); } Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-06 17:03:05 UTC (rev 30) @@ -26,25 +26,26 @@ import com.google.common.base.Preconditions; import fr.ifremer.tutti.persistence.TuttiPersistence; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; +import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.ApplicationConfig; @@ -79,7 +80,17 @@ } } + //------------------------------------------------------------------------// + //-- Technical methods --// + //------------------------------------------------------------------------// + @Override + public String getImplementationName() { + checkDriverExists(); + return driver.getImplementationName(); + } + + @Override public void open(ApplicationConfig config) throws IOException { ServiceLoader<TuttiPersistence> loader = @@ -117,198 +128,318 @@ driver.close(); } + //------------------------------------------------------------------------// + //-- Referential methods --// + //------------------------------------------------------------------------// + @Override - public List<WeightCategoryBean> getAllWeightCategories() { + public List<WeightCategory> getAllWeightCategory() { checkDriverExists(); - return driver.getAllWeightCategories(); + return driver.getAllWeightCategory(); } @Override - public List<SexBean> getAllSex() { + public List<Sex> getAllSex() { checkDriverExists(); return driver.getAllSex(); } @Override - public List<SpeciesBean> getAllSpecies() { + public List<Species> getAllSpecies() { checkDriverExists(); return driver.getAllSpecies(); } @Override - public String getImplementationName() { + public List<Zone> getAllZone() { checkDriverExists(); - return driver.getImplementationName(); + return driver.getAllZone(); } @Override - public List<SurveyBean> getAllSurveys() { + public List<Country> getAllCountry() { checkDriverExists(); - return driver.getAllSurveys(); + return driver.getAllCountry(); } @Override - public List<ZoneBean> getAllZones() { + public List<Vessel> getAllVessel() { checkDriverExists(); - return driver.getAllZones(); + return driver.getAllVessel(); } @Override - public List<CountryBean> getAllCountries() { + public List<Gear> getAllGear() { checkDriverExists(); - return driver.getAllCountries(); + return driver.getAllGear(); } @Override - public List<VesselBean> getAllVessels() { + public List<TuttiUser> getAllTuttiUser() { checkDriverExists(); - return driver.getAllVessels(); + return driver.getAllTuttiUser(); } @Override - public List<GearBean> getAllGears() { + public List<SeaState> getAllSeaState() { checkDriverExists(); - return driver.getAllGears(); + return driver.getAllSeaState(); } @Override - public List<UserBean> getAllUsers() { + public List<Strata> getAllStrata() { checkDriverExists(); - return driver.getAllUsers(); + return driver.getAllStrata(); } @Override - public List<SeaStateBean> getAllSeaStates() { + public List<BeaufortScale> getAllBeaufortScale() { checkDriverExists(); - return driver.getAllSeaStates(); + return driver.getAllBeaufortScale(); } + //------------------------------------------------------------------------// + //-- Survey methods --// + //------------------------------------------------------------------------// + @Override - public List<StrataBean> getAllStratas() { + public List<Survey> getAllSurvey() { checkDriverExists(); - return driver.getAllStratas(); + return driver.getAllSurvey(); } @Override - public List<BeaufortScaleBean> getAllBeaufortScales() { + public Survey getSurvey(String surveyId) { checkDriverExists(); - return driver.getAllBeaufortScales(); + return driver.getSurvey(surveyId); } @Override - public List<CampaignBean> getAllCampaigns(String surveyId) { + public Survey createSurvey(Survey bean) { checkDriverExists(); - return driver.getAllCampaigns(surveyId); + return driver.createSurvey(bean); } @Override - public List<TraitBean> getAllTraits(String campaignId) { + public Survey saveSurvey(Survey bean) { checkDriverExists(); - return driver.getAllTraits(campaignId); + return driver.saveSurvey(bean); } + //------------------------------------------------------------------------// + //-- Campaign methods --// + //------------------------------------------------------------------------// + @Override - public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId) { + public List<Campaign> getAllCampaign(String surveyId) { checkDriverExists(); - return driver.getAllTraitSpeciesCatch(traitId); + return driver.getAllCampaign(surveyId); } @Override - public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) { + public Campaign getCampaign(String campaignId) { checkDriverExists(); - return driver.getAllTraitBenthosCatch(traitId); + return driver.getCampaign(campaignId); } @Override - public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) { + public Campaign createCampaign(Campaign bean) { checkDriverExists(); - return driver.getAllTraitPlanctonCatch(traitId); + return driver.createCampaign(bean); } @Override - public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) { + public Campaign saveCampaign(Campaign bean) { checkDriverExists(); - return driver.getAllTraitMacroDechetCatch(traitId); + return driver.saveCampaign(bean); } + //------------------------------------------------------------------------// + //-- Trait methods --// + //------------------------------------------------------------------------// + @Override - public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) { + public List<Trait> getAllTrait(String campaignId) { checkDriverExists(); - return driver.getAllTraitCaptureAccidentelCatch(traitId); + return driver.getAllTrait(campaignId); } @Override - public SurveyBean getSurvey(String surveyId) { + public Trait getTrait(String traitId) { checkDriverExists(); - return driver.getSurvey(surveyId); + return driver.getTrait(traitId); } @Override - public CampaignBean getCampaign(String campaignId) { + public Trait createTrait(Trait bean) { checkDriverExists(); - return driver.getCampaign(campaignId); + return driver.createTrait(bean); } @Override - public TraitBean getTrait(String traitId) { + public Trait saveTrait(Trait bean) { checkDriverExists(); - return driver.getTrait(traitId); + return driver.saveTrait(bean); } + //------------------------------------------------------------------------// + //-- Species Batch methods --// + //------------------------------------------------------------------------// + + @Override - public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) { + public List<SpeciesBatch> getAllSpeciesBatch(String traitId) { checkDriverExists(); - return driver.getTraitSpeciesCatch(id); + return driver.getAllSpeciesBatch(traitId); } @Override - public SurveyBean createSurvey(SurveyBean bean) { + public SpeciesBatch getSpeciesBatch(String id) { checkDriverExists(); - return driver.createSurvey(bean); + return driver.getSpeciesBatch(id); } @Override - public SurveyBean saveSurvey(SurveyBean bean) { + public SpeciesBatch createSpeciesBatch(SpeciesBatch bean) { checkDriverExists(); - return driver.saveSurvey(bean); + return driver.createSpeciesBatch(bean); } @Override - public CampaignBean createCampaign(CampaignBean bean) { + public SpeciesBatch saveSpeciesBatch(SpeciesBatch bean) { checkDriverExists(); - return driver.createCampaign(bean); + return driver.saveSpeciesBatch(bean); } @Override - public CampaignBean saveCampaign(CampaignBean bean) { + public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId) { checkDriverExists(); - return driver.saveCampaign(bean); + return driver.getAllSpeciesBatchFrequency(speciesBatchId); } @Override - public TraitBean createTrait(TraitBean bean) { + public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, + List<SpeciesBatchFrequency> frequencies) { checkDriverExists(); - return driver.createTrait(bean); + return driver.saveSpeciesBatchFrequency(speciesBatchId, frequencies); } + //------------------------------------------------------------------------// + //-- Benthos Batch methods --// + //------------------------------------------------------------------------// + @Override - public TraitBean saveTrait(TraitBean bean) { + public List<BenthosBatch> getAllBenthosBatch(String traitId) { checkDriverExists(); - return driver.saveTrait(bean); + return driver.getAllBenthosBatch(traitId); } @Override - public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) { + public BenthosBatch getBenthosBatch(String id) { checkDriverExists(); - return driver.createTraitSpeciesCatch(bean); + return driver.getBenthosBatch(id); } @Override - public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) { + public BenthosBatch createBenthosBatch(BenthosBatch bean) { checkDriverExists(); - return driver.saveTraitSpeciesCatch(bean); + return driver.createBenthosBatch(bean); } + @Override + public BenthosBatch saveBenthosBatch(BenthosBatch bean) { + checkDriverExists(); + return driver.saveBenthosBatch(bean); + } + + //------------------------------------------------------------------------// + //-- Plancton Batch methods --// + //------------------------------------------------------------------------// + + @Override + public List<PlanctonBatch> getAllPlanctonBatch(String traitId) { + checkDriverExists(); + return driver.getAllPlanctonBatch(traitId); + } + + @Override + public PlanctonBatch getPlanctonBatch(String id) { + checkDriverExists(); + return driver.getPlanctonBatch(id); + } + + @Override + public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) { + checkDriverExists(); + return driver.createPlanctonBatch(bean); + } + + @Override + public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) { + checkDriverExists(); + return driver.savePlanctonBatch(bean); + } + + //------------------------------------------------------------------------// + //-- Macrodechet Batch methods --// + //------------------------------------------------------------------------// + + @Override + public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) { + checkDriverExists(); + return driver.getAllMacroDechetBatch(traitId); + } + + @Override + public MacroDechetBatch getMacroDechetBatch(String id) { + checkDriverExists(); + return driver.getMacroDechetBatch(id); + } + + @Override + public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) { + checkDriverExists(); + return driver.createMacroDechetBatch(bean); + } + + @Override + public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) { + checkDriverExists(); + return driver.saveMacroDechetBatch(bean); + } + + //------------------------------------------------------------------------// + //-- Accidentel Batch methods --// + //------------------------------------------------------------------------// + + @Override + public List<AccidentelBatch> getAllAccidentelBatch(String traitId) { + checkDriverExists(); + return driver.getAllAccidentelBatch(traitId); + } + + @Override + public AccidentelBatch getAccidentelBatch(String id) { + checkDriverExists(); + return driver.getAccidentelBatch(id); + } + + @Override + public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) { + checkDriverExists(); + return driver.createAccidentelBatch(bean); + } + + @Override + public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) { + checkDriverExists(); + return driver.saveAccidentelBatch(bean); + } + + //------------------------------------------------------------------------// + //-- Internal methods --// + //------------------------------------------------------------------------// + protected void checkDriverExists() { Preconditions.checkNotNull( driver, Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties =================================================================== --- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-06 17:03:05 UTC (rev 30) @@ -3,20 +3,29 @@ tutti.config.data.directory=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp). tutti.config.license.organizationName=Nom de l'organisation dans la licence tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application) +tutti.property.beaufortScale= tutti.property.beaufortScaleBean=Vent beaufort +tutti.property.campaign= tutti.property.campaignBean=Campagne tutti.property.codeMemo=Code Memo +tutti.property.country= tutti.property.countryBean=Pays tutti.property.date=Date +tutti.property.gear= tutti.property.gearBean=Engin tutti.property.genusSpecies=Nom scientifique tutti.property.name=Nom +tutti.property.seaState= tutti.property.seaStateBean=État de la mer tutti.property.stationNumber=Numéro de station -tutti.property.strataBean=Strate d'association +tutti.property.strata=Strate d'association +tutti.property.survey= tutti.property.surveyBean=Série de campagne -tutti.property.traitBean=Trait +tutti.property.trait=Trait +tutti.property.user= tutti.property.userBean=Utilisateur +tutti.property.vessel= tutti.property.vesselBean=Navire +tutti.property.zone= tutti.property.zoneBean=Zone tutti.service.config=Configuration des services de Tutti Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,7 +24,9 @@ * #L% */ +import fr.ifremer.tutti.service.TuttiServiceTechnicalException; import org.jdesktop.beans.AbstractSerializableBean; +import org.nuiton.util.beans.Binder; /** * Abstract UI model to edit a bean. @@ -32,11 +34,10 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public abstract class AbstractTuttiBeanUIModel extends AbstractSerializableBean { +public abstract class AbstractTuttiBeanUIModel<E, B extends AbstractTuttiBeanUIModel<E, B>> extends AbstractSerializableBean { private static final long serialVersionUID = 1L; - public static final String PROPERTY_ID = "id"; public static final String PROPERTY_MODIFY = "modify"; @@ -49,6 +50,41 @@ protected boolean valid; + private final Class<E> entityType; + + private final Binder<E, B> fromBeanBinder; + + private final Binder<B, E> toBeanBinder; + + protected AbstractTuttiBeanUIModel(Class<E> entityType, + Binder<E, B> fromBeanBinder, + Binder<B, E> toBeanBinder) { + this.entityType = entityType; + this.fromBeanBinder = fromBeanBinder; + this.toBeanBinder = toBeanBinder; + } + + public final void fromBean(E bean) { + fromBeanBinder.copy(bean, (B) this); + } + + public final E toBean() { + E result = newEntity(); + toBeanBinder.copy((B) this, result); + return result; + } + + protected E newEntity() { + try { + E result = entityType.newInstance(); + return result; + } catch (Exception e) { + throw new TuttiServiceTechnicalException( + "Could not instanciate entity of type " + + entityType.getName(), e); + } + } + public String getId() { return id; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,11 +24,11 @@ * #L% */ -import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; +import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.ui.swing.config.TuttiConfig; import jaxx.runtime.swing.OneClicListSelectionModel; @@ -37,7 +37,6 @@ import jaxx.runtime.swing.editor.bean.BeanComboBox; import jaxx.runtime.swing.editor.bean.BeanListHeader; import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; -import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXDatePicker; @@ -50,7 +49,6 @@ import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; -import javax.swing.table.TableCellRenderer; import javax.swing.text.JTextComponent; import java.awt.event.ItemEvent; import java.awt.event.KeyEvent; @@ -58,7 +56,6 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -148,7 +145,7 @@ * * @param comboBox le component graphique à initialiser */ - protected <E extends AbstractTuttiBean> void initBeanComboBox( + protected <E extends AbstractTuttiEntity> void initBeanComboBox( BeanComboBox<E> comboBox, List<E> data, E selectedData) { @@ -181,7 +178,7 @@ * * @param listHeader le component graphique à initialiser */ - protected <E extends AbstractTuttiBean> void initBeanList( + protected <E extends AbstractTuttiEntity> void initBeanList( BeanListHeader<E> listHeader, List<E> data, List<E> selectedData) { @@ -233,26 +230,19 @@ picker.getEditor().setEditable(false); } - protected <B extends AbstractTuttiBean> void updateIndices(JList<B> jlist, - List<B> list) { + protected <B extends AbstractTuttiEntity> void updateIndices(JList jlist, + List<B> list) { - List<String> ids = list == null ? - Collections.<String>emptyList() : - Lists.transform(list, new Function<B, String>() { - @Override - public String apply(B input) { - return input.getId(); - } - }); + List<String> ids = TuttiEntities.toIds(list); List<Integer> indices = new ArrayList<Integer>(); if (list != null && !list.isEmpty()) { - ListModel<B> model = jlist.getModel(); + ListModel model = jlist.getModel(); for (int i = 0, max = model.getSize(); i < max; i++) { - B s = model.getElementAt(i); + B s = (B) model.getElementAt(i); if (ids.contains(s.getId())) { indices.add(i); } @@ -300,27 +290,6 @@ return result; } - protected <O> TableCellRenderer newTableCellRender(Class<O> type) { - - return newTableCellRender(type, null); - } - - protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) { - - Decorator<O> decorator = getDecorator(type, name); - - TableCellRenderer result = newTableCellRender(decorator); - return result; - } - - protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) { - - Preconditions.checkNotNull(decorator); - - DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator); - return result; - } - protected void listenValidatorValid(SimpleBeanValidator validator, final AbstractTuttiBeanUIModel model) { validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.config.TuttiServiceConfigOption; import fr.ifremer.tutti.ui.swing.config.TuttiConfig; @@ -442,7 +442,7 @@ // selected survey - SurveyBean survey = persistenceService.getSurvey(surveyId); + Survey survey = persistenceService.getSurvey(surveyId); title = _("tutti.title.selectedSurvey", survey.getName()) + " / "; @@ -458,7 +458,7 @@ } else { // selected campaign - CampaignBean campaign; + Campaign campaign; campaign = persistenceService.getCampaign(campaignId); title += _("tutti.title.selectedCampaign", campaign.getName()); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-06 17:03:05 UTC (rev 30) @@ -26,8 +26,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Sets; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.TuttiService; import fr.ifremer.tutti.service.TuttiServiceContext; @@ -203,7 +203,7 @@ if (surveyId != null) { - SurveyBean survey = persistenceService.getSurvey(surveyId); + Survey survey = persistenceService.getSurvey(surveyId); if (survey == null) { // not found in this db @@ -224,7 +224,7 @@ // test campaignId if (campaignId != null) { - CampaignBean campaign = + Campaign campaign = persistenceService.getCampaign(campaignId); if (campaign != null && Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-06 17:03:05 UTC (rev 30) @@ -95,7 +95,7 @@ #vesselHeader { labelText:{_("tutti.label.list.vessel")}; list:{vesselList}; - beanType:{VesselBean.class}; + beanType:{Vessel.class}; } #gearPane { @@ -106,7 +106,7 @@ #gearHeader { labelText:{_("tutti.label.list.gear")}; list:{gearList}; - beanType:{GearBean.class}; + beanType:{Gear.class}; } #headOfMissionPane { @@ -117,7 +117,7 @@ #headOfMissionHeader { labelText:{_("tutti.label.list.headOfMission")}; list:{headOfMissionList}; - beanType:{UserBean.class}; + beanType:{TuttiUser.class}; } #headOfSortRoomPane { @@ -128,7 +128,7 @@ #headOfSortRoomHeader { labelText:{_("tutti.label.list.headOfSortRoom")}; list:{headOfSortRoomList}; - beanType:{UserBean.class}; + beanType:{TuttiUser.class}; } #commentPane { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,11 +25,11 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIModel, EditCampaignUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.referential.CountryBean - fr.ifremer.tutti.persistence.entities.referential.GearBean - fr.ifremer.tutti.persistence.entities.SurveyBean - fr.ifremer.tutti.persistence.entities.referential.UserBean - fr.ifremer.tutti.persistence.entities.referential.VesselBean + fr.ifremer.tutti.persistence.entities.data.Survey + fr.ifremer.tutti.persistence.entities.referential.Country + fr.ifremer.tutti.persistence.entities.referential.Gear + fr.ifremer.tutti.persistence.entities.referential.TuttiUser + fr.ifremer.tutti.persistence.entities.referential.Vessel fr.ifremer.tutti.ui.swing.TuttiUIContext jaxx.runtime.swing.editor.bean.BeanComboBox @@ -91,7 +91,7 @@ </cell> <cell weightx='1.0'> <BeanComboBox id='surveyComboBox' constructorParams='this' - genericType='SurveyBean'/> + genericType='Survey'/> </cell> </row> @@ -102,7 +102,7 @@ </cell> <cell> <BeanComboBox id='countryComboBox' constructorParams='this' - genericType='CountryBean'/> + genericType='Country'/> </cell> </row> @@ -136,13 +136,13 @@ onFocusGained='vesselList.requestFocus()'> <JList id='vesselList' onValueChanged='handler.selectListData(event, "vessel")'/> - <BeanListHeader id='vesselHeader' genericType='VesselBean'/> + <BeanListHeader id='vesselHeader' genericType='Vessel'/> </JScrollPane> <JScrollPane id='gearPane' columnHeaderView="{gearHeader}" onFocusGained='gearList.requestFocus()'> <JList id='gearList' onValueChanged='handler.selectListData(event, "gear")'/> - <BeanListHeader id='gearHeader' genericType='GearBean'/> + <BeanListHeader id='gearHeader' genericType='Gear'/> </JScrollPane> </JPanel> </cell> @@ -159,7 +159,7 @@ <JList id='headOfMissionList' onValueChanged='handler.selectListData(event, "headOfMission")'/> <BeanListHeader id='headOfMissionHeader' - genericType='UserBean'/> + genericType='TuttiUser'/> </JScrollPane> <JScrollPane id='headOfSortRoomPane' columnHeaderView="{headOfSortRoomHeader}" @@ -167,7 +167,7 @@ <JList id='headOfSortRoomList' onValueChanged='handler.selectListData(event, "headOfSortRoom")'/> <BeanListHeader id='headOfSortRoomHeader' - genericType='UserBean'/> + genericType='TuttiUser'/> </JScrollPane> </JPanel> </cell> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,10 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiScreen; @@ -63,13 +63,13 @@ String campaignId = context.getCampaignId(); if (campaignId == null) { - SurveyBean survey = + Survey survey = persistenceService.getSurvey(context.getSurveyId()); model.setSurvey(survey); } else { // load existing survey - CampaignBean campaign = persistenceService.getCampaign(campaignId); + Campaign campaign = persistenceService.getCampaign(campaignId); model.fromBean(campaign); } @@ -80,24 +80,24 @@ @Override public void afterInitUI() { - List<UserBean> users = persistenceService.getAllUsers(); + List<TuttiUser> users = persistenceService.getAllTuttiUser(); EditCampaignUIModel model = ui.getModel(); initBeanComboBox(ui.getSurveyComboBox(), - persistenceService.getAllSurveys(), + persistenceService.getAllSurvey(), model.getSurvey()); initBeanComboBox(ui.getCountryComboBox(), - persistenceService.getAllCountries(), + persistenceService.getAllCountry(), model.getCountry()); initBeanList(ui.getVesselHeader(), - persistenceService.getAllVessels(), + persistenceService.getAllVessel(), model.getVessel()); initBeanList(ui.getGearHeader(), - persistenceService.getAllGears(), + persistenceService.getAllGear(), model.getGear()); initBeanList(ui.getHeadOfMissionHeader(), @@ -135,10 +135,10 @@ EditCampaignUIModel model = ui.getModel(); - CampaignBean bean = model.toBean(); + Campaign bean = model.toBean(); - CampaignBean saved; - if (TuttiBeans.isNew(bean)) { + Campaign saved; + if (TuttiEntities.isNew(bean)) { saved = persistenceService.createCampaign(bean); } else { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,13 +24,14 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.referential.CountryBean; -import fr.ifremer.tutti.persistence.entities.referential.GearBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; -import fr.ifremer.tutti.persistence.entities.referential.VesselBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; +import fr.ifremer.tutti.persistence.entities.referential.Vessel; import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; import java.util.List; @@ -41,48 +42,65 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1O */ -public class EditCampaignUIModel extends AbstractTuttiBeanUIModel { +public class EditCampaignUIModel extends AbstractTuttiBeanUIModel<Campaign, EditCampaignUIModel> { private static final long serialVersionUID = 1L; - protected SurveyBean survey; + public static final String PROPERTY_SURVEY = "survey"; - protected CountryBean country; + public static final String PROPERTY_NAME = "name"; + public static final String PROPERTY_COMMENT = "comment"; + + public static final String PROPERTY_COUNTRY = "country"; + + public static final String PROPERTY_SURVEY_PART = "surveyPart"; + + public static final String PROPERTY_VESSEL = "vessel"; + + public static final String PROPERTY_GEAR = "gear"; + + public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission"; + + public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom"; + + protected Survey survey; + + protected Country country; + protected String name; protected String surveyPart; - protected List<VesselBean> vessel; + protected List<Vessel> vessel; - protected List<GearBean> gear; + protected List<Gear> gear; - protected List<UserBean> headOfMission; + protected List<TuttiUser> headOfMission; - protected List<UserBean> headOfSortRoom; + protected List<TuttiUser> headOfSortRoom; protected String comment; -// protected boolean create; -// -// public boolean isCreate() { -// return create; -// } -// -// public void setCreate(boolean create) { -// Object oldValue = isCreate(); -// this.create = create; -// firePropertyChange("create", oldValue, create); -// } + protected static Binder<EditCampaignUIModel, Campaign> toBeanBinder = + BinderFactory.newBinder(EditCampaignUIModel.class, + Campaign.class); - public SurveyBean getSurvey() { + protected static Binder<Campaign, EditCampaignUIModel> fromBeanBinder = + BinderFactory.newBinder(Campaign.class, EditCampaignUIModel.class); + + public EditCampaignUIModel() { + super(Campaign.class, fromBeanBinder, toBeanBinder); + } + + public Survey getSurvey() { return survey; } - public void setSurvey(SurveyBean survey) { + public void setSurvey(Survey survey) { Object oldValue = getSurvey(); this.survey = survey; - firePropertyChange("survey", oldValue, survey); + firePropertyChange(PROPERTY_SURVEY, oldValue, survey); } public String getName() { @@ -92,7 +110,7 @@ public void setName(String name) { Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); + firePropertyChange(PROPERTY_NAME, oldValue, name); } public String getComment() { @@ -102,17 +120,17 @@ public void setComment(String comment) { Object oldValue = getComment(); this.comment = comment; - firePropertyChange("comment", oldValue, comment); + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); } - public CountryBean getCountry() { + public Country getCountry() { return country; } - public void setCountry(CountryBean country) { + public void setCountry(Country country) { Object oldValue = getCountry(); this.country = country; - firePropertyChange("country", oldValue, country); + firePropertyChange(PROPERTY_COUNTRY, oldValue, country); } public String getSurveyPart() { @@ -122,54 +140,43 @@ public void setSurveyPart(String surveyPart) { Object oldValue = getSurveyPart(); this.surveyPart = surveyPart; - firePropertyChange("surveyPart", oldValue, surveyPart); + firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart); } - public List<VesselBean> getVessel() { + public List<Vessel> getVessel() { return vessel; } - public void setVessel(List<VesselBean> vessel) { + public void setVessel(List<Vessel> vessel) { this.vessel = vessel; - firePropertyChange("vessel", null, vessel); + firePropertyChange(PROPERTY_VESSEL, null, vessel); } - public List<GearBean> getGear() { + public List<Gear> getGear() { return gear; } - public void setGear(List<GearBean> gear) { + public void setGear(List<Gear> gear) { this.gear = gear; - firePropertyChange("gear", null, gear); + firePropertyChange(PROPERTY_GEAR, null, gear); } - public List<UserBean> getHeadOfMission() { + public List<TuttiUser> getHeadOfMission() { return headOfMission; } - public void setHeadOfMission(List<UserBean> headOfMission) { + public void setHeadOfMission(List<TuttiUser> headOfMission) { this.headOfMission = headOfMission; - firePropertyChange("headOfMission", null, headOfMission); + firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission); } - public List<UserBean> getHeadOfSortRoom() { + public List<TuttiUser> getHeadOfSortRoom() { return headOfSortRoom; } - public void setHeadOfSortRoom(List<UserBean> headOfSortRoom) { + public void setHeadOfSortRoom(List<TuttiUser> headOfSortRoom) { this.headOfSortRoom = headOfSortRoom; - firePropertyChange("headOfSortRoom", null, headOfSortRoom); + firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom); } - public void fromBean(CampaignBean bean) { - BinderFactory.newBinder(CampaignBean.class, - EditCampaignUIModel.class).copy(bean, this); - } - - public CampaignBean toBean() { - CampaignBean result = new CampaignBean(); - BinderFactory.newBinder(EditCampaignUIModel.class, - CampaignBean.class).copy(this, result); - return result; - } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIModel, EditSurveyUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.referential.ZoneBean + fr.ifremer.tutti.persistence.entities.referential.Zone fr.ifremer.tutti.ui.swing.TuttiUIContext jaxx.runtime.swing.editor.bean.BeanComboBox @@ -89,7 +89,7 @@ </cell> <cell> <BeanComboBox id='zoneComboBox' constructorParams='this' - genericType='ZoneBean'/> + genericType='Zone'/> </cell> </row> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiScreen; @@ -73,7 +73,7 @@ log.info("Edit existing survey " + surveyId); } // load existing survey - SurveyBean survey = persistenceService.getSurvey(surveyId); + Survey survey = persistenceService.getSurvey(surveyId); model.fromBean(survey); } @@ -88,7 +88,7 @@ EditSurveyUIModel model = ui.getModel(); initBeanComboBox(ui.getZoneComboBox(), - persistenceService.getAllZones(), + persistenceService.getAllZone(), model.getZone()); SwingValidatorUtil.installUI(ui.getErrorTable(), @@ -118,10 +118,10 @@ EditSurveyUIModel model = ui.getModel(); - SurveyBean bean = model.toBean(); + Survey bean = model.toBean(); - SurveyBean saved; - if (TuttiBeans.isNew(bean)) { + Survey saved; + if (TuttiEntities.isNew(bean)) { saved = persistenceService.createSurvey(bean); } else { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,9 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.referential.ZoneBean; +import fr.ifremer.tutti.persistence.entities.data.Survey; +import fr.ifremer.tutti.persistence.entities.referential.Zone; import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; /** @@ -35,28 +36,34 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class EditSurveyUIModel extends AbstractTuttiBeanUIModel { +public class EditSurveyUIModel extends AbstractTuttiBeanUIModel<Survey, EditSurveyUIModel> { private static final long serialVersionUID = 1L; + public static final String PROPERTY_ZONE = "zone"; + + public static final String PROPERTY_COMMENT = "comment"; + + public static final String PROPERTY_NAME = "name"; + protected String name; protected String comment; - protected ZoneBean zone; + protected Zone zone; -// protected boolean create; -// -// public boolean isCreate() { -// return create; -// } -// -// public void setCreate(boolean create) { -// Object oldValue = isCreate(); -// this.create = create; -// firePropertyChange("create", oldValue, create); -// } + protected static Binder<EditSurveyUIModel, Survey> toBeanBinder = + BinderFactory.newBinder(EditSurveyUIModel.class, + Survey.class); + protected static Binder<Survey, EditSurveyUIModel> fromBeanBinder = + BinderFactory.newBinder(Survey.class, EditSurveyUIModel.class); + + + public EditSurveyUIModel() { + super(Survey.class, fromBeanBinder, toBeanBinder); + } + public String getName() { return name; } @@ -64,7 +71,7 @@ public void setName(String name) { Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); + firePropertyChange(PROPERTY_NAME, oldValue, name); } public String getComment() { @@ -74,28 +81,17 @@ public void setComment(String comment) { Object oldValue = getComment(); this.comment = comment; - firePropertyChange("comment", oldValue, comment); + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); } - public ZoneBean getZone() { + public Zone getZone() { return zone; } - public void setZone(ZoneBean zone) { + public void setZone(Zone zone) { Object oldValue = getZone(); this.zone = zone; - firePropertyChange("zone", oldValue, zone); + firePropertyChange(PROPERTY_ZONE, oldValue, zone); } - public void fromBean(SurveyBean bean) { - BinderFactory.newBinder(SurveyBean.class, - EditSurveyUIModel.class).copy(bean, this); - } - - public SurveyBean toBean() { - SurveyBean result = new SurveyBean(); - BinderFactory.newBinder(EditSurveyUIModel.class, - SurveyBean.class).copy(this, result); - return result; - } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,9 +25,9 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCampaignUIModel, SelectCampaignUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.SurveyBean - fr.ifremer.tutti.persistence.entities.CampaignBean - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Survey + fr.ifremer.tutti.persistence.entities.data.Campaign + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext jaxx.runtime.swing.editor.bean.BeanComboBox @@ -64,7 +64,7 @@ </cell> <cell weightx='1.0'> <BeanComboBox id='surveyCombobox' constructorParams='this' - genericType='SurveyBean'/> + genericType='Survey'/> </cell> <cell> <JPanel layout='{new GridLayout(1,0)}'> @@ -81,7 +81,7 @@ </cell> <cell> <BeanComboBox id='campaignCombobox' constructorParams='this' - genericType='CampaignBean'/> + genericType='Campaign'/> </cell> <cell> <JPanel layout='{new GridLayout(1,0)}'> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,9 +25,9 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiScreen; @@ -72,7 +72,7 @@ public void beforeInitUI() { SelectCampaignUIModel model = new SelectCampaignUIModel(); - List<SurveyBean> allSurveys = persistenceService.getAllSurveys(); + List<Survey> allSurveys = persistenceService.getAllSurvey(); model.setSurveys(allSurveys); @@ -84,11 +84,11 @@ // get selected survey (if any) String surveyId = context.getSurveyId(); - SurveyBean selectedSurvey = null; - List<CampaignBean> allCampaigns = null; + Survey selectedSurvey = null; + List<Campaign> allCampaigns = null; if (surveyId != null) { - selectedSurvey = TuttiBeans.findById(allSurveys, surveyId); - allCampaigns = persistenceService.getAllCampaigns(surveyId); + selectedSurvey = TuttiEntities.findById(allSurveys, surveyId); + allCampaigns = persistenceService.getAllCampaign(surveyId); } model.setSurvey(selectedSurvey); @@ -100,10 +100,10 @@ } else { String campaignId = context.getCampaignId(); - CampaignBean selectedCampaign = null; + Campaign selectedCampaign = null; if (campaignId != null) { selectedCampaign = - TuttiBeans.findById(allCampaigns, campaignId); + TuttiEntities.findById(allCampaigns, campaignId); } model.setCampaign(selectedCampaign); } @@ -127,14 +127,14 @@ model.addPropertyChangeListener("survey", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - SurveyBean newValue = (SurveyBean) evt.getNewValue(); + Survey newValue = (Survey) evt.getNewValue(); boolean noSurvey = newValue == null; context.setSurveyId(noSurvey ? null : newValue.getId()); - List<CampaignBean> campaigns; + List<Campaign> campaigns; if (noSurvey) { campaigns = Lists.newArrayList(); } else { - campaigns = persistenceService.getAllCampaigns(newValue.getId()); + campaigns = persistenceService.getAllCampaign(newValue.getId()); } SelectCampaignUIModel model = (SelectCampaignUIModel) evt.getSource(); model.setCampaigns(campaigns); @@ -146,8 +146,8 @@ @Override public void propertyChange(PropertyChangeEvent evt) { // reload combo box - BeanComboBox<CampaignBean> combobox = ui.getCampaignCombobox(); - List<CampaignBean> campaigns = (List<CampaignBean>) evt.getNewValue(); + BeanComboBox<Campaign> combobox = ui.getCampaignCombobox(); + List<Campaign> campaigns = (List<Campaign>) evt.getNewValue(); combobox.setData(null); combobox.setData(campaigns); } @@ -156,7 +156,7 @@ model.addPropertyChangeListener("campaign", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - CampaignBean newValue = (CampaignBean) evt.getNewValue(); + Campaign newValue = (Campaign) evt.getNewValue(); context.setCampaignId(newValue == null ? null : newValue.getId()); } }); @@ -177,7 +177,7 @@ public void showSelectedSurvey() { - SurveyBean survey = getModel().getSurvey(); + Survey survey = getModel().getSurvey(); context.setSurveyId(survey.getId()); context.setScreen(TuttiScreen.EDIT_SURVEY); } @@ -189,7 +189,7 @@ } public void showSelectedCampaign() { - CampaignBean campaign = getModel().getCampaign(); + Campaign campaign = getModel().getCampaign(); context.setCampaignId(campaign.getId()); context.setScreen(TuttiScreen.EDIT_CAMPAIGN); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Survey; import org.jdesktop.beans.AbstractSerializableBean; import java.util.List; @@ -52,19 +52,19 @@ public static final String PROPERTY_CAMPAIGN_FOUND = "campaignFound"; - protected List<SurveyBean> surveys; + protected List<Survey> surveys; - protected SurveyBean survey; + protected Survey survey; - protected List<CampaignBean> campaigns; + protected List<Campaign> campaigns; - protected CampaignBean campaign; + protected Campaign campaign; - public List<SurveyBean> getSurveys() { + public List<Survey> getSurveys() { return surveys; } - public void setSurveys(List<SurveyBean> surveys) { + public void setSurveys(List<Survey> surveys) { Object oldValue = getSurveys(); this.surveys = surveys; @@ -73,12 +73,12 @@ firePropertyChange(PROPERTY_SURVEYS, oldValue, surveys); } - public SurveyBean getSurvey() { + public Survey getSurvey() { return survey; } - public void setSurvey(SurveyBean survey) { - SurveyBean oldValue = getSurvey(); + public void setSurvey(Survey survey) { + Survey oldValue = getSurvey(); this.survey = survey; // nullify campaigns @@ -92,11 +92,11 @@ return survey != null; } - public List<CampaignBean> getCampaigns() { + public List<Campaign> getCampaigns() { return campaigns; } - public void setCampaigns(List<CampaignBean> campaigns) { + public void setCampaigns(List<Campaign> campaigns) { Object oldValue = getCampaigns(); this.campaigns = campaigns; @@ -105,12 +105,12 @@ firePropertyChange(PROPERTY_CAMPAIGNS, oldValue, campaigns); } - public CampaignBean getCampaign() { + public Campaign getCampaign() { return campaign; } - public void setCampaign(CampaignBean campaign) { - CampaignBean oldValue = getCampaign(); + public void setCampaign(Campaign campaign) { + Campaign oldValue = getCampaign(); this.campaign = campaign; firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign); firePropertyChange(PROPERTY_CAMPAIGN_FOUND, oldValue != null, campaign != null); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<CatchesUIModel, CatchesUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI @@ -63,7 +63,7 @@ <row> <cell anchor='west' weightx='1.0'> <BeanComboBox id='traitComboBox' constructorParams='this' - genericType='TraitBean'/> + genericType='Trait'/> </cell> <cell anchor='east'> <JButton id='newTraitButton' Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,9 +24,9 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiUIContext; @@ -67,10 +67,10 @@ String campaignId = context.getCampaignId(); // load existing campaign - CampaignBean campaign = persistenceService.getCampaign(campaignId); + Campaign campaign = persistenceService.getCampaign(campaignId); model.setCampaign(campaign); - List<TraitBean> traits = persistenceService.getAllTraits(campaignId); + List<Trait> traits = persistenceService.getAllTrait(campaignId); model.setTrait(traits); if (log.isInfoEnabled()) { @@ -87,7 +87,7 @@ initUI(ui); - List<TraitBean> traits = model.getTrait(); + List<Trait> traits = model.getTrait(); initBeanComboBox(ui.getTraitComboBox(), traits, @@ -96,7 +96,7 @@ model.addPropertyChangeListener(CatchesUIModel.PROPERTY_SELECTED_TRAIT, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - selectTrait((TraitBean) evt.getNewValue()); + selectTrait((Trait) evt.getNewValue()); } }); @@ -104,7 +104,7 @@ @Override public void propertyChange(PropertyChangeEvent evt) { ui.getTraitComboBox().setData(null); - ui.getTraitComboBox().setData((List<TraitBean>) evt.getNewValue()); + ui.getTraitComboBox().setData((List<Trait>) evt.getNewValue()); } }); @@ -136,13 +136,13 @@ ui.getModel().setSelectedTrait(null); // use a new empty trait - TraitBean newTrait = new TraitBean(); + Trait newTrait = new Trait(); newTrait.setCampaign(ui.getModel().getCampaign()); newTrait.setDate(new Date()); selectTrait(newTrait); } - public void selectTrait(TraitBean selectedTrait) { + public void selectTrait(Trait selectedTrait) { if (log.isInfoEnabled()) { log.info("New selected trait: " + selectedTrait); @@ -166,13 +166,13 @@ // ui.getObservationIndividuelTabContent().selectTrait(selectedTrait); } - public void saveTrait(TraitBean toSave) { + public void saveTrait(Trait toSave) { // persist the trait boolean create = toSave.getId() == null; - TraitBean savedTrait; + Trait savedTrait; if (create) { savedTrait = persistenceService.createTrait(toSave); } else { @@ -183,9 +183,9 @@ // add the saved trait to trait list - List<TraitBean> data = model.getTrait(); + List<Trait> data = model.getTrait(); - TraitBean existingTrait = TuttiBeans.findById(data, savedTrait.getId()); + Trait existingTrait = TuttiEntities.findById(data, savedTrait.getId()); if (existingTrait != null) { data.remove(existingTrait); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Trait; import org.jdesktop.beans.AbstractSerializableBean; import java.util.List; @@ -46,36 +46,36 @@ public static final String PROPERTY_CAMPAIGN = "campaign"; - protected List<TraitBean> trait; + protected List<Trait> trait; - protected TraitBean selectedTrait; + protected Trait selectedTrait; - protected CampaignBean campaign; + protected Campaign campaign; - public List<TraitBean> getTrait() { + public List<Trait> getTrait() { return trait; } - public void setTrait(List<TraitBean> trait) { + public void setTrait(List<Trait> trait) { this.trait = trait; firePropertyChange(PROPERTY_TRAIT, null, trait); } - public TraitBean getSelectedTrait() { + public Trait getSelectedTrait() { return selectedTrait; } - public void setSelectedTrait(TraitBean selectedTrait) { + public void setSelectedTrait(Trait selectedTrait) { Object oldValue = getSelectedTrait(); this.selectedTrait = selectedTrait; firePropertyChange(PROPERTY_SELECTED_TRAIT, oldValue, selectedTrait); } - public CampaignBean getCampaign() { + public Campaign getCampaign() { return campaign; } - public void setCampaign(CampaignBean campaign) { + public void setCampaign(Campaign campaign) { Object oldValue = getCampaign(); this.campaign = campaign; firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-06 17:03:05 UTC (rev 30) @@ -250,7 +250,7 @@ #saisisseurHeader { labelText:{_("tutti.label.list.saisisseur")}; list:{saisisseurList}; - beanType:{UserBean.class}; + beanType:{TuttiUser.class}; } #commentPane { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,11 +25,11 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<TraitTabUIModel, TraitTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean - fr.ifremer.tutti.persistence.entities.referential.SeaStateBean - fr.ifremer.tutti.persistence.entities.StrataBean - fr.ifremer.tutti.persistence.entities.TraitBean - fr.ifremer.tutti.persistence.entities.referential.UserBean + fr.ifremer.tutti.persistence.entities.referential.BeaufortScale + fr.ifremer.tutti.persistence.entities.referential.SeaState + fr.ifremer.tutti.persistence.entities.data.Strata + fr.ifremer.tutti.persistence.entities.data.Trait + fr.ifremer.tutti.persistence.entities.referential.TuttiUser fr.ifremer.tutti.ui.swing.TuttiUIContext jaxx.runtime.swing.editor.bean.BeanComboBox @@ -58,7 +58,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> @@ -129,7 +129,7 @@ </cell> <cell fill='horizontal'> <BeanComboBox id='strataComboBox' constructorParams='this' - genericType='StrataBean'/> + genericType='Strata'/> </cell> </row> @@ -140,7 +140,7 @@ </cell> <cell fill='horizontal'> <BeanComboBox id='beaufortScaleComboBox' constructorParams='this' - genericType='BeaufortScaleBean'/> + genericType='BeaufortScale'/> </cell> </row> @@ -161,7 +161,7 @@ </cell> <cell fill='horizontal'> <BeanComboBox id='seaStateComboBox' constructorParams='this' - genericType='SeaStateBean'/> + genericType='SeaState'/> </cell> </row> @@ -294,9 +294,9 @@ <JScrollPane id='saisisseurPane' columnHeaderView="{saisisseurHeader}" onFocusGained='saisisseurList.requestFocus()'> - <JList id='saisisseurList' genericType='UserBean' + <JList id='saisisseurList' onValueChanged='handler.selectListData(event, "saisisseur")'/> - <BeanListHeader id='saisisseurHeader' genericType='UserBean'/> + <BeanListHeader id='saisisseurHeader' genericType='TuttiUser'/> </JScrollPane> </cell> </row> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import org.apache.commons.collections.CollectionUtils; @@ -101,19 +101,19 @@ initUI(ui); initBeanList(ui.getSaisisseurHeader(), - persistenceService.getAllUsers(), + persistenceService.getAllTuttiUser(), model.getSaisisseur()); initBeanComboBox(ui.getBeaufortScaleComboBox(), - persistenceService.getAllBeaufortScales(), + persistenceService.getAllBeaufortScale(), model.getBeaufortScale()); initBeanComboBox(ui.getStrataComboBox(), - persistenceService.getAllStratas(), + persistenceService.getAllStrata(), model.getStrata()); initBeanComboBox(ui.getSeaStateComboBox(), - persistenceService.getAllSeaStates(), + persistenceService.getAllSeaState(), model.getSeaState()); model.setEmpty(true); @@ -130,7 +130,7 @@ return ui.getModel(); } - public void selectTrait(TraitBean bean) { + public void selectTrait(Trait bean) { boolean empty = bean == null; @@ -141,14 +141,14 @@ if (empty) { - model.fromBean(new TraitBean()); + model.fromBean(new Trait()); } else { model.fromBean(bean); } // update saisissuer selection - List<UserBean> saisisseur = model.getSaisisseur(); + List<TuttiUser> saisisseur = model.getSaisisseur(); if (CollectionUtils.isNotEmpty(saisisseur)) { updateIndices(ui.getSaisisseurList(), saisisseur); } @@ -180,7 +180,7 @@ } else { // reselect in ui the trait - TraitBean selectedTrait = parentUi.getModel().getSelectedTrait(); + Trait selectedTrait = parentUi.getModel().getSelectedTrait(); parentUi.getHandler().selectTrait(selectedTrait); } } @@ -188,7 +188,7 @@ public void save() { // get trait to save - TraitBean toSave = ui.getModel().toBean(); + Trait toSave = ui.getModel().toBean(); if (log.isInfoEnabled()) { log.info("Save edition for trait: " + toSave.getId()); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,13 +24,14 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.StrataBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean; -import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean; -import fr.ifremer.tutti.persistence.entities.referential.UserBean; +import fr.ifremer.tutti.persistence.entities.data.Campaign; +import fr.ifremer.tutti.persistence.entities.data.Strata; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.TuttiUser; import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; import java.util.Date; @@ -42,7 +43,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class TraitTabUIModel extends AbstractTuttiBeanUIModel { +public class TraitTabUIModel extends AbstractTuttiBeanUIModel<Trait, TraitTabUIModel> { private static final long serialVersionUID = 1L; @@ -126,7 +127,7 @@ protected boolean empty; - protected CampaignBean campaign; + protected Campaign campaign; protected Integer stationNumber; @@ -134,7 +135,7 @@ protected Date date; - protected StrataBean strata; + protected Strata strata; protected Float gearShootingStartLatitude; @@ -152,11 +153,11 @@ protected Float gearShootingEndDepth; - protected BeaufortScaleBean beaufortScale; + protected BeaufortScale beaufortScale; protected Integer windDirection; - protected SeaStateBean seaState; + protected SeaState seaState; protected Float ouvertureHorizontale; @@ -182,7 +183,7 @@ protected String comment; - protected List<UserBean> saisisseur; + protected List<TuttiUser> saisisseur; protected Float gearShootingStartSurfaceTemperature; @@ -204,6 +205,17 @@ protected Float averageBottomSalinity; + protected static Binder<TraitTabUIModel, Trait> toBeanBinder = + BinderFactory.newBinder(TraitTabUIModel.class, + Trait.class); + + protected static Binder<Trait, TraitTabUIModel> fromBeanBinder = + BinderFactory.newBinder(Trait.class, TraitTabUIModel.class); + + public TraitTabUIModel() { + super(Trait.class, fromBeanBinder, toBeanBinder); + } + public boolean isEmpty() { return empty; } @@ -214,11 +226,11 @@ firePropertyChange(PROPERTY_EMPTY, oldValue, empty); } - public CampaignBean getCampaign() { + public Campaign getCampaign() { return campaign; } - public void setCampaign(CampaignBean campaign) { + public void setCampaign(Campaign campaign) { this.campaign = campaign; } @@ -252,11 +264,11 @@ firePropertyChange(PROPERTY_DATE, oldValue, date); } - public StrataBean getStrata() { + public Strata getStrata() { return strata; } - public void setStrata(StrataBean strata) { + public void setStrata(Strata strata) { Object oldValue = getStrata(); this.strata = strata; firePropertyChange(PROPERTY_STRATA, oldValue, strata); @@ -342,11 +354,11 @@ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth); } - public BeaufortScaleBean getBeaufortScale() { + public BeaufortScale getBeaufortScale() { return beaufortScale; } - public void setBeaufortScale(BeaufortScaleBean beaufortScale) { + public void setBeaufortScale(BeaufortScale beaufortScale) { Object oldValue = getBeaufortScale(); this.beaufortScale = beaufortScale; firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale); @@ -362,11 +374,11 @@ firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection); } - public SeaStateBean getSeaState() { + public SeaState getSeaState() { return seaState; } - public void setSeaState(SeaStateBean seaState) { + public void setSeaState(SeaState seaState) { Object oldValue = getSeaState(); this.seaState = seaState; firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState); @@ -492,11 +504,11 @@ firePropertyChange(PROPERTY_COMMENT, oldValue, comment); } - public List<UserBean> getSaisisseur() { + public List<TuttiUser> getSaisisseur() { return saisisseur; } - public void setSaisisseur(List<UserBean> saisisseur) { + public void setSaisisseur(List<TuttiUser> saisisseur) { this.saisisseur = saisisseur; firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur); } @@ -600,16 +612,4 @@ this.averageBottomSalinity = averageBottomSalinity; firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity); } - - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, - TraitTabUIModel.class).copy(bean, this); - } - - public TraitBean toBean() { - TraitBean result = new TraitBean(); - BinderFactory.newBinder(TraitTabUIModel.class, - TraitBean.class).copy(this, result); - return result; - } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.CatchesUI @@ -49,7 +49,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,10 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; +import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI; @@ -91,10 +91,10 @@ col = new TableColumn(0); JComboBox speciesEditor = new JComboBox(); - List<SpeciesBean> allSpecies = persistenceService.getAllSpecies(); + List<Species> allSpecies = persistenceService.getAllSpecies(); SwingUtil.fillComboBox(speciesEditor, allSpecies, null); // col.setCellEditor(); - col.setCellRenderer(newTableCellRender(SpeciesBean.class)); +// col.setCellRenderer(newTableCellRender(Species.class)); col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode")); // col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true)); col.setIdentifier("speciesByCode"); @@ -126,7 +126,7 @@ model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue()); + tableModel.setData((List<SpeciesBatch>) evt.getNewValue()); } }); @@ -148,19 +148,19 @@ return ui.getModel(); } - public void selectTrait(TraitBean bean) { + public void selectTrait(Trait bean) { boolean empty = bean == null; AccidentelTabUIModel model = ui.getModel(); - List<TraitCaptureAccidentelCatchBean> catches; + List<AccidentelBatch> catches; if (empty) { catches = null; - bean = new TraitBean(); + bean = new Trait(); } else { - catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId()); + catches = persistenceService.getAllAccidentelBatch(bean.getId()); } model.fromBean(bean); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean; +import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.util.beans.BinderFactory; @@ -49,7 +49,7 @@ protected Float sampleTotalWeight; - protected List<TraitCaptureAccidentelCatchBean> catches; + protected List<AccidentelBatch> catches; public Float getTotalWeight() { return totalWeight; @@ -71,25 +71,25 @@ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight); } - public List<TraitCaptureAccidentelCatchBean> getCatches() { + public List<AccidentelBatch> getCatches() { return catches; } - public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) { + public void setCatches(List<AccidentelBatch> catches) { Object oldValue = getCatches(); this.catches = catches; firePropertyChange(PROPERTY_CATCHES, oldValue, catches); } - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, + public void fromBean(Trait bean) { + BinderFactory.newBinder(Trait.class, AccidentelTabUIModel.class).copy(bean, this); } - public TraitBean toBean() { - TraitBean result = new TraitBean(); + public Trait toBean() { + Trait result = new Trait(); BinderFactory.newBinder(AccidentelTabUIModel.class, - TraitBean.class).copy(this, result); + Trait.class).copy(this, result); return result; } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L; - protected List<TraitSpeciesCatchBean> data; + protected List<SpeciesBatch> data; protected final TableColumnModel columnModel; @@ -47,10 +47,10 @@ this.columnModel = columnModel; } - public void setData(List<TraitSpeciesCatchBean> data) { + public void setData(List<SpeciesBatch> data) { if (data == null) { data = Lists.newArrayList(); - data.add(new TraitSpeciesCatchBean()); + data.add(new SpeciesBatch()); } this.data = data; fireTableDataChanged(); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.CatchesUI @@ -49,7 +49,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,10 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI; @@ -91,10 +91,10 @@ col = new TableColumn(0); JComboBox speciesEditor = new JComboBox(); - List<SpeciesBean> allSpecies = persistenceService.getAllSpecies(); + List<Species> allSpecies = persistenceService.getAllSpecies(); SwingUtil.fillComboBox(speciesEditor, allSpecies, null); // col.setCellEditor(); - col.setCellRenderer(newTableCellRender(SpeciesBean.class)); +// col.setCellRenderer(newTableCellRender(Species.class)); col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode")); // col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true)); col.setIdentifier("speciesByCode"); @@ -126,7 +126,7 @@ model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue()); + tableModel.setData((List<SpeciesBatch>) evt.getNewValue()); } }); @@ -148,19 +148,19 @@ return ui.getModel(); } - public void selectTrait(TraitBean bean) { + public void selectTrait(Trait bean) { boolean empty = bean == null; BenthosTabUIModel model = ui.getModel(); - List<TraitBenthosCatchBean> catches; + List<BenthosBatch> catches; if (empty) { catches = null; - bean = new TraitBean(); + bean = new Trait(); } else { - catches = persistenceService.getAllTraitBenthosCatch(bean.getId()); + catches = persistenceService.getAllBenthosBatch(bean.getId()); } model.fromBean(bean); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.util.beans.BinderFactory; @@ -49,7 +49,7 @@ protected Float sampleTotalWeight; - protected List<TraitBenthosCatchBean> catches; + protected List<BenthosBatch> catches; public Float getTotalWeight() { return totalWeight; @@ -71,25 +71,25 @@ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight); } - public List<TraitBenthosCatchBean> getCatches() { + public List<BenthosBatch> getCatches() { return catches; } - public void setCatches(List<TraitBenthosCatchBean> catches) { + public void setCatches(List<BenthosBatch> catches) { Object oldValue = getCatches(); this.catches = catches; firePropertyChange(PROPERTY_CATCHES, oldValue, catches); } - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, + public void fromBean(Trait bean) { + BinderFactory.newBinder(Trait.class, BenthosTabUIModel.class).copy(bean, this); } - public TraitBean toBean() { - TraitBean result = new TraitBean(); + public Trait toBean() { + Trait result = new Trait(); BinderFactory.newBinder(BenthosTabUIModel.class, - TraitBean.class).copy(this, result); + Trait.class).copy(this, result); return result; } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L; - protected List<TraitSpeciesCatchBean> data; + protected List<SpeciesBatch> data; protected final TableColumnModel columnModel; @@ -47,10 +47,10 @@ this.columnModel = columnModel; } - public void setData(List<TraitSpeciesCatchBean> data) { + public void setData(List<SpeciesBatch> data) { if (data == null) { data = Lists.newArrayList(); - data.add(new TraitSpeciesCatchBean()); + data.add(new SpeciesBatch()); } this.data = data; fireTableDataChanged(); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.CatchesUI @@ -49,7 +49,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,10 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI; @@ -91,10 +91,10 @@ col = new TableColumn(0); JComboBox speciesEditor = new JComboBox(); - List<SpeciesBean> allSpecies = persistenceService.getAllSpecies(); + List<Species> allSpecies = persistenceService.getAllSpecies(); SwingUtil.fillComboBox(speciesEditor, allSpecies, null); // col.setCellEditor(); - col.setCellRenderer(newTableCellRender(SpeciesBean.class)); +// col.setCellRenderer(newTableCellRender(Species.class)); col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode")); // col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true)); col.setIdentifier("speciesByCode"); @@ -126,7 +126,7 @@ model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue()); + tableModel.setData((List<SpeciesBatch>) evt.getNewValue()); } }); @@ -148,19 +148,19 @@ return ui.getModel(); } - public void selectTrait(TraitBean bean) { + public void selectTrait(Trait bean) { boolean empty = bean == null; MacroDechetTabUIModel model = ui.getModel(); - List<TraitMacroDechetCatchBean> catches; + List<MacroDechetBatch> catches; if (empty) { catches = null; - bean = new TraitBean(); + bean = new Trait(); } else { - catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId()); + catches = persistenceService.getAllMacroDechetBatch(bean.getId()); } model.fromBean(bean); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean; +import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.util.beans.BinderFactory; @@ -49,7 +49,7 @@ protected Float sampleTotalWeight; - protected List<TraitMacroDechetCatchBean> catches; + protected List<MacroDechetBatch> catches; public Float getTotalWeight() { return totalWeight; @@ -71,25 +71,25 @@ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight); } - public List<TraitMacroDechetCatchBean> getCatches() { + public List<MacroDechetBatch> getCatches() { return catches; } - public void setCatches(List<TraitMacroDechetCatchBean> catches) { + public void setCatches(List<MacroDechetBatch> catches) { Object oldValue = getCatches(); this.catches = catches; firePropertyChange(PROPERTY_CATCHES, oldValue, catches); } - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, + public void fromBean(Trait bean) { + BinderFactory.newBinder(Trait.class, MacroDechetTabUIModel.class).copy(bean, this); } - public TraitBean toBean() { - TraitBean result = new TraitBean(); + public Trait toBean() { + Trait result = new Trait(); BinderFactory.newBinder(MacroDechetTabUIModel.class, - TraitBean.class).copy(this, result); + Trait.class).copy(this, result); return result; } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L; - protected List<TraitSpeciesCatchBean> data; + protected List<SpeciesBatch> data; protected final TableColumnModel columnModel; @@ -47,10 +47,10 @@ this.columnModel = columnModel; } - public void setData(List<TraitSpeciesCatchBean> data) { + public void setData(List<SpeciesBatch> data) { if (data == null) { data = Lists.newArrayList(); - data.add(new TraitSpeciesCatchBean()); + data.add(new SpeciesBatch()); } this.data = data; fireTableDataChanged(); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.CatchesUI @@ -49,7 +49,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,10 +24,10 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI; @@ -91,10 +91,10 @@ col = new TableColumn(0); JComboBox speciesEditor = new JComboBox(); - List<SpeciesBean> allSpecies = persistenceService.getAllSpecies(); + List<Species> allSpecies = persistenceService.getAllSpecies(); SwingUtil.fillComboBox(speciesEditor, allSpecies, null); // col.setCellEditor(); - col.setCellRenderer(newTableCellRender(SpeciesBean.class)); +// col.setCellRenderer(newTableCellRender(Species.class)); col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode")); // col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true)); col.setIdentifier("speciesByCode"); @@ -126,7 +126,7 @@ model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { - tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue()); + tableModel.setData((List<SpeciesBatch>) evt.getNewValue()); } }); @@ -148,19 +148,19 @@ return ui.getModel(); } - public void selectTrait(TraitBean bean) { + public void selectTrait(Trait bean) { boolean empty = bean == null; PlanctonTabUIModel model = ui.getModel(); - List<TraitPlanctonCatchBean> catches; + List<PlanctonBatch> catches; if (empty) { catches = null; - bean = new TraitBean(); + bean = new Trait(); } else { - catches = persistenceService.getAllTraitPlanctonCatch(bean.getId()); + catches = persistenceService.getAllPlanctonBatch(bean.getId()); } model.fromBean(bean); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,8 +24,8 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean; +import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; +import fr.ifremer.tutti.persistence.entities.data.Trait; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.util.beans.BinderFactory; @@ -49,7 +49,7 @@ protected Float sampleTotalWeight; - protected List<TraitPlanctonCatchBean> catches; + protected List<PlanctonBatch> catches; public Float getTotalWeight() { return totalWeight; @@ -71,25 +71,25 @@ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight); } - public List<TraitPlanctonCatchBean> getCatches() { + public List<PlanctonBatch> getCatches() { return catches; } - public void setCatches(List<TraitPlanctonCatchBean> catches) { + public void setCatches(List<PlanctonBatch> catches) { Object oldValue = getCatches(); this.catches = catches; firePropertyChange(PROPERTY_CATCHES, oldValue, catches); } - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, + public void fromBean(Trait bean) { + BinderFactory.newBinder(Trait.class, PlanctonTabUIModel.class).copy(bean, this); } - public TraitBean toBean() { - TraitBean result = new TraitBean(); + public Trait toBean() { + Trait result = new Trait(); BinderFactory.newBinder(PlanctonTabUIModel.class, - TraitBean.class).copy(this, result); + Trait.class).copy(this, result); return result; } } \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L; - protected List<TraitSpeciesCatchBean> data; + protected List<SpeciesBatch> data; protected final TableColumnModel columnModel; @@ -47,10 +47,10 @@ this.columnModel = columnModel; } - public void setData(List<TraitSpeciesCatchBean> data) { + public void setData(List<SpeciesBatch> data) { if (data == null) { data = Lists.newArrayList(); - data.add(new TraitSpeciesCatchBean()); + data.add(new SpeciesBatch()); } this.data = data; fireTableDataChanged(); Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,99 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.AbstractAction; -import javax.swing.JTable; - -/** - * Abstract action to select something in a table. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public abstract class AbstractSelectTableAction extends AbstractAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(AbstractSelectTableAction.class); - - private final JTable table; - - private final SpeciesTabUIModel model; - - public AbstractSelectTableAction(SpeciesTabUIModel model, - JTable table) { - this.model = model; - this.table = table; - } - - protected void doSelectCell(int rowIndex, int columnIndex) { - - if (log.isDebugEnabled()) { - log.debug("Will select cell at " + - getCellCoordinate(rowIndex, columnIndex)); - } - - table.editCellAt(rowIndex, columnIndex); - table.setColumnSelectionInterval(columnIndex, columnIndex); - table.setRowSelectionInterval(rowIndex, rowIndex); - } - - - protected int getSelectedRow() { - int result = table.getSelectedRow(); - return result; - } - - protected int getSelectedColumn() { - int result = table.getSelectedColumn(); - return result; - } - - protected int getRowCount() { - return table.getRowCount(); - } - - protected int getColumnCount() { - return table.getColumnCount(); - } - - protected boolean isCellEditable(int rowIndex, int columnIndex) { - return table.isCellEditable(rowIndex, columnIndex); - } - - protected String getCellCoordinate(int rowIndex, int columnIndex) { - return " [" + rowIndex + ", " + columnIndex + "]"; - } - - protected SpeciesTabUIModel getModel() { - return model; - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,104 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.ui.swing.TuttiUIUtil; - -import java.io.Serializable; -import java.util.List; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class CatchTreeModel implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * Root node (with no sampling on it. - * - * @since 0.2 - */ - protected final CatchTreeNode root; - - /** - * Property which are used to sub sampling. - * - * @since 0.2 - */ - protected final String[] samplingOrder; - - /** - * Samplings view as a linear list (to display in the table). - * - * @since 0.2 - */ - protected final List<CatchTreeNode> lines; - - public CatchTreeModel(String... samplingOrder) { - this.samplingOrder = samplingOrder; - root = new CatchTreeNode(); - lines = Lists.newArrayList(); - } - - public CatchTreeNode getNode(int rowIndex) { - return lines.get(rowIndex); - } - - public int getSize() { - return lines.size(); - } - - public void populate(List<TraitSpeciesCatchBean> data) { - - // clear tree representation - root.removeAllChildren(); - - // clear linear representation - lines.clear(); - } - - public Object[] getSamplingKey(TraitSpeciesCatchBean bean) { - List<Object> result = Lists.newArrayList(); - for (String s : samplingOrder) { - Object property = TuttiUIUtil.getProperty(bean, s); - if (property == null) { - // stop findind sample key - break; - } - result.add(property); - } - return result.toArray(); - } - - public String[] getSamplingDefinition(TraitSpeciesCatchBean bean) { - return null; - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,152 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; - -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; -import java.io.Serializable; - -/** - * Defines a node of a species catches. - * <p/> - * UserObject is the {@link TraitSpeciesCatchBean}. It can be null on two cases: - * <ul> - * <li>On root node</li> - * <li>For node on a path of sampling but with no filled data </li> - * </ul> - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class CatchTreeNode extends DefaultMutableTreeNode { - - private static final long serialVersionUID = 1L; - - /** - * Property name defining the sampling. - * <p/> - * <strong>Note:</strong> can be null (only for root node). - * - * @since 0.2 - */ - protected final String samplingPropertyKey; - - /** - * Property value defining the sampling. - * <p/> - * <strong>Note:</strong> can be null (only for root node). - * - * @since 0.2 - */ - protected final Serializable samplingPropertyValue; - - public CatchTreeNode() { - this(null, null, null); - } - - public CatchTreeNode(TraitSpeciesCatchBean userObject, - String samplingPropertyKey, - Serializable samplingPropertyValue) { - this.samplingPropertyKey = samplingPropertyKey; - this.samplingPropertyValue = samplingPropertyValue; - setUserObject(userObject); - } - - public String getSamplingPropertyKey() { - return samplingPropertyKey; - } - - public Serializable getSamplingPropertyValue() { - return samplingPropertyValue; - } - - @Override - public TraitSpeciesCatchBean getUserObject() { - return (TraitSpeciesCatchBean) super.getUserObject(); - } - - @Override - public CatchTreeNode getParent() { - return (CatchTreeNode) super.getParent(); - } - - @Override - public CatchTreeNode getRoot() { - return (CatchTreeNode) super.getRoot(); - } - - @Override - public CatchTreeNode getFirstChild() { - return (CatchTreeNode) super.getFirstChild(); - } - - @Override - public CatchTreeNode getLastChild() { - return (CatchTreeNode) super.getLastChild(); - } - - @Override - public CatchTreeNode getChildAfter(TreeNode aChild) { - return (CatchTreeNode) super.getChildAfter(aChild); - } - - @Override - public CatchTreeNode getChildBefore(TreeNode aChild) { - return (CatchTreeNode) super.getChildBefore(aChild); - } - - @Override - public CatchTreeNode getNextSibling() { - return (CatchTreeNode) super.getNextSibling(); - } - - @Override - public CatchTreeNode getPreviousSibling() { - return (CatchTreeNode) super.getPreviousSibling(); - } - - @Override - public CatchTreeNode getFirstLeaf() { - return (CatchTreeNode) super.getFirstLeaf(); - } - - @Override - public CatchTreeNode getLastLeaf() { - return (CatchTreeNode) super.getLastLeaf(); - } - - @Override - public CatchTreeNode getNextLeaf() { - return (CatchTreeNode) super.getNextLeaf(); - } - - @Override - public CatchTreeNode getPreviousLeaf() { - return (CatchTreeNode) super.getPreviousLeaf(); - } - -} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,219 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.base.Preconditions; +import jaxx.runtime.SwingUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.AbstractCellEditor; +import javax.swing.JButton; +import javax.swing.JTable; +import javax.swing.border.LineBorder; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Component to render and edit frequency stuff from batch table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class FrequencyCellComponent extends JButton { + + private static final long serialVersionUID = 1L; + + public static final String ROW_INDEX = "rowIndex"; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FrequencyCellComponent.class); + + public FrequencyCellComponent() { + setContentAreaFilled(false); + setOpaque(false); + setIcon(SwingUtil.createActionIcon("show-frequency")); + } + + public static TableCellRenderer newRender() { + return new FrequencyCellRenderer(); + } + + public static TableCellEditor newEditor() { + return new FrequencyCellEditor(); + } + + public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor { + + private static final long serialVersionUID = 1L; + + protected final FrequencyCellComponent component; + + protected SpeciesBatchTableModel tableModel; + + protected SpeciesBatchColumnIdentifier columnIdentifier; + + protected SpeciesBatchRowModel editRow; + + protected Integer rowIndex; + + public FrequencyCellEditor() { + component = new FrequencyCellComponent(); + component.setBorder(new LineBorder(Color.BLACK)); + component.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER || + e.getKeyCode() == KeyEvent.VK_SPACE) { + e.consume(); + startEdit(); + } + } + }); + + component.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + e.consume(); + startEdit(); + } + }); + } + + protected void startEdit() { + + Preconditions.checkNotNull(tableModel, "No table model assigned."); + + // open frequency dialog + + Preconditions.checkNotNull(editRow, + "No editRow found."); + + if (log.isInfoEnabled()) { + log.info("Will edit frequencies for row: " + rowIndex); + } + } + + @Override + public Component getTableCellEditorComponent(JTable table, + Object value, + boolean isSelected, + int row, + int column) { + if (tableModel == null) { + tableModel = (SpeciesBatchTableModel) table.getModel(); + + columnIdentifier = tableModel.getPropertyName(column); + } + String text; + if (value == null) { + text = " - "; + } else { + text = String.valueOf(value); + } + component.setText(text); + + rowIndex = row; + + editRow = tableModel.getEntry(row); + + return component; + } + + @Override + public Object getCellEditorValue() { + + Preconditions.checkNotNull(editRow, "No editRow found in editor."); + + // update from computed frequencies + editRow.updateTotalFromFrequencies(); + + Object result; + if (columnIdentifier == SpeciesBatchColumnIdentifier.computedNumber) { + result = editRow.getComputedNumber(); + } else { + result = editRow.getComputedWeight(); + } + if (log.isInfoEnabled()) { + log.info("editor value (" + columnIdentifier + "): " + result); + } + + return result; + } + + @Override + public boolean stopCellEditing() { + boolean b = super.stopCellEditing(); + if (b) { + rowIndex = null; + editRow = null; + } + return b; + } + + @Override + public void cancelCellEditing() { + super.cancelCellEditing(); + rowIndex = null; + editRow = null; + } + } + + public static class FrequencyCellRenderer implements TableCellRenderer { + + protected final FrequencyCellComponent component; + + public FrequencyCellRenderer() { + component = new FrequencyCellComponent(); + } + + @Override + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + + String text; + if (value == null) { + text = " - "; + } else { + text = String.valueOf(value); + } + boolean editable = table.isCellEditable(row, column); + component.setEnabled(editable); + component.setText(text); + return component; + } + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,98 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTable; -import java.awt.event.ActionEvent; - -/** - * Action to select next editable cell in a table. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class MoveToNextEditableCellAction extends AbstractSelectTableAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(MoveToNextEditableCellAction.class); - - public MoveToNextEditableCellAction(SpeciesTabUIModel model, - JTable table) { - super(model, table); - } - - @Override - public void actionPerformed(ActionEvent e) { - - int currentRow = getSelectedRow(); - int currentColumn = getSelectedColumn(); - - if (log.isDebugEnabled()) { - log.debug("Move to previous editable cell " + - getCellCoordinate(currentRow, currentColumn)); - } - - int columnCount = getColumnCount(); - - int rowCount = getRowCount(); - - while (currentRow <= rowCount || currentColumn <= columnCount) { - - // go to next cell - currentColumn++; - - // select next cell - if (currentColumn >= columnCount) { - - // no more cell, so will move to next editable column on next row - currentColumn = 0; - currentRow++; - - if (currentRow == rowCount) { - // create a new row in model - getModel().addNewCatch(); - } - } - - if (isCellEditable(currentRow, currentColumn)) { - - doSelectCell(currentRow, currentColumn); - - break; - } else { - if (log.isDebugEnabled()) { - log.debug("Cell not editable at " + - getCellCoordinate(currentRow, currentColumn)); - } - } - } - } -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,82 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTable; -import java.awt.event.ActionEvent; - -/** - * Action to select next editable row in a table. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class MoveToNextEditableRowAction extends AbstractSelectTableAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(MoveToNextEditableRowAction.class); - - public MoveToNextEditableRowAction(SpeciesTabUIModel model, - JTable table) { - super(model, table); - } - - @Override - public void actionPerformed(ActionEvent e) { - int currentRow = getSelectedRow(); - int currentColumn = getSelectedColumn(); - - if (isCellEditable(currentRow, currentColumn)) { - if (log.isDebugEnabled()) { - log.debug("Move to next row editable cell " + - getCellCoordinate(currentRow, currentColumn)); - } - currentRow++; - - if (currentRow >= getRowCount()) { - if (log.isDebugEnabled()) { - log.debug("No next row"); - } - - // create a new row in model - getModel().addNewCatch(); - } - - doSelectCell(currentRow, currentColumn); - - } else { - if (log.isDebugEnabled()) { - log.debug("Cell not editable at " + - getCellCoordinate(currentRow, currentColumn)); - } - } - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,87 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTable; -import java.awt.event.ActionEvent; - -/** - * Action to select previous editable cell in a table. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class MoveToPreviousEditableCellAction extends AbstractSelectTableAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(MoveToPreviousEditableCellAction.class); - - public MoveToPreviousEditableCellAction(SpeciesTabUIModel model, - JTable table) { - super(model,table); - } - - @Override - public void actionPerformed(ActionEvent e) { - int currentRow = getSelectedRow(); - int currentColumn = getSelectedColumn(); - - if (log.isDebugEnabled()) { - log.debug("Move to previous editable cell, " + - getCellCoordinate(currentRow, currentColumn)); - } - - int columnCount = getColumnCount(); - - while (currentRow > 0 || currentColumn > 0) { - - // go to next cell - currentColumn--; - - // select next cell - if (currentColumn < 0) { - - currentColumn = columnCount - 1; - currentRow--; - } - - if (isCellEditable(currentRow, currentColumn)) { - doSelectCell(currentRow, currentColumn); - break; - } else { - if (log.isDebugEnabled()) { - log.debug("Cell not editable at " + - getCellCoordinate(currentRow, currentColumn)); - } - } - } - } -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,79 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTable; -import java.awt.event.ActionEvent; - -/** - * Action to select previous editable row in a table. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class MoveToPreviousEditableRowAction extends AbstractSelectTableAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(MoveToPreviousEditableRowAction.class); - - public MoveToPreviousEditableRowAction(SpeciesTabUIModel model, - JTable table) { - super(model,table); - } - - @Override - public void actionPerformed(ActionEvent e) { - - int currentRow = getSelectedRow(); - int currentColumn = getSelectedColumn(); - - if (isCellEditable(currentRow, currentColumn)) { - if (log.isDebugEnabled()) { - log.debug("Move to previous row editable cell " + - getCellCoordinate(currentRow, currentColumn)); - } - currentRow--; - - if (currentRow < 0) { - if (log.isDebugEnabled()) { - log.debug("No previous row"); - } - } else { - doSelectCell(currentRow, currentColumn); - } - } else { - if (log.isDebugEnabled()) { - log.debug("Cell not editable at " + - getCellCoordinate(currentRow, currentColumn)); - } - } - } -} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,132 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.ui.swing.TuttiUIUtil; +import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier; + +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public enum SpeciesBatchColumnIdentifier implements AbstractColumnIdentifier<SpeciesBatchRowModel> { + + speciesToConfirm( + n_("tutti.table.species.batch.header.toConfirm"), + n_("tutti.table.species.batch.header.toConfirm")), + speciesByCode( + "species", + n_("tutti.table.species.batch.header.speciesByCode"), + n_("tutti.table.species.batch.header.speciesByCode")), + speciesByGenusCode( + "species", + n_("tutti.table.species.batch.header.speciesByGenusCode"), + n_("tutti.table.species.batch.header.speciesByGenusCode")), + vracHorsVrac( + n_("tutti.table.species.batch.header.vracHorsVrac"), + n_("tutti.table.species.batch.header.vracHorsVrac")), + weightCategory( + n_("tutti.table.species.batch.header.weightCategory"), + n_("tutti.table.species.batch.header.weightCategory")), + sex( + n_("tutti.table.species.batch.header.sex"), + n_("tutti.table.species.batch.header.sex")), + maturity( + n_("tutti.table.species.batch.header.maturity"), + n_("tutti.table.species.batch.header.maturity")), + age( + n_("tutti.table.species.batch.header.age"), + n_("tutti.table.species.batch.header.age")), + weight( + n_("tutti.table.species.batch.header.weight"), + n_("tutti.table.species.batch.header.weight")), + computedWeight( + n_("tutti.table.species.batch.header.computedWeight"), + n_("tutti.table.species.batch.header.computedWeight")), + computedNumber( + n_("tutti.table.species.batch.header.computedNumber"), + n_("tutti.table.species.batch.header.computedNumber")), + sampleWeight( + n_("tutti.table.species.batch.header.sampleWeight"), + n_("tutti.table.species.batch.header.sampleWeight")), + elevationRatio( + n_("tutti.table.species.batch.header.elevationRate"), + n_("tutti.table.species.batch.header.elevationRate")), + comment( + n_("tutti.table.species.batch.header.comment"), + n_("tutti.table.species.batch.header.comment")), + file( + null, + n_("tutti.table.species.batch.header.file"), + n_("tutti.table.species.batch.header.file")); + + private final String propertyName; + + private final String headerI18nKey; + + private final String headerTipI18nKey; + + SpeciesBatchColumnIdentifier(String headerI18nKey, String headerTipI18nKey) { + this("", headerI18nKey, headerTipI18nKey); + } + + SpeciesBatchColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) { + this.propertyName = "".equals(propertyName) ? name() : propertyName; + this.headerI18nKey = headerI18nKey; + this.headerTipI18nKey = headerTipI18nKey; + } + + @Override + public String getPropertyName() { + return propertyName; + } + + @Override + public String getHeaderI18nKey() { + return headerI18nKey; + } + + @Override + public String getHeaderTipI18nKey() { + return headerTipI18nKey; + } + + @Override + public Object getValue(SpeciesBatchRowModel entry) { + Object result = null; + if (propertyName != null && entry != null) { + result = TuttiUIUtil.getProperty(entry, propertyName); + } + return result; + } + + @Override + public void setValue(SpeciesBatchRowModel entry, Object value) { + if (propertyName != null) + TuttiUIUtil.setProperty(entry, propertyName, value); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,371 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel; +import org.apache.commons.collections.CollectionUtils; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import java.util.List; + +/** + * Represents a species batch (i.e a row in the batch table). + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_SPECIES = "species"; + + public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm"; + + public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac"; + + public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory"; + + public static final String PROPERTY_SEX = "sex"; + + public static final String PROPERTY_MATURITY = "maturity"; + + public static final String PROPERTY_AGE = "age"; + + public static final String PROPERTY_WEIGHT = "weight"; + + public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight"; + + public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio"; + + public static final String PROPERTY_COMMENT = "comment"; + + public static final String PROPERTY_FREQUENCY = "frequency"; + + public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber"; + + public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight"; + + /** + * Species observed. + * + * @since 0.2 + */ + protected Species species; + + /** + * Is the species need to be confirmed?. + * + * @since 0.2 + */ + protected boolean speciesToConfirm; + + /** + * Is catch is vrac or horsVrac?. + * + * @since 0.2 + */ + protected VracHorsVracEnum vracHorsVrac; + + /** + * Weight category (can be null). + * + * @since 0.2 + */ + protected WeightCategory weightCategory; + + /** + * Sex (can be null). + * + * @since 0.2 + */ + protected Sex sex; + + /** + * Maturity (can be null). + * + * @since 0.2 + */ + protected Float maturity; + + /** + * Age (can be null). + * + * @since 0.2 + */ + protected Float age; + + /** + * Observed weight. + * + * @since 0.2 + */ + protected Float weight; + + /** + * Total computed weight (from frequencies). + * + * @since 0.2 + */ + protected Float computedWeight; + + /** + * Total computed number (from frequencies). + * + * @since 0.2 + */ + protected Float computedNumber; + + /** + * Sample weight. + * + * @since 0.2 + */ + protected Float sampleWeight; + + /** + * Elevation ratio. + * + * @since 0.2 + */ + protected Float elevationRatio; + + /** + * Comment on this catches. + * + * @since 0.2 + */ + protected String comment; + + /** + * List of frequencies observed for this batch. + * + * @since 0.2 + */ + protected List<SpeciesFrequencyRowModel> frequency; + + protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder = + BinderFactory.newBinder(SpeciesBatch.class, + SpeciesBatchRowModel.class); + + protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder = + BinderFactory.newBinder(SpeciesBatchRowModel.class, + SpeciesBatch.class); + + public SpeciesBatchRowModel() { + super(SpeciesBatch.class, fromBeanBinder, toBeanBinder); + frequency = Lists.newArrayList(); + } + + public SpeciesBatchRowModel(SpeciesBatch aBatch, + List<SpeciesBatchFrequency> frequencies) { + this(); + fromBean(aBatch); + + for (SpeciesBatchFrequency frequencyBean : frequencies) { + SpeciesFrequencyRowModel f = new SpeciesFrequencyRowModel(); + f.fromBean(frequencyBean); + frequency.add(f); + } + updateTotalFromFrequencies(); + } + + public void updateTotalFromFrequencies() { + Float totalNumber = null; + Float totalWeight = null; + if (CollectionUtils.isNotEmpty(frequency)) { + totalNumber = 0f; + totalWeight = 0f; + for (SpeciesFrequencyRowModel frequencyModel : frequency) { + totalNumber += frequencyModel.getNumber(); + totalWeight += frequencyModel.getComputedWeight(); + } + } + + setComputedNumber(totalNumber); + setComputedWeight(totalWeight); + } + + public Species getSpecies() { + return species; + } + + public void setSpecies(Species species) { + Object oldValue = getSpecies(); + this.species = species; + firePropertyChange(PROPERTY_SPECIES, oldValue, species); + } + + public Boolean getSpeciesToConfirm() { + return speciesToConfirm; + } + + public void setSpeciesToConfirm(Boolean speciesToConfirm) { + Object oldValue = getSpeciesToConfirm(); + this.speciesToConfirm = speciesToConfirm; + firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm); + } + + public VracHorsVracEnum getVracHorsVrac() { + return vracHorsVrac; + } + + public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { + Object oldValue = getVracHorsVrac(); + this.vracHorsVrac = vracHorsVrac; + firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac); + } + + public WeightCategory getWeightCategory() { + return weightCategory; + } + + public void setWeightCategory(WeightCategory weightCategory) { + Object oldValue = getWeightCategory(); + this.weightCategory = weightCategory; + firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory); + } + + public Sex getSex() { + return sex; + } + + public void setSex(Sex sex) { + Object oldValue = getSex(); + this.sex = sex; + firePropertyChange(PROPERTY_SEX, oldValue, sex); + } + + public Float getMaturity() { + return maturity; + } + + public void setMaturity(Float maturity) { + Object oldValue = getMaturity(); + this.maturity = maturity; + firePropertyChange(PROPERTY_MATURITY, oldValue, maturity); + } + + public Float getAge() { + return age; + } + + public void setAge(Float age) { + Object oldValue = getAge(); + this.age = age; + firePropertyChange(PROPERTY_AGE, oldValue, age); + } + + public Float getWeight() { + return weight; + } + + public void setWeight(Float weight) { + Object oldValue = getWeight(); + this.weight = weight; + firePropertyChange(PROPERTY_WEIGHT, oldValue, weight); + } + + public Float getSampleWeight() { + return sampleWeight; + } + + public void setSampleWeight(Float sampleWeight) { + Object oldValue = getSampleWeight(); + this.sampleWeight = sampleWeight; + firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight); + } + + public Float getElevationRatio() { + return elevationRatio; + } + + public void setElevationRatio(Float elevationRatio) { + Object oldValue = getElevationRatio(); + this.elevationRatio = elevationRatio; + firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio); + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = getComment(); + this.comment = comment; + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); + } + + public List<SpeciesFrequencyRowModel> getFrequency() { + return frequency; + } + + public void setFrequency(List<SpeciesFrequencyRowModel> frequency) { + Object oldValue = getFrequency(); + this.frequency = frequency; + firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency); + } + + public Float getComputedWeight() { + return computedWeight; + } + + public void setComputedWeight(Float computedWeight) { + Object oldValue = getComputedWeight(); + this.computedWeight = computedWeight; + firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, + computedWeight); + } + + public Float getComputedNumber() { + return computedNumber; + } + + public void setComputedNumber(Float computedNumber) { + Object oldValue = getComputedNumber(); + this.computedNumber = computedNumber; + firePropertyChange(PROPERTY_COMPUTED_NUMBER, oldValue, + computedNumber); + } + + //TODO Use validator + @Override + public boolean isValid() { + return species != null && weight != null; + } + + public int getRowCount() { + return frequency == null ? 0 : frequency.size(); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,110 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.Sets; +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel; + +import javax.swing.table.TableColumnModel; +import java.util.Set; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier> { + + private static final long serialVersionUID = 1L; + + protected final Set<SpeciesBatchColumnIdentifier> noneEditableColIfNoSpecies = Sets.newHashSet( + SpeciesBatchColumnIdentifier.computedNumber, + SpeciesBatchColumnIdentifier.computedWeight + ); + + public SpeciesBatchTableModel(TableColumnModel columnModel) { + super(columnModel); + + // TODO This will be dynamic by the protocol... + setNoneEditableCols( + SpeciesBatchColumnIdentifier.age, + SpeciesBatchColumnIdentifier.maturity, + SpeciesBatchColumnIdentifier.sampleWeight, + SpeciesBatchColumnIdentifier.elevationRatio, + SpeciesBatchColumnIdentifier.file + ); + } + + @Override + protected SpeciesBatchRowModel createNewRow() { + return new SpeciesBatchRowModel(); + } + + @Override + public void setValueAt(Object aValue, + int rowIndex, + int columnIndex, + SpeciesBatchColumnIdentifier propertyName, + SpeciesBatchRowModel entry) { + super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry); + + if (propertyName == SpeciesBatchColumnIdentifier.speciesByCode) { + + // update also other columns + fireTableCellUpdated(rowIndex, + SpeciesBatchColumnIdentifier.speciesByGenusCode, + SpeciesBatchColumnIdentifier.computedNumber, + SpeciesBatchColumnIdentifier.computedWeight); + + } else if (propertyName == SpeciesBatchColumnIdentifier.speciesByGenusCode) { + + // update also other columns + fireTableCellUpdated(rowIndex, + SpeciesBatchColumnIdentifier.speciesByCode, + SpeciesBatchColumnIdentifier.computedNumber, + SpeciesBatchColumnIdentifier.computedWeight); + } + } + + @Override + protected boolean isCellEditable(int rowIndex, + int columnIndex, + SpeciesBatchColumnIdentifier propertyName) { + + boolean result = super.isCellEditable(rowIndex, + columnIndex, + propertyName); + if (result) { + + if (noneEditableColIfNoSpecies.contains(propertyName)) { + + // must have filled a species to edit this column + SpeciesBatchRowModel entry = getEntry(rowIndex); + result = entry.getSpecies() != null; + } + } + return result; + } + +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,102 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.ui.swing.TuttiUIUtil; + +import java.io.Serializable; +import java.util.List; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesBatchTreeModel implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Root node (with no sampling on it. + * + * @since 0.2 + */ + protected final SpeciesBatchTreeNode root; + + /** + * Property which are used to sub sampling. + * + * @since 0.2 + */ + protected final String[] samplingOrder; + + /** + * Samplings view as a linear list (to display in the table). + * + * @since 0.2 + */ + protected final List<SpeciesBatchTreeNode> lines; + + public SpeciesBatchTreeModel(String... samplingOrder) { + this.samplingOrder = samplingOrder; + root = new SpeciesBatchTreeNode(); + lines = Lists.newArrayList(); + } + + public SpeciesBatchTreeNode getNode(int rowIndex) { + return lines.get(rowIndex); + } + + public int getSize() { + return lines.size(); + } + + public void populate(List<SpeciesBatch> data) { + + // clear tree representation + root.removeAllChildren(); + + // clear linear representation + lines.clear(); + } + + public Object[] getSamplingKey(SpeciesBatch bean) { + List<Object> result = Lists.newArrayList(); + for (String s : samplingOrder) { + Object property = TuttiUIUtil.getProperty(bean, s); + if (property == null) { + // stop findind sample key + break; + } + result.add(property); + } + return result.toArray(); + } + + public String[] getSamplingDefinition(SpeciesBatch bean) { + return null; + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,152 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import java.io.Serializable; + +/** + * Defines a node of a species catches. + * <p/> + * UserObject is the {@link SpeciesBatch}. It can be null on two cases: + * <ul> + * <li>On root node</li> + * <li>For node on a path of sampling but with no filled data </li> + * </ul> + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesBatchTreeNode extends DefaultMutableTreeNode { + + private static final long serialVersionUID = 1L; + + /** + * Property name defining the sampling. + * <p/> + * <strong>Note:</strong> can be null (only for root node). + * + * @since 0.2 + */ + protected final String samplingPropertyKey; + + /** + * Property value defining the sampling. + * <p/> + * <strong>Note:</strong> can be null (only for root node). + * + * @since 0.2 + */ + protected final Serializable samplingPropertyValue; + + public SpeciesBatchTreeNode() { + this(null, null, null); + } + + public SpeciesBatchTreeNode(SpeciesBatch userObject, + String samplingPropertyKey, + Serializable samplingPropertyValue) { + this.samplingPropertyKey = samplingPropertyKey; + this.samplingPropertyValue = samplingPropertyValue; + setUserObject(userObject); + } + + public String getSamplingPropertyKey() { + return samplingPropertyKey; + } + + public Serializable getSamplingPropertyValue() { + return samplingPropertyValue; + } + + @Override + public SpeciesBatch getUserObject() { + return (SpeciesBatch) super.getUserObject(); + } + + @Override + public SpeciesBatchTreeNode getParent() { + return (SpeciesBatchTreeNode) super.getParent(); + } + + @Override + public SpeciesBatchTreeNode getRoot() { + return (SpeciesBatchTreeNode) super.getRoot(); + } + + @Override + public SpeciesBatchTreeNode getFirstChild() { + return (SpeciesBatchTreeNode) super.getFirstChild(); + } + + @Override + public SpeciesBatchTreeNode getLastChild() { + return (SpeciesBatchTreeNode) super.getLastChild(); + } + + @Override + public SpeciesBatchTreeNode getChildAfter(TreeNode aChild) { + return (SpeciesBatchTreeNode) super.getChildAfter(aChild); + } + + @Override + public SpeciesBatchTreeNode getChildBefore(TreeNode aChild) { + return (SpeciesBatchTreeNode) super.getChildBefore(aChild); + } + + @Override + public SpeciesBatchTreeNode getNextSibling() { + return (SpeciesBatchTreeNode) super.getNextSibling(); + } + + @Override + public SpeciesBatchTreeNode getPreviousSibling() { + return (SpeciesBatchTreeNode) super.getPreviousSibling(); + } + + @Override + public SpeciesBatchTreeNode getFirstLeaf() { + return (SpeciesBatchTreeNode) super.getFirstLeaf(); + } + + @Override + public SpeciesBatchTreeNode getLastLeaf() { + return (SpeciesBatchTreeNode) super.getLastLeaf(); + } + + @Override + public SpeciesBatchTreeNode getNextLeaf() { + return (SpeciesBatchTreeNode) super.getNextLeaf(); + } + + @Override + public SpeciesBatchTreeNode getPreviousLeaf() { + return (SpeciesBatchTreeNode) super.getPreviousLeaf(); + } + +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,265 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; -import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; -import org.nuiton.util.beans.BinderFactory; - -/** - * represents a row in the table - * - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class SpeciesCatchEntryModel extends AbstractTuttiBeanUIModel { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm"; - - public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac"; - - public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory"; - - public static final String PROPERTY_SEX = "sex"; - - public static final String PROPERTY_MATURITY = "maturity"; - - public static final String PROPERTY_AGE = "age"; - - public static final String PROPERTY_WEIGHT = "weight"; - - public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight"; - - public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio"; - - public static final String PROPERTY_COMMENT = "comment"; - - /** - * Species observed. - * - * @since 0.2 - */ - protected SpeciesBean species; - - /** - * Is the species need to be confirmed?. - * - * @since 0.2 - */ - protected boolean speciesToConfirm; - - /** - * Is catch is vrac or horsVrac?. - * - * @since 0.2 - */ - protected VracHorsVracEnum vracHorsVrac; - - /** - * Weight category (can be null). - * - * @since 0.2 - */ - protected WeightCategoryBean weightCategory; - - /** - * Sex (can be null). - * - * @since 0.2 - */ - protected SexBean sex; - - /** - * Maturity (can be null). - * - * @since 0.2 - */ - protected Float maturity; - - /** - * Age (can be null). - * - * @since 0.2 - */ - protected Float age; - - /** - * Observed weight. - * - * @since 0.2 - */ - protected Float weight; - - /** - * Sample weight. - * - * @since 0.2 - */ - protected Float sampleWeight; - - /** - * Elevation ratio. - * - * @since 0.2 - */ - protected Float elevationRatio; - - /** - * Comment on this catches. - * - * @since 0.2 - */ - protected String comment; - - public SpeciesBean getSpecies() { - return species; - } - - public void setSpecies(SpeciesBean species) { - Object oldValue = getSpecies(); - this.species = species; - firePropertyChange(PROPERTY_SPECIES, oldValue, species); - } - - public Boolean getSpeciesToConfirm() { - return speciesToConfirm; - } - - public void setSpeciesToConfirm(Boolean speciesToConfirm) { - Object oldValue = getSpeciesToConfirm(); - this.speciesToConfirm = speciesToConfirm; - firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm); - } - - public VracHorsVracEnum getVracHorsVrac() { - return vracHorsVrac; - } - - public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) { - Object oldValue = getVracHorsVrac(); - this.vracHorsVrac = vracHorsVrac; - firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac); - } - - public WeightCategoryBean getWeightCategory() { - return weightCategory; - } - - public void setWeightCategory(WeightCategoryBean weightCategory) { - Object oldValue = getWeightCategory(); - this.weightCategory = weightCategory; - firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory); - } - - public SexBean getSex() { - return sex; - } - - public void setSex(SexBean sex) { - Object oldValue = getSex(); - this.sex = sex; - firePropertyChange(PROPERTY_SEX, oldValue, sex); - } - - public Float getMaturity() { - return maturity; - } - - public void setMaturity(Float maturity) { - Object oldValue = getMaturity(); - this.maturity = maturity; - firePropertyChange(PROPERTY_MATURITY, oldValue, maturity); - } - - public Float getAge() { - return age; - } - - public void setAge(Float age) { - Object oldValue = getAge(); - this.age = age; - firePropertyChange(PROPERTY_AGE, oldValue, age); - } - - public Float getWeight() { - return weight; - } - - public void setWeight(Float weight) { - Object oldValue = getWeight(); - this.weight = weight; - firePropertyChange(PROPERTY_WEIGHT, oldValue, weight); - } - - public Float getSampleWeight() { - return sampleWeight; - } - - public void setSampleWeight(Float sampleWeight) { - Object oldValue = getSampleWeight(); - this.sampleWeight = sampleWeight; - firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight); - } - - public Float getElevationRatio() { - return elevationRatio; - } - - public void setElevationRatio(Float elevationRatio) { - Object oldValue = getElevationRatio(); - this.elevationRatio = elevationRatio; - firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio); - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - Object oldValue = getComment(); - this.comment = comment; - firePropertyChange(PROPERTY_COMMENT, oldValue, comment); - } - - public void fromBean(TraitSpeciesCatchBean bean) { - BinderFactory.newBinder(TraitSpeciesCatchBean.class, - SpeciesCatchEntryModel.class).copy(bean, this); - } - - public TraitSpeciesCatchBean toBean() { - TraitSpeciesCatchBean result = new TraitSpeciesCatchBean(); - BinderFactory.newBinder(SpeciesCatchEntryModel.class, - TraitSpeciesCatchBean.class).copy(this, result); - return result; - } -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-06 17:03:05 UTC (rev 30) @@ -81,4 +81,5 @@ selectionMode:{ListSelectionModel.SINGLE_SELECTION}; selectionBackground:{null}; selectionForeground:{Color.BLACK}; + sortable:false; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -25,7 +25,7 @@ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'> <import> - fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.data.Trait fr.ifremer.tutti.ui.swing.TuttiUIContext fr.ifremer.tutti.ui.swing.content.catches.CatchesUI @@ -52,7 +52,7 @@ handler.beforeInitUI(); } -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } +public void selectTrait(Trait trait) { handler.selectTrait(trait); } protected void $afterCompleteSetup() { handler.afterInitUI(); } ]]></script> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -25,61 +25,37 @@ */ import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean; -import fr.ifremer.tutti.persistence.entities.TuttiBeans; -import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum; -import fr.ifremer.tutti.persistence.entities.referential.SexBean; -import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean; -import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean; +import fr.ifremer.tutti.persistence.entities.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum; +import fr.ifremer.tutti.persistence.entities.referential.Sex; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.persistence.entities.referential.WeightCategory; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiUI; import fr.ifremer.tutti.ui.swing.TuttiUIUtil; import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.JAXXWidgetUtil; -import jaxx.runtime.swing.editor.EnumEditor; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; -import jaxx.runtime.swing.editor.cell.NumberCellEditor; +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor; -import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; import org.jdesktop.swingx.decorator.HighlightPredicate; import org.jdesktop.swingx.table.DefaultTableColumnModelExt; -import org.jdesktop.swingx.table.TableColumnExt; import org.nuiton.util.beans.BeanMonitor; import org.nuiton.util.decorator.Decorator; -import javax.swing.JComboBox; -import javax.swing.ListSelectionModel; -import javax.swing.border.LineBorder; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import java.awt.Color; -import java.awt.Component; -import java.awt.event.FocusEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.util.List; -import static fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTableModel.ColumnIdentifier; -import static org.nuiton.i18n.I18n._; - /** * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> { +public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier, SpeciesBatchTableModel, SpeciesTabUIModel> { /** Logger. */ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class); @@ -90,27 +66,24 @@ private final PersistenceService persistenceService; - private final BeanMonitor rowMonitor; - private final BeanMonitor traitMonitor; public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) { - super(parentUi.getHandler().getContext()); + super(parentUi.getHandler().getContext(), + SpeciesBatchRowModel.PROPERTY_SPECIES, + SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM, + SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC, + SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY, + SpeciesBatchRowModel.PROPERTY_SEX, + SpeciesBatchRowModel.PROPERTY_MATURITY, + SpeciesBatchRowModel.PROPERTY_AGE, + SpeciesBatchRowModel.PROPERTY_WEIGHT, + SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT, + SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO, + SpeciesBatchRowModel.PROPERTY_COMMENT); this.ui = ui; this.parentUi = parentUi; this.persistenceService = context.getService(PersistenceService.class); - rowMonitor = new BeanMonitor( - SpeciesCatchEntryModel.PROPERTY_SPECIES, - SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM, - SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC, - SpeciesCatchEntryModel.PROPERTY_WEIGHT_CATEGORY, - SpeciesCatchEntryModel.PROPERTY_SEX, - SpeciesCatchEntryModel.PROPERTY_MATURITY, - SpeciesCatchEntryModel.PROPERTY_AGE, - SpeciesCatchEntryModel.PROPERTY_WEIGHT, - SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT, - SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO, - SpeciesCatchEntryModel.PROPERTY_COMMENT); traitMonitor = new BeanMonitor( SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT, SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT, @@ -120,6 +93,16 @@ } @Override + protected JXTable getTable() { + return ui.getTable(); + } + + @Override + protected SpeciesTabUIModel getModel() { + return ui.getModel(); + } + + @Override public void beforeInitUI() { SpeciesTabUIModel model = new SpeciesTabUIModel(); @@ -133,173 +116,109 @@ initUI(ui); - JXTable table = ui.getTable(); + JXTable table = getTable(); // create table column model TableColumnModel columnModel = createTableColumnModel(table); - SpeciesTabUIModel model = ui.getModel(); - // create table model - final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel, model); + SpeciesBatchTableModel tableModel = + new SpeciesBatchTableModel(columnModel); - // when model datas change let's propagate it - - model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_ROWS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - tableModel.refreshData((List<SpeciesCatchEntryModel>) evt.getNewValue()); - } - }); - model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_NEW_ROW, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - tableModel.addNewRow((SpeciesCatchEntryModel) evt.getNewValue()); - } - }); - - table.setModel(tableModel); table.setColumnModel(columnModel); + installTableKeyListener(columnModel, table); + table.getTableHeader().setReorderingAllowed(false); table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY)); - table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + // when model datas change let's propagate it table model + listenRowsFromModel(); - @Override - public void valueChanged(ListSelectionEvent e) { - if (!e.getValueIsAdjusting()) { - ListSelectionModel source = (ListSelectionModel) e.getSource(); - int selectedRow = source.getLeadSelectionIndex(); + // save when row chaged and was modified + listenRowModification(table); + } - // save selected entry if required - saveSelectedRowIfRequired(); - - if (log.isInfoEnabled()) { - log.info("New selected row: " + selectedRow); - } - - SpeciesCatchEntryModel entry; - - if (selectedRow == -1) { - // no selection - entry = null; - } else { - entry = tableModel.getEntry(selectedRow); - } - - if (log.isInfoEnabled()) { - log.info("Will monitor entry: " + entry); - } - rowMonitor.setBean(entry); - } - } - }); + @Override + public void onCloseUI() { } - public void saveSelectedRowIfRequired(FocusEvent event) { - Component oppositeComponent = event.getOppositeComponent(); + @Override + protected void saveRow(SpeciesBatchRowModel row) { + SpeciesBatch catchBean = row.toBean(); - JXTable parentContainer = null; - - if (oppositeComponent != null) { - - // check out if still on table - parentContainer = SwingUtil.getParentContainer( - oppositeComponent, JXTable.class); + Trait trait = getModel().getTrait(); + catchBean.setTrait(trait); + if (log.isInfoEnabled()) { + log.info("Selected trait: " + trait.getId()); } - if (parentContainer == null) { + if (TuttiEntities.isNew(catchBean)) { - // out of the table can save - saveSelectedRowIfRequired(); + catchBean = persistenceService.createSpeciesBatch(catchBean); + row.setId(catchBean.getId()); + } else { + persistenceService.saveSpeciesBatch(catchBean); } } - public void saveSelectedRowIfRequired() { + public void selectTrait(Trait bean) { - SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) rowMonitor.getBean(); - if (bean != null) { + JXTable table = ui.getTable(); - // there is a bean attached to the monitor + if (table.isEditing()) { - if (rowMonitor.wasModified()) { - - // monitored bean was modified, save it - if (log.isInfoEnabled()) { - log.info("Row " + bean + " was modified, will save it"); - } - - TraitSpeciesCatchBean catchBean = bean.toBean(); - - TraitBean trait = getModel().getTrait(); - catchBean.setTrait(trait); - if (log.isInfoEnabled()) { - log.info("Selected trait: " + trait.getId()); - } - - if (TuttiBeans.isNew(catchBean)) { - - catchBean = persistenceService.createTraitSpeciesCatch(catchBean); - bean.setId(catchBean.getId()); - } else { - persistenceService.saveTraitSpeciesCatch(catchBean); - } - - // clear modified flag on the monitor - rowMonitor.clearModified(); - } + // make sure to stop editor + table.editingCanceled(null); } - } - @Override - public void onCloseUI() { - } - - public void selectTrait(TraitBean bean) { - if (traitMonitor.wasModified()) { // previous trait was modified, let's save it SpeciesTabUIModel traitMonitorBean = (SpeciesTabUIModel) traitMonitor.getBean(); - TraitBean traitBean = traitMonitorBean.toBean(); + Trait trait = traitMonitorBean.toBean(); if (log.isInfoEnabled()) { - log.info("Trait " + traitBean.getId() + + log.info("Trait " + trait.getId() + " was modified, will save it."); } - persistenceService.saveTrait(traitBean); + persistenceService.saveTrait(trait); } // make sure selection is empty (will remove bean from monitor) - ui.getTable().clearSelection(); + table.clearSelection(); boolean empty = bean == null; SpeciesTabUIModel model = getModel(); - List<SpeciesCatchEntryModel> rows; + List<SpeciesBatchRowModel> rows; if (empty) { rows = null; - bean = new TraitBean(); + bean = new Trait(); model.setTrait(null); } else { if (log.isInfoEnabled()) { - log.info("Get species catches for trait: " + bean.getId()); + log.info("Get species batch for trait: " + bean.getId()); } - List<TraitSpeciesCatchBean> catches = - persistenceService.getAllTraitSpeciesCatch(bean.getId()); rows = Lists.newArrayList(); - for (TraitSpeciesCatchBean aCatch : catches) { - SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel(); - entry.fromBean(aCatch); - rows.add(entry); + + if (!TuttiEntities.isNew(bean)) { + List<SpeciesBatch> catches = + persistenceService.getAllSpeciesBatch(bean.getId()); + for (SpeciesBatch aBatch : catches) { + List<SpeciesBatchFrequency> frequencies = + persistenceService.getAllSpeciesBatchFrequency(aBatch.getId()); + SpeciesBatchRowModel entry = + new SpeciesBatchRowModel(aBatch, frequencies); + rows.add(entry); + } } model.setTrait(bean); } @@ -307,297 +226,141 @@ model.fromBean(bean); model.setRows(rows); + listenModifcationOnFirstRow(); - //monitor.setBean(null); - - rows = model.getRows(); - rowMonitor.setBean(rows.get(0)); - traitMonitor.clearModified(); } @Override - protected SpeciesTabUIModel getModel() { - return ui.getModel(); - } - protected TableColumnModel createTableColumnModel(JXTable table) { - KeyListener keyAdapter = createTableKeyListener(getModel(), table); + DefaultTableColumnModelExt columnModel = + new DefaultTableColumnModelExt(); - { - NumberCellEditor<Float> editor = - JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false); - editor.getNumberEditor().setSelectAllTextOnError(true); - editor.getNumberEditor().getTextField().addKeyListener(keyAdapter); - editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); - table.setDefaultEditor(float.class, editor); - table.setDefaultEditor(Float.class, editor); - } - - // Boolean - { - TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class); - table.setDefaultRenderer(boolean.class, renderer); - - TableCellEditor editor = table.getDefaultEditor(Boolean.class); - table.setDefaultEditor(boolean.class, editor); - } - - table.addKeyListener(keyAdapter); - - // prepare the table column model - DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt(); - { // Species to confirm - addColumnToModel(columnModel, - table.getDefaultEditor(Boolean.class), - table.getDefaultRenderer(Boolean.class), - _("tutti.table.species.header.toConfirm"), - ColumnIdentifier.speciesToConfirm); - + addBooleanColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.speciesToConfirm, + table); } - List<SpeciesBean> allSpecies = persistenceService.getAllSpecies(); + List<Species> allSpecies = persistenceService.getAllSpecies(); { // Species (by code) - Decorator<SpeciesBean> decorator = getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE); + Decorator<Species> decorator = getDecorator( + Species.class, DecoratorService.SPECIES_BY_CODE); - JComboBox comboBox = new JComboBox(); - comboBox.setRenderer(newListCellRender(decorator)); - SwingUtil.fillComboBox(comboBox, allSpecies, null); - - ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - TableCellEditor editor = new ComboBoxCellEditor(comboBox); - TableCellRenderer renderer = - newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE); - - addColumnToModel(columnModel, - editor, - renderer, - _("tutti.table.species.header.speciesByCode"), - ColumnIdentifier.speciesByCode); + addComboDataColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.speciesByCode, + decorator, allSpecies); } { // Species (by genusCode) - Decorator<SpeciesBean> decorator = - getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE); + Decorator<Species> decorator = getDecorator( + Species.class, DecoratorService.SPECIES_BY_GENUS); - JComboBox comboBox = new JComboBox(); + addComboDataColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.speciesByGenusCode, + decorator, allSpecies); - comboBox.setRenderer(newListCellRender(decorator)); - SwingUtil.fillComboBox(comboBox, allSpecies, null); - - ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - - TableCellEditor editor = new ComboBoxCellEditor(comboBox); - TableCellRenderer renderer = newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS); - - addColumnToModel(columnModel, - editor, - renderer, - _("tutti.table.species.header.speciesByGenusCode"), - ColumnIdentifier.speciesByGenusCode); - } { // Vrac / Hors vrac - EnumEditor<VracHorsVracEnum> comboBox = - EnumEditor.newEditor(VracHorsVracEnum.values()); - BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); - TableCellEditor editor = new ComboBoxCellEditor(comboBox); - - addColumnToModel(columnModel, - editor, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.vracHorsVrac"), - ColumnIdentifier.vracHorsVrac); + addComboEnumColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.vracHorsVrac, + VracHorsVracEnum.values()); } { // Catégorie de poids - Decorator<WeightCategoryBean> decorator = - getDecorator(WeightCategoryBean.class, DecoratorService.BY_NAME); + Decorator<WeightCategory> decorator = + getDecorator(WeightCategory.class, + DecoratorService.BY_NAME); - JComboBox comboBox = new JComboBox(); + List<WeightCategory> data = + persistenceService.getAllWeightCategory(); - comboBox.setRenderer(newListCellRender(decorator)); - SwingUtil.fillComboBox(comboBox, persistenceService.getAllWeightCategories(), null); - - ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - - TableCellEditor editor = new ComboBoxCellEditor(comboBox); - TableCellRenderer renderer = - newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME); - - addColumnToModel(columnModel, - editor, - renderer, - _("tutti.table.species.header.weightCategory"), - ColumnIdentifier.weightCategory); + addComboDataColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.weightCategory, + decorator, data); } { // Sex - Decorator<SexBean> decorator = - getDecorator(SexBean.class, DecoratorService.BY_NAME); + Decorator<Sex> decorator = + getDecorator(Sex.class, DecoratorService.BY_NAME); - JComboBox comboBox = new JComboBox(); - comboBox.setRenderer(newListCellRender(decorator)); - SwingUtil.fillComboBox(comboBox, persistenceService.getAllSex(), null); + List<Sex> data = persistenceService.getAllSex(); - ObjectToStringConverter converter = - BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - - TableCellEditor editor = new ComboBoxCellEditor(comboBox); - TableCellRenderer renderer = - newTableCellRender(SexBean.class, DecoratorService.BY_NAME); - - addColumnToModel(columnModel, - editor, - renderer, - _("tutti.table.species.header.sex"), - ColumnIdentifier.sex); + addComboDataColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.sex, + decorator, data); } { // Maturity - addColumnToModel(columnModel, - table.getDefaultEditor(Float.class), - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.maturity"), - ColumnIdentifier.maturity); + addFloatColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.maturity, + TuttiUI.DECIMAL3_PATTERN + ); } { // Age - addColumnToModel(columnModel, - table.getDefaultEditor(Float.class), - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.age"), - ColumnIdentifier.age); + addFloatColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.age, + TuttiUI.DECIMAL3_PATTERN); } { // Poids observé - addColumnToModel(columnModel, - table.getDefaultEditor(Float.class), - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.weight"), - ColumnIdentifier.weight); + addFloatColumnToModel(columnModel, + SpeciesBatchColumnIdentifier.weight, + TuttiUI.DECIMAL3_PATTERN); } { // Poids calculé addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.computedWeight"), - ColumnIdentifier.computedWeight); + FrequencyCellComponent.newEditor(), + FrequencyCellComponent.newRender(), + SpeciesBatchColumnIdentifier.computedWeight); } { // Nombre calculé addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.computedNumber"), - ColumnIdentifier.computedNumber); + FrequencyCellComponent.newEditor(), + FrequencyCellComponent.newRender(), + SpeciesBatchColumnIdentifier.computedNumber); } { // Poids d'échantillon addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.sampleWeight"), - ColumnIdentifier.sampleWeight); + SpeciesBatchColumnIdentifier.sampleWeight); } { // Fraction d'élévation addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.elevationRate"), - ColumnIdentifier.elevationRatio); + SpeciesBatchColumnIdentifier.elevationRatio); } { // Commentaire addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.comment"), - ColumnIdentifier.comment); + SpeciesBatchColumnIdentifier.comment); } { // Pièces-jointes addColumnToModel(columnModel, - null, - table.getDefaultRenderer(Object.class), - _("tutti.table.species.header.file"), - ColumnIdentifier.file); + SpeciesBatchColumnIdentifier.file); } return columnModel; } - - private KeyListener createTableKeyListener(SpeciesTabUIModel model, JXTable table) { - final MoveToNextEditableCellAction nextCellAction = new MoveToNextEditableCellAction(model, table); - final MoveToPreviousEditableCellAction previousCellAction = new MoveToPreviousEditableCellAction(model, table); - - final MoveToNextEditableRowAction nextRowAction = new MoveToNextEditableRowAction(model, table); - final MoveToPreviousEditableRowAction previousRowAction = new MoveToPreviousEditableRowAction(model, table); - - // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les - // touches "entrer", "gauche", "doite" de facon personnalisée. - return new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER || - e.getKeyCode() == KeyEvent.VK_RIGHT || - e.getKeyCode() == KeyEvent.VK_TAB) { - e.consume(); - nextCellAction.actionPerformed(null); - } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { - e.consume(); - previousCellAction.actionPerformed(null); - } else if (e.getKeyCode() == KeyEvent.VK_UP) { - e.consume(); - previousRowAction.actionPerformed(null); - } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { - e.consume(); - nextRowAction.actionPerformed(null); - } else if (e.getKeyCode() == KeyEvent.VK_DOWN && e.isControlDown()) { - e.consume(); - - // create a new line with same sample - } - } - }; - } - - protected void addColumnToModel(TableColumnModel model, - TableCellEditor editor, - TableCellRenderer renderer, - String header, - Object identifier) { - - TableColumn col = new TableColumnExt(model.getColumnCount()); - col.setCellEditor(editor); - col.setCellRenderer(renderer); - col.setHeaderValue(header); - col.setIdentifier(identifier); - model.addColumn(col); - } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -24,28 +24,19 @@ * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.beans.AbstractSerializableBean; +import fr.ifremer.tutti.persistence.entities.data.Trait; +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderModelBuilder; -import java.util.List; - /** * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class SpeciesTabUIModel extends AbstractSerializableBean { +public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<Trait, SpeciesBatchRowModel, SpeciesTabUIModel> { private static final long serialVersionUID = 1L; - /** Logger. */ - private static final Log log = LogFactory.getLog(SpeciesTabUIModel.class); - public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight"; @@ -54,12 +45,8 @@ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight"; - public static final String PROPERTY_ROWS = "rows"; + protected Trait trait; - public static final String PROPERTY_NEW_ROW = "newRow"; - - protected TraitBean trait; - protected Float totalWeight; protected Float totalVracWeight; @@ -68,32 +55,30 @@ protected Float totalHorsVracWeight; - /** - * List of catches (linear representation). - * - * @since 0.2 - */ - protected List<SpeciesCatchEntryModel> rows; - - protected final Binder<TraitBean, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(TraitBean.class, SpeciesTabUIModel.class) + protected static final Binder<Trait, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(Trait.class, SpeciesTabUIModel.class) .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT) .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT) .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT) .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT) + .addProperty("id", PROPERTY_ID) .toBinder(); - protected final Binder<SpeciesTabUIModel, TraitBean> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, TraitBean.class) + protected static final Binder<SpeciesTabUIModel, Trait> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, Trait.class) .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight") .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight") .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight") .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight") .toBinder(); - public TraitBean getTrait() { + public SpeciesTabUIModel() { + super(Trait.class, fromBeanBinder, toBeanBinder); + } + + public Trait getTrait() { return trait; } - public void setTrait(TraitBean trait) { + public void setTrait(Trait trait) { this.trait = trait; } @@ -101,10 +86,6 @@ return totalWeight; } - public int getRowCount() { - return rows == null ? 0 : rows.size(); - } - public void setTotalWeight(Float totalWeight) { Object oldValue = getTotalWeight(); this.totalWeight = totalWeight; @@ -141,43 +122,9 @@ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight); } - public List<SpeciesCatchEntryModel> getRows() { - return rows; + @Override + protected Trait newEntity() { + return trait; } - public void setRows(List<SpeciesCatchEntryModel> rows) { - Object oldValue = getRowCount(); - if (rows == null) { - rows = Lists.newArrayList(); - } - this.rows = rows; - firePropertyChange(PROPERTY_ROWS, oldValue, rows); - } - - public void addNewCatch() { - Preconditions.checkState( - rows != null, - "Cant add a row, rows list is null"); - SpeciesCatchEntryModel newRow = new SpeciesCatchEntryModel(); - if (log.isInfoEnabled()) { - log.info("Add a new catch "); - } - rows.add(newRow); - firePropertyChange(PROPERTY_NEW_ROW, null, newRow); - } - - public void fromBean(TraitBean bean) { - - fromBeanBinder.copy(bean, this); - } - - public TraitBean toBean() { - TraitBean result = trait; - toBeanBinder.copy(this, result); - return result; - } - - public String getId() { - return trait == null ? null : trait.getId(); - } } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -1,209 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches.species; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import fr.ifremer.tutti.ui.swing.TuttiUIUtil; -import jaxx.runtime.SwingUtil; - -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import java.util.List; -import java.util.Set; - -/** - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SpeciesTableModel extends AbstractTableModel { - - public static enum ColumnIdentifier { - speciesToConfirm, - speciesByCode("species"), - speciesByGenusCode("species"), - vracHorsVrac, - weightCategory, - sex, - maturity, - age, - weight, - computedWeight(null), - computedNumber(null), - sampleWeight, - elevationRatio, - comment, - file(null); - - final String propertyName; - - ColumnIdentifier() { - this(""); - } - - ColumnIdentifier(String propertyName) { - this.propertyName = "".equals(propertyName) ? name() : propertyName; - } - - public void setValue(SpeciesCatchEntryModel entry, Object value) { - if (propertyName != null) - TuttiUIUtil.setProperty(entry, propertyName, value); - } - - public Object getValue(SpeciesCatchEntryModel entry) { - Object result = null; - if (propertyName != null && entry != null) { - result = TuttiUIUtil.getProperty(entry, propertyName); - } - return result; - } - } - - private static final long serialVersionUID = 1L; - - // TODO This will be dynamic by the protocol... - final Set<ColumnIdentifier> noneEditableCols = Sets.newHashSet( - ColumnIdentifier.age, - ColumnIdentifier.maturity, - ColumnIdentifier.computedWeight, - ColumnIdentifier.computedNumber, - ColumnIdentifier.sampleWeight, - ColumnIdentifier.elevationRatio, - ColumnIdentifier.file - ); - - protected final List<ColumnIdentifier> columnIdentifiers; - - protected final TableColumn[] columns; - - protected final SpeciesTabUIModel model; - - public SpeciesTableModel(TableColumnModel columnModel, - SpeciesTabUIModel model) { - this.model = model; - int nbcols = columnModel.getColumnCount(); - columns = new TableColumn[nbcols]; - columnIdentifiers = Lists.newArrayList(); - for (int i = 0; i < nbcols; i++) { - TableColumn column = columnModel.getColumn(i); - columns[i] = column; - columnIdentifiers.add((ColumnIdentifier) column.getIdentifier()); - } - } - - public void refreshData(List<SpeciesCatchEntryModel> data) { - - // can't accept a empty data list - Preconditions.checkNotNull(data, "Data list can not be null."); - - if (data.isEmpty()) { - - // add a first edit line - data.add(new SpeciesCatchEntryModel()); - } - fireTableDataChanged(); - } - - public void addNewRow(SpeciesCatchEntryModel newValue) { - - List<SpeciesCatchEntryModel> data = getData(); - Preconditions.checkNotNull(data, "Data list can not be null."); - - int rowIndex = data.indexOf(newValue); - fireTableRowsInserted(rowIndex, rowIndex); - } - - @Override - public int getRowCount() { - return model.getRowCount(); - } - - @Override - public int getColumnCount() { - return columns.length; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - SpeciesCatchEntryModel entry = getEntry(rowIndex); - ColumnIdentifier propertyName = getPropertyName(columnIndex); - Object result = propertyName.getValue(entry); - return result; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - SpeciesCatchEntryModel entry = getEntry(rowIndex); - ColumnIdentifier propertyName = getPropertyName(columnIndex); - propertyName.setValue(entry, aValue); - - if (propertyName == ColumnIdentifier.speciesByCode) { - - // update also speciesByGenusCode column - int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode); - fireTableCellUpdated(rowIndex, otherColumnIndex); - } else if (propertyName == ColumnIdentifier.speciesByGenusCode) { - - // update also speciesByCode column - int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode); - fireTableCellUpdated(rowIndex, otherColumnIndex); - } - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - ColumnIdentifier identifier = getPropertyName(columnIndex); - boolean result = !noneEditableCols.contains(identifier); - return result; - } - - public SpeciesCatchEntryModel getEntry(int rowIndex) { - SwingUtil.ensureRowIndex(this, rowIndex); - List<SpeciesCatchEntryModel> data = getData(); - SpeciesCatchEntryModel result = data == null ? null : data.get(rowIndex); - return result; - } - - protected TableColumn getColumn(int columnIndex) { - SwingUtil.ensureColumnIndex(this, columnIndex); - return columns[columnIndex]; - } - - protected ColumnIdentifier getPropertyName(int columnIndex) { - TableColumn column = getColumn(columnIndex); - return (ColumnIdentifier) column.getIdentifier(); - } - - protected int getColumnIndex(ColumnIdentifier property) { - int result = columnIdentifiers.indexOf(property); - return result; - } - - protected List<SpeciesCatchEntryModel> getData() { - return model.getRows(); - } -} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,95 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species.frequency; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.ui.swing.TuttiUIUtil; +import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier; + +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public enum SpeciesFrequencyColumnIdentifier implements AbstractColumnIdentifier<SpeciesFrequencyRowModel> { + + lengthStep( + n_("tutti.table.species.frequency.header.lengthStep"), + n_("tutti.table.species.frequency.header.lengthStep")), + number( + n_("tutti.table.species.frequency.header.number"), + n_("tutti.table.species.frequency.header.number")), + weight( + n_("tutti.table.species.frequency.header.weight"), + n_("tutti.table.species.frequency.header.weight")), + computedWeight( + n_("tutti.table.species.frequency.header.computedWeight"), + n_("tutti.table.species.frequency.header.computedWeight")); + + private final String propertyName; + + private final String headerI18nKey; + + private final String headerTipI18nKey; + + SpeciesFrequencyColumnIdentifier(String headerI18nKey, String headerTipI18nKey) { + this("", headerI18nKey, headerTipI18nKey); + } + + SpeciesFrequencyColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) { + this.propertyName = "".equals(propertyName) ? name() : propertyName; + this.headerI18nKey = headerI18nKey; + this.headerTipI18nKey = headerTipI18nKey; + } + + @Override + public String getPropertyName() { + return propertyName; + } + + @Override + public String getHeaderI18nKey() { + return headerI18nKey; + } + + @Override + public String getHeaderTipI18nKey() { + return headerTipI18nKey; + } + + @Override + public Object getValue(SpeciesFrequencyRowModel entry) { + Object result = null; + if (entry != null) { + result = TuttiUIUtil.getProperty(entry, propertyName); + } + return result; + } + + @Override + public void setValue(SpeciesFrequencyRowModel entry, Object value) { + TuttiUIUtil.setProperty(entry, propertyName, value); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,129 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species.frequency; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +/** + * Represents a batch frequency row. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_LENGTH_STEP = "lengthStep"; + + public static final String PROPERTY_NUMBER = "number"; + + public static final String PROPERTY_WEIGHT = "weight"; + + public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight"; + + /** + * Length step. + * + * @since 0.2 + */ + protected Float lengthStep; + + /** + * Count of fishes for this lengthStep. + * + * @since 0.2 + */ + protected Integer number; + + /** + * Weight of fishes observed. + * + * @since 0.2 + */ + protected Float weight; + + /** + * Computed weight from number + relation taille-poids. + * + * @since 0.2 + */ + protected Float computedWeight; + + protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder = + BinderFactory.newBinder(SpeciesBatchFrequency.class, + SpeciesFrequencyRowModel.class); + + protected static final Binder<SpeciesFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder = + BinderFactory.newBinder(SpeciesFrequencyRowModel.class, + SpeciesBatchFrequency.class); + + public SpeciesFrequencyRowModel() { + super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder); + } + + public Float getLengthStep() { + return lengthStep; + } + + public void setLengthStep(Float lengthStep) { + Object oldValue = getLengthStep(); + this.lengthStep = lengthStep; + firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep); + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + Object oldValue = getNumber(); + this.number = number; + firePropertyChange(PROPERTY_NUMBER, oldValue, number); + } + + public Float getWeight() { + return weight; + } + + public void setWeight(Float weight) { + Object oldValue = getWeight(); + this.weight = weight; + firePropertyChange(PROPERTY_WEIGHT, oldValue, weight); + } + + public Float getComputedWeight() { + return computedWeight; + } + + public void setComputedWeight(Float computedWeight) { + Object oldValue = getComputedWeight(); + this.computedWeight = computedWeight; + firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,61 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species.frequency; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel; + +import javax.swing.table.TableColumnModel; + +/** + * Model of the species frequency table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier> { + + private static final long serialVersionUID = 1L; + + public SpeciesFrequencyTableModel(TableColumnModel columnModel) { + super(columnModel); + + setNoneEditableCols(SpeciesFrequencyColumnIdentifier.weight); + } + + @Override + protected SpeciesFrequencyRowModel createNewRow() { + return new SpeciesFrequencyRowModel(); + } + + @Override + public void setValueAt(Object aValue, + int rowIndex, + int columnIndex, + SpeciesFrequencyColumnIdentifier propertyName, + SpeciesFrequencyRowModel entry) { + super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry); + // TODO Rebuild the computedWeight if possible... + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,44 @@ +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +#configurationPanel { + border:{new TitledBorder(null, _("tutti.label.frequencyConfiguration"))}; +} + +#saveButton { + actionIcon:"save"; + text:"tutti.action.save"; + enabled:{model.isModify() && model.isValid()}; +} + +#cancelButton { + actionIcon:"cancel"; + text:"tutti.action.cancel"; +} + +#table { + selectionMode:{ListSelectionModel.SINGLE_SELECTION}; + selectionBackground:{null}; + selectionForeground:{Color.BLACK}; + sortable:false; +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,86 @@ +<!-- + #%L + Tutti :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JPanel id='homePanel' layout='{new BorderLayout()}' + implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'> + + <import> + fr.ifremer.tutti.ui.swing.TuttiUIContext + fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel + + jaxx.runtime.swing.editor.bean.BeanComboBox + + org.jdesktop.swingx.JXTable + + javax.swing.ListSelectionModel + + java.awt.Color + java.awt.Dimension + + static org.nuiton.i18n.I18n._ + static jaxx.runtime.SwingUtil.getStringValue + + </import> + + <script><![CDATA[ + + public SpeciesFrequencyUI(TuttiUIContext context) { + SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + public void editBatch(SpeciesBatchRowModel row) { handler.editBatch(row); } + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <SpeciesFrequencyUIHandler id='handler' + initializer='getContextValue(SpeciesFrequencyUIHandler.class)'/> + + <SpeciesFrequencyUIModel id='model' + initializer='getContextValue(SpeciesFrequencyUIModel.class)'/> + + <JPanel id='configurationPanel' constraints='BorderLayout.NORTH' + layout='{new BorderLayout()}'> + + <JPanel id='configurationModePanel' constraints='BorderLayout.WEST'> + + </JPanel> + + + + </JPanel> + <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'> + <JXTable id='table'/> + </JScrollPane> + + <!-- actions --> + <JPanel id='actionPanel' layout='{new GridLayout(1, 0)}' + constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='saveButton' onActionPerformed='handler.save()'/> + </JPanel> + +</JPanel> \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,185 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species.frequency; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.ui.swing.TuttiUI; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import fr.ifremer.tutti.ui.swing.TuttiUIUtil; +import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel; +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.decorator.HighlightPredicate; +import org.jdesktop.swingx.table.DefaultTableColumnModelExt; + +import javax.swing.table.TableColumnModel; +import java.awt.Color; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier, SpeciesFrequencyTableModel, SpeciesFrequencyUIModel> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(SpeciesFrequencyUIHandler.class); + + private final SpeciesFrequencyUI ui; + + private final PersistenceService persistenceService; + + public SpeciesFrequencyUIHandler(TuttiUIContext context, + SpeciesFrequencyUI ui) { + super(context, + SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP, + SpeciesFrequencyRowModel.PROPERTY_NUMBER, + SpeciesFrequencyRowModel.PROPERTY_WEIGHT, + SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT); + this.ui = ui; + persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel(); + + ui.setContextValue(model); + } + + @Override + protected void saveRow(SpeciesFrequencyRowModel row) { + + //TODO + } + + @Override + protected JXTable getTable() { + return ui.getTable(); + } + + @Override + public void afterInitUI() { + + initUI(ui); + + JXTable table = getTable(); + + // create table column model + TableColumnModel columnModel = createTableColumnModel(table); + + // create table model + SpeciesFrequencyTableModel tableModel = + new SpeciesFrequencyTableModel(columnModel); + + table.setModel(tableModel); + table.setColumnModel(columnModel); + + installTableKeyListener(columnModel, table); + + table.getTableHeader().setReorderingAllowed(false); + + table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY)); + + // when model datas change let's propagate it table model + listenRowsFromModel(); + + // save when row chaged and was modified + listenRowModification(table); + } + + @Override + public void onCloseUI() { +// ui.getValidator().setBean(null); + } + + @Override + protected SpeciesFrequencyUIModel getModel() { + return ui.getModel(); + } + + public void editBatch(SpeciesBatchRowModel row) { + + if (log.isInfoEnabled()) { + log.info("Will edit row: " + row); + } + getModel().fromBean(row); + } + + public void cancel() { + if (log.isInfoEnabled()) { + log.info("Will cancel"); + } + } + + public void save() { + + if (log.isInfoEnabled()) { + log.info("Will save"); + } + + SpeciesFrequencyUIModel model = getModel(); + + } + + @Override + protected TableColumnModel createTableColumnModel(JXTable table) { + + DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt(); + + { // LengthStep + + addFloatColumnToModel(columnModel, + SpeciesFrequencyColumnIdentifier.lengthStep, + TuttiUI.DECIMAL3_PATTERN); + } + + { // Number + + addIntegerColumnToModel(columnModel, + SpeciesFrequencyColumnIdentifier.number, + TuttiUI.INT_6_DIGITS_PATTERN); + } + + { // weight + + addFloatColumnToModel(columnModel, + SpeciesFrequencyColumnIdentifier.weight, + TuttiUI.DECIMAL3_PATTERN); + } + + { // computedWeight + + addFloatColumnToModel(columnModel, + SpeciesFrequencyColumnIdentifier.computedWeight, + TuttiUI.DECIMAL3_PATTERN); + } + return columnModel; + } + +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,97 @@ +package fr.ifremer.tutti.ui.swing.content.catches.species.frequency; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel; +import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderModelBuilder; + +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> { + + private static final long serialVersionUID = 1L; + + protected static final Binder<SpeciesBatchRowModel, SpeciesFrequencyUIModel> fromBeanBinder = + BinderModelBuilder.newEmptyBuilder(SpeciesBatchRowModel.class, SpeciesFrequencyUIModel.class) + .addProperty(SpeciesBatchRowModel.PROPERTY_FREQUENCY, PROPERTY_ROWS) + .toBinder(); + + protected static final Binder<SpeciesFrequencyUIModel, SpeciesBatchRowModel> toBeanBinder = + BinderModelBuilder.newEmptyBuilder(SpeciesFrequencyUIModel.class, SpeciesBatchRowModel.class) + .addProperty(PROPERTY_ROWS, SpeciesBatchRowModel.PROPERTY_FREQUENCY) + .toBinder(); + + public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode"; + + public static enum ConfigurationMode { + + SIMPLE(n_("tutti.speciesFrequency.configurationMode.simple"), + n_("tutti.speciesFrequency.configurationMode.simple.tip")), + AUTO_GEN(n_("tutti.speciesFrequency.configurationMode.autoGenerate"), + n_("tutti.speciesFrequency.configurationMode.autoGenerate.tip")), + RAFALE(n_("tutti.speciesFrequency.configurationMode.rafale"), + n_("tutti.speciesFrequency.configurationMode.rafale.tip")); + + private final String i18nKey; + + private final String tipKey; + + private ConfigurationMode(String i18nKey, String tipKey) { + this.i18nKey = i18nKey; + this.tipKey = tipKey; + } + + public String getI18nKey() { + return i18nKey; + } + + public String getTipKey() { + return tipKey; + } + } + + protected ConfigurationMode configurationMode; + + public SpeciesFrequencyUIModel() { + super(SpeciesBatchRowModel.class, fromBeanBinder, toBeanBinder); + } + + public ConfigurationMode getConfigurationMode() { + return configurationMode; + } + + public void setConfigurationMode(ConfigurationMode configurationMode) { + Object oldValue = getConfigurationMode(); + this.configurationMode = configurationMode; + firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode); + } + +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,44 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.io.Serializable; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public interface AbstractColumnIdentifier<R> extends Serializable { + + String getPropertyName(); + + String getHeaderI18nKey(); + + String getHeaderTipI18nKey(); + + void setValue(R entry, Object value); + + Object getValue(R entry); +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,98 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.AbstractAction; +import javax.swing.JTable; + +/** + * Abstract action to select something in a table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public abstract class AbstractSelectTableAction<M extends AbstractTuttiTableModel> extends AbstractAction { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractSelectTableAction.class); + + private final JTable table; + + private final M model; + + public AbstractSelectTableAction(M model, JTable table) { + this.model = model; + this.table = table; + } + + protected void doSelectCell(int rowIndex, int columnIndex) { + + if (log.isDebugEnabled()) { + log.debug("Will select cell at " + + getCellCoordinate(rowIndex, columnIndex)); + } + + table.editCellAt(rowIndex, columnIndex); + table.setColumnSelectionInterval(columnIndex, columnIndex); + table.setRowSelectionInterval(rowIndex, rowIndex); + } + + + protected int getSelectedRow() { + int result = table.getSelectedRow(); + return result; + } + + protected int getSelectedColumn() { + int result = table.getSelectedColumn(); + return result; + } + + protected int getRowCount() { + return table.getRowCount(); + } + + protected int getColumnCount() { + return table.getColumnCount(); + } + + protected boolean isCellEditable(int rowIndex, int columnIndex) { + return table.isCellEditable(rowIndex, columnIndex); + } + + protected String getCellCoordinate(int rowIndex, int columnIndex) { + return " [" + rowIndex + ", " + columnIndex + "]"; + } + + protected void addNewRow() { + model.addNewRow(); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,216 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import jaxx.runtime.SwingUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public abstract class AbstractTuttiTableModel<R extends Serializable, C extends AbstractColumnIdentifier<R>> extends AbstractTableModel { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractTuttiTableModel.class); + + /** + * Column definition. + * + * @since 0.2 + */ + protected final TableColumn[] columns; + + /** + * Column identifiers. + * + * @since 0.2 + */ + protected final List<C> columnIdentifiers; + + /** + * Data in the model. + * + * @since 0.2 + */ + protected List<R> rows; + + /** + * Set of non editable columns. + * + * @since 0.2 + */ + protected Set<C> noneEditableCols; + + protected abstract R createNewRow(); + + protected AbstractTuttiTableModel(TableColumnModel columnModel) { + int nbcols = columnModel.getColumnCount(); + columns = new TableColumn[nbcols]; + columnIdentifiers = Lists.newArrayList(); + for (int i = 0; i < nbcols; i++) { + TableColumn column = columnModel.getColumn(i); + columns[i] = column; + columnIdentifiers.add((C) column.getIdentifier()); + } + } + + public final List<R> getRows() { + return rows; + } + + public final void setRows(List<R> data) { + + // can't accept a empty data list + Preconditions.checkNotNull(data, "Data list can not be null."); + + if (data.isEmpty()) { + + // add a first edit line + data.add(createNewRow()); + } + if (log.isInfoEnabled()) { + log.info("Set " + data.size() + " row(s) in table model " + this); + } + this.rows = data; + fireTableDataChanged(); + } + + public final void addNewRow() { + R newValue = createNewRow(); + + List<R> data = getRows(); + Preconditions.checkNotNull(data, "Data list can not be null."); + data.add(newValue); + + int rowIndex = data.indexOf(newValue); + fireTableRowsInserted(rowIndex, rowIndex); + } + + public final C getPropertyName(int columnIndex) { + TableColumn column = getColumn(columnIndex); + return (C) column.getIdentifier(); + } + + public final R getEntry(int rowIndex) { + SwingUtil.ensureRowIndex(this, rowIndex); + List<R> data = getRows(); + R result = data == null ? null : data.get(rowIndex); + return result; + } + + public final void setNoneEditableCols(C... noneEditableCols) { + this.noneEditableCols = Sets.newHashSet(noneEditableCols); + } + + @Override + public final int getRowCount() { + return rows == null ? 0 : rows.size(); + } + + @Override + public final int getColumnCount() { + return columns.length; + } + + @Override + public final Object getValueAt(int rowIndex, int columnIndex) { + R entry = getEntry(rowIndex); + C propertyName = getPropertyName(columnIndex); + Object result = getValueAt(rowIndex, columnIndex, propertyName, entry); + return result; + } + + @Override + public final void setValueAt(Object aValue, int rowIndex, int columnIndex) { + R entry = getEntry(rowIndex); + C propertyName = getPropertyName(columnIndex); + setValueAt(aValue, rowIndex, columnIndex, propertyName, entry); + } + + @Override + public final boolean isCellEditable(int rowIndex, int columnIndex) { + C identifier = getPropertyName(columnIndex); + boolean result = isCellEditable(rowIndex, columnIndex, identifier); + return result; + } + + protected Object getValueAt(int rowIndex, + int columnIndex, + C propertyName, + R entry) { + Object result = propertyName.getValue(entry); + return result; + } + + protected void setValueAt(Object aValue, + int rowIndex, + int columnIndex, + C propertyName, + R entry) { + propertyName.setValue(entry, aValue); + } + + protected boolean isCellEditable(int rowIndex, + int columnIndex, + C propertyName) { + boolean result = !noneEditableCols.contains(propertyName); + return result; + } + + protected final void fireTableCellUpdated(int rowIndex, + C... identifiers) { + for (C identifier : identifiers) { + int columnIndex = getColumnIndex(identifier); + fireTableCellUpdated(rowIndex, columnIndex); + } + } + + protected final TableColumn getColumn(int columnIndex) { + SwingUtil.ensureColumnIndex(this, columnIndex); + return columns[columnIndex]; + } + + protected final int getColumnIndex(C property) { + int result = columnIdentifiers.indexOf(property); + return result; + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,331 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.base.Preconditions; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.JAXXWidgetUtil; +import jaxx.runtime.swing.editor.EnumEditor; +import jaxx.runtime.swing.editor.bean.BeanUIUtil; +import jaxx.runtime.swing.editor.cell.NumberCellEditor; +import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor; +import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; +import org.jdesktop.swingx.table.TableColumnExt; +import org.nuiton.util.beans.BeanMonitor; +import org.nuiton.util.decorator.Decorator; + +import javax.swing.JComboBox; +import javax.swing.JTable; +import javax.swing.border.LineBorder; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Enumeration; +import java.util.List; + +import static org.nuiton.i18n.I18n._; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends AbstractColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractTuttiTableUIHandler.class); + + /** + * Monitor the selected row (save it only if something has changed). + * + * @since 0.2 + */ + private final BeanMonitor rowMonitor; + + protected AbstractTuttiTableUIHandler(TuttiUIContext context, + String... properties) { + super(context); + rowMonitor = new BeanMonitor(properties); + } + + protected KeyListener installTableKeyListener(TableColumnModel columnModel, JTable table) { + + T model = getTableModel(); + final MoveToNextEditableCellAction nextCellAction = + MoveToNextEditableCellAction.newAction(model, table); + final MoveToPreviousEditableCellAction previousCellAction = + MoveToPreviousEditableCellAction.newAction(model, table); + + final MoveToNextEditableRowAction nextRowAction = + MoveToNextEditableRowAction.newAction(model, table); + final MoveToPreviousEditableRowAction previousRowAction = + MoveToPreviousEditableRowAction.newAction(model, table); + + // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les + // touches "entrer", "gauche", "droite" de facon personnalisée. + KeyAdapter keyAdapter = new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER || + e.getKeyCode() == KeyEvent.VK_RIGHT || + e.getKeyCode() == KeyEvent.VK_TAB) { + e.consume(); + nextCellAction.actionPerformed(null); + } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + e.consume(); + previousCellAction.actionPerformed(null); + } else if (e.getKeyCode() == KeyEvent.VK_UP) { + e.consume(); + previousRowAction.actionPerformed(null); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + e.consume(); + nextRowAction.actionPerformed(null); + } + } + }; + table.addKeyListener(keyAdapter); + + Enumeration<TableColumn> columns = columnModel.getColumns(); + while (columns.hasMoreElements()) { + TableColumn tableColumn = columns.nextElement(); + TableCellEditor cellEditor = tableColumn.getCellEditor(); + if (cellEditor instanceof NumberCellEditor) { + NumberCellEditor editor = (NumberCellEditor) cellEditor; + editor.getNumberEditor().getTextField().addKeyListener(keyAdapter); + } + } + + return keyAdapter; + } + + protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model, + TableCellEditor editor, + TableCellRenderer renderer, + C identifier) { + + TableColumn col = new TableColumnExt(model.getColumnCount()); + col.setCellEditor(editor); + col.setCellRenderer(renderer); + col.setHeaderValue(_(identifier.getHeaderI18nKey())); + //TODO Use tip in a header renderer + + col.setIdentifier(identifier); + model.addColumn(col); + } + + protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model, + C identifier) { + + addColumnToModel(model, null, null, identifier); + } + + protected <C extends AbstractColumnIdentifier> void addFloatColumnToModel(TableColumnModel model, + C identifier, + String numberPattern) { + + NumberCellEditor<Float> editor = + JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false); + editor.getNumberEditor().setSelectAllTextOnError(true); + editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); + editor.getNumberEditor().setNumberPattern(numberPattern); + + addColumnToModel(model, editor, null, identifier); + + } + + protected <C extends AbstractColumnIdentifier> void addIntegerColumnToModel(TableColumnModel model, + C identifier, + String numberPattern) { + + NumberCellEditor<Integer> editor = + JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false); + editor.getNumberEditor().setSelectAllTextOnError(true); + editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); + editor.getNumberEditor().setNumberPattern(numberPattern); + + addColumnToModel(model, editor, null, identifier); + } + + + protected <C extends AbstractColumnIdentifier> void addBooleanColumnToModel(TableColumnModel model, + C identifier, + JTable table) { + + addColumnToModel(model, + table.getDefaultEditor(Boolean.class), + table.getDefaultRenderer(Boolean.class), + identifier); + } + + protected <C extends AbstractColumnIdentifier, B> void addComboDataColumnToModel(TableColumnModel model, + C identifier, + Decorator<B> decorator, List<B> data) { + JComboBox comboBox = new JComboBox(); + comboBox.setRenderer(newListCellRender(decorator)); + SwingUtil.fillComboBox(comboBox, data, null); + + ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); + BeanUIUtil.decorate(comboBox, converter); + ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox); + + addColumnToModel(model, + editor, + newTableCellRender(decorator), + identifier); + } + + protected <C extends AbstractColumnIdentifier, B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model, + C identifier, + B[] data) { + EnumEditor<B> comboBox = + EnumEditor.newEditor(data); + BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); + TableCellEditor editor = new ComboBoxCellEditor(comboBox); + + addColumnToModel(model, + editor, + null, + identifier); + } + + protected void listenRowsFromModel() { + getModel().addPropertyChangeListener(AbstractTuttiTableUIModel.PROPERTY_ROWS, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + getTableModel().setRows((List<R>) evt.getNewValue()); + } + }); + } + + protected <O> TableCellRenderer newTableCellRender(Class<O> type) { + + return newTableCellRender(type, null); + } + + protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) { + + Decorator<O> decorator = getDecorator(type, name); + + TableCellRenderer result = newTableCellRender(decorator); + return result; + } + + protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) { + + Preconditions.checkNotNull(decorator); + + DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator); + return result; + } + + protected void listenRowModification(JTable table) { + ListSelectionListener listener = new TableRowModificationListener( + getTableModel(), rowMonitor) { + @Override + protected void saveSelectedRow() { + saveSelectedRowIfRequired(); + } + }; + table.getSelectionModel().addListSelectionListener(listener); + } + + public void saveSelectedRowIfRequired(FocusEvent event) { + + Component oppositeComponent = event.getOppositeComponent(); + + JXTable parentContainer = null; + + if (oppositeComponent != null) { + + // check out if still on table + parentContainer = SwingUtil.getParentContainer( + oppositeComponent, JXTable.class); + } + + if (parentContainer == null) { + + // out of the table can save + saveSelectedRowIfRequired(); + } + } + + public void saveSelectedRowIfRequired() { + + R bean = (R) rowMonitor.getBean(); + if (bean != null && bean.isValid()) { + + // there is a valid bean attached to the monitor + + if (rowMonitor.wasModified()) { + + // monitored bean was modified, save it + if (log.isInfoEnabled()) { + log.info("Row " + bean + " was modified, will save it"); + } + + saveRow(bean); + + // clear modified flag on the monitor + rowMonitor.clearModified(); + } + } + } + + protected abstract void saveRow(R row); + + protected abstract TableColumnModel createTableColumnModel(JXTable table); + + protected abstract JTable getTable(); + + protected T getTableModel() { + return (T) getTable().getModel(); + } + + protected void listenModifcationOnFirstRow() { + List<R> rows = getTableModel().getRows(); + if (CollectionUtils.isNotEmpty(rows)) { + rowMonitor.setBean(rows.get(0)); + } + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,65 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; + +import java.util.List; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public abstract class AbstractTuttiTableUIModel<E, R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiTableUIModel<E, R, B>> extends AbstractTuttiBeanUIModel<E, B> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_ROWS = "rows"; + + protected List<R> rows; + + protected AbstractTuttiTableUIModel(Class<E> entityType, Binder<E, B> fromBeanBinder, Binder<B, E> toBeanBinder) { + super(entityType, fromBeanBinder, toBeanBinder); + } + + public List<R> getRows() { + return rows; + } + + public void setRows(List<R> rows) { + Object oldValue = getRows(); + if (rows == null) { + rows = Lists.newArrayList(); + } + this.rows = rows; + firePropertyChange(PROPERTY_ROWS, oldValue, rows); + } + + public int getRowCount() { + return rows == null ? 0 : rows.size(); + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,102 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JTable; +import java.awt.event.ActionEvent; + +/** + * Action to select next editable cell in a table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class MoveToNextEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(MoveToNextEditableCellAction.class); + + public static <M extends AbstractTuttiTableModel> MoveToNextEditableCellAction<M> newAction(M model, JTable table) { + return new MoveToNextEditableCellAction<M>(model, table); + } + + protected MoveToNextEditableCellAction(M model, JTable table) { + super(model, table); + } + + @Override + public void actionPerformed(ActionEvent e) { + + int currentRow = getSelectedRow(); + int currentColumn = getSelectedColumn(); + + if (log.isDebugEnabled()) { + log.debug("Move to previous editable cell " + + getCellCoordinate(currentRow, currentColumn)); + } + + int columnCount = getColumnCount(); + + int rowCount = getRowCount(); + + while (currentRow <= rowCount || currentColumn <= columnCount) { + + // go to next cell + currentColumn++; + + // select next cell + if (currentColumn >= columnCount) { + + // no more cell, so will move to next editable column on next row + currentColumn = 0; + currentRow++; + + if (currentRow == rowCount) { + + // create a new row in model + addNewRow(); + } + } + + if (isCellEditable(currentRow, currentColumn)) { + + doSelectCell(currentRow, currentColumn); + + break; + } else { + if (log.isDebugEnabled()) { + log.debug("Cell not editable at " + + getCellCoordinate(currentRow, currentColumn)); + } + } + } + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,85 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JTable; +import java.awt.event.ActionEvent; + +/** + * Action to select next editable row in a table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class MoveToNextEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(MoveToNextEditableRowAction.class); + + public static <M extends AbstractTuttiTableModel> MoveToNextEditableRowAction<M> newAction(M model, JTable table) { + return new MoveToNextEditableRowAction<M>(model, table); + } + + protected MoveToNextEditableRowAction(M model, JTable table) { + super(model, table); + } + + @Override + public void actionPerformed(ActionEvent e) { + int currentRow = getSelectedRow(); + int currentColumn = getSelectedColumn(); + + if (isCellEditable(currentRow, currentColumn)) { + if (log.isDebugEnabled()) { + log.debug("Move to next row editable cell " + + getCellCoordinate(currentRow, currentColumn)); + } + currentRow++; + + if (currentRow >= getRowCount()) { + if (log.isDebugEnabled()) { + log.debug("No next row"); + } + + // create a new row in model + addNewRow(); + } + + doSelectCell(currentRow, currentColumn); + + } else { + if (log.isDebugEnabled()) { + log.debug("Cell not editable at " + + getCellCoordinate(currentRow, currentColumn)); + } + } + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,90 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JTable; +import java.awt.event.ActionEvent; + +/** + * Action to select previous editable cell in a table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class MoveToPreviousEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(MoveToPreviousEditableCellAction.class); + + public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableCellAction<M> newAction(M model, JTable table) { + return new MoveToPreviousEditableCellAction<M>(model, table); + } + + protected MoveToPreviousEditableCellAction(M model, JTable table) { + super(model, table); + } + + @Override + public void actionPerformed(ActionEvent e) { + int currentRow = getSelectedRow(); + int currentColumn = getSelectedColumn(); + + if (log.isDebugEnabled()) { + log.debug("Move to previous editable cell, " + + getCellCoordinate(currentRow, currentColumn)); + } + + int columnCount = getColumnCount(); + + while (currentRow > 0 || currentColumn > 0) { + + // go to next cell + currentColumn--; + + // select next cell + if (currentColumn < 0) { + + currentColumn = columnCount - 1; + currentRow--; + } + + if (isCellEditable(currentRow, currentColumn)) { + doSelectCell(currentRow, currentColumn); + break; + } else { + if (log.isDebugEnabled()) { + log.debug("Cell not editable at " + + getCellCoordinate(currentRow, currentColumn)); + } + } + } + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,82 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JTable; +import java.awt.event.ActionEvent; + +/** + * Action to select previous editable row in a table. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class MoveToPreviousEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(MoveToPreviousEditableRowAction.class); + + public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableRowAction<M> newAction(M model, JTable table) { + return new MoveToPreviousEditableRowAction<M>(model, table); + } + + protected MoveToPreviousEditableRowAction(M model, JTable table) { + super(model, table); + } + + @Override + public void actionPerformed(ActionEvent e) { + + int currentRow = getSelectedRow(); + int currentColumn = getSelectedColumn(); + + if (isCellEditable(currentRow, currentColumn)) { + if (log.isDebugEnabled()) { + log.debug("Move to previous row editable cell " + + getCellCoordinate(currentRow, currentColumn)); + } + currentRow--; + + if (currentRow < 0) { + if (log.isDebugEnabled()) { + log.debug("No previous row"); + } + } else { + doSelectCell(currentRow, currentColumn); + } + } else { + if (log.isDebugEnabled()) { + log.debug("Cell not editable at " + + getCellCoordinate(currentRow, currentColumn)); + } + } + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-06 17:03:05 UTC (rev 30) @@ -0,0 +1,85 @@ +package fr.ifremer.tutti.ui.swing.util.table; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanMonitor; + +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public abstract class TableRowModificationListener implements ListSelectionListener { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(TableRowModificationListener.class); + + private final AbstractTuttiTableModel tableModel; + + private final BeanMonitor beanMonitor; + + protected abstract void saveSelectedRow(); + + public TableRowModificationListener(AbstractTuttiTableModel tableModel, + BeanMonitor beanMonitor) { + this.tableModel = tableModel; + this.beanMonitor = beanMonitor; + } + + @Override + public void valueChanged(ListSelectionEvent e) { + if (!e.getValueIsAdjusting()) { + ListSelectionModel source = (ListSelectionModel) e.getSource(); + int selectedRow = source.getLeadSelectionIndex(); + + // save selected entry if required + saveSelectedRow(); + + if (log.isInfoEnabled()) { + log.info("New selected row: " + selectedRow); + } + + Object entry; + + if (selectedRow == -1) { + // no selection + entry = null; + } else { + entry = tableModel.getEntry(selectedRow); + } + + if (log.isInfoEnabled()) { + log.info("Will monitor entry: " + entry); + } + beanMonitor.setBean(entry); + } + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:32:56 UTC (rev 29) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:03:05 UTC (rev 30) @@ -51,6 +51,7 @@ tutti.label.fishes.totalHorsVracWeight=Poids total hors vrac tutti.label.fishes.totalVracWeight=Poids total vrac tutti.label.fishes.totalWeight=Poids total +tutti.label.frequencyConfiguration= tutti.label.list.gear=Engin(s) tutti.label.list.headOfMission=Chef(s) de mission tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri @@ -120,6 +121,12 @@ tutti.menu.synchronisationImport.tip=Effectuer des imports tutti.menu.synchronisations=Synchronisation tutti.menu.synchronisations.tip=Import/Export +tutti.speciesFrequency.configurationMode.autoGenerate= +tutti.speciesFrequency.configurationMode.autoGenerate.tip= +tutti.speciesFrequency.configurationMode.rafale= +tutti.speciesFrequency.configurationMode.rafale.tip= +tutti.speciesFrequency.configurationMode.simple= +tutti.speciesFrequency.configurationMode.simple.tip= tutti.table.benthos.header.number=Nombre observé tutti.table.benthos.header.speciesByCode=Espèce tutti.table.benthos.header.weight=Poids observé @@ -132,21 +139,25 @@ tutti.table.plancton.header.number=Nombre observé tutti.table.plancton.header.speciesByCode=Espèce tutti.table.plancton.header.weight=Poids observé -tutti.table.species.header.age=Age -tutti.table.species.header.comment=Commentaire -tutti.table.species.header.computedNumber=Nombre calculé -tutti.table.species.header.computedWeight=Poids calculé -tutti.table.species.header.elevationRate=Fraction d'él -tutti.table.species.header.file=Pièces jointes -tutti.table.species.header.maturity=Maturité -tutti.table.species.header.sampleWeight=Poids échan -tutti.table.species.header.sex=Sexe -tutti.table.species.header.speciesByCode=Espèce -tutti.table.species.header.speciesByGenusCode=Espèce -tutti.table.species.header.toConfirm=A Confirmer -tutti.table.species.header.vracHorsVrac=Vrac / Hors Vrac -tutti.table.species.header.weight=Poids -tutti.table.species.header.weightCategory=Catégorie Poids +tutti.table.species.batch.header.age=Age +tutti.table.species.batch.header.comment=Commentaire +tutti.table.species.batch.header.computedNumber=Nombre calculé +tutti.table.species.batch.header.computedWeight=Poids calculé +tutti.table.species.batch.header.elevationRate=Fraction d'él +tutti.table.species.batch.header.file=Pièces jointes +tutti.table.species.batch.header.maturity=Maturité +tutti.table.species.batch.header.sampleWeight=Poids échan +tutti.table.species.batch.header.sex=Sexe +tutti.table.species.batch.header.speciesByCode=Espèce +tutti.table.species.batch.header.speciesByGenusCode=Espèce +tutti.table.species.batch.header.toConfirm=A Confirmer +tutti.table.species.batch.header.vracHorsVrac=Vrac / Hors Vrac +tutti.table.species.batch.header.weight=Poids +tutti.table.species.batch.header.weightCategory=Catégorie Poids +tutti.table.species.frequency.header.computedWeight=Poids calculé +tutti.table.species.frequency.header.lengthStep=Classe de taille +tutti.table.species.frequency.header.number=Nombre +tutti.table.species.frequency.header.weight=Poids observé tutti.title.about=À propos de Tutti tutti.title.create.campaign=Créer une nouvelle campagne tutti.title.create.survey=Créer une nouvelle série de campagne Added: trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png =================================================================== (Binary files differ) Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-show-frequency.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL
participants (1)
-
tchemit@users.forge.codelutin.com