Author: tchemit Date: 2012-12-11 15:19:11 +0100 (Tue, 11 Dec 2012) New Revision: 40 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/40 Log: rename ScientificCruise to Cruise move ui to correct packages Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml Removed: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo 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/MainUI.css 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/TuttiScreen.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/config/TuttiConfig.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.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/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/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/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/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/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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-11 14:19:11 UTC (rev 40) @@ -30,7 +30,7 @@ import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; import fr.ifremer.tutti.persistence.entities.referential.Strata; @@ -107,22 +107,22 @@ Program saveProgram(Program bean); //------------------------------------------------------------------------// - //-- ScientificCruise methods --// + //-- Cruise methods --// //------------------------------------------------------------------------// - List<ScientificCruise> getAllScientificCruise(String programId); + List<Cruise> getAllCruise(String programId); - ScientificCruise getScientificCruise(String id); + Cruise getCruise(String id); - ScientificCruise createScientificCruise(ScientificCruise bean); + Cruise createCruise(Cruise bean); - ScientificCruise saveScientificCruise(ScientificCruise bean); + Cruise saveCruise(Cruise bean); //------------------------------------------------------------------------// //-- FishingOperation methods --// //------------------------------------------------------------------------// - List<FishingOperation> getAllFishingOperation(String scientificCruiseId); + List<FishingOperation> getAllFishingOperation(String cruiseId); FishingOperation getFishingOperation(String id); Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware =================================================================== --- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-11 14:19:11 UTC (rev 40) @@ -4,7 +4,7 @@ fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch fr.ifremer.tutti.persistence.entities.data.PlanctonBatch fr.ifremer.tutti.persistence.entities.data.Program -fr.ifremer.tutti.persistence.entities.data.ScientificCruise +fr.ifremer.tutti.persistence.entities.data.Cruise fr.ifremer.tutti.persistence.entities.data.SpeciesBatch fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency fr.ifremer.tutti.persistence.entities.referential.BeaufortScale Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties =================================================================== --- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-11 14:19:11 UTC (rev 40) @@ -28,8 +28,8 @@ model.tagvalue.noPCS=true model.tagvalue.beanSuperClass=fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity -fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.gear.stereotype=ordered -fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfMission.stereotype=ordered -fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfSortRoom.stereotype=ordered -fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.vessel.stereotype=ordered +fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.gear.stereotype=ordered +fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfMission.stereotype=ordered +fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfSortRoom.stereotype=ordered +fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.vessel.stereotype=ordered fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo =================================================================== (Binary files differ) 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-11 14:19:11 UTC (rev 40) @@ -42,7 +42,7 @@ import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; @@ -267,14 +267,14 @@ } //------------------------------------------------------------------------// - //-- ScientificCruise methods --// + //-- Cruise methods --// //------------------------------------------------------------------------// @Override - public List<ScientificCruise> getAllScientificCruise(final String programId) { - List<ScientificCruise> result = Lists.newArrayList(Iterables.filter(getData(ScientificCruise.class), new Predicate<ScientificCruise>() { + public List<Cruise> getAllCruise(final String programId) { + List<Cruise> result = Lists.newArrayList(Iterables.filter(getData(Cruise.class), new Predicate<Cruise>() { @Override - public boolean apply(ScientificCruise input) { + public boolean apply(Cruise input) { return programId.equals(input.getProgram().getId()); } })); @@ -282,20 +282,20 @@ } @Override - public ScientificCruise getScientificCruise(String id) { - ScientificCruise result = getBean(ScientificCruise.class, id); + public Cruise getCruise(String id) { + Cruise result = getBean(Cruise.class, id); return result; } @Override - public ScientificCruise createScientificCruise(ScientificCruise bean) { - ScientificCruise result = create(ScientificCruise.class, bean); + public Cruise createCruise(Cruise bean) { + Cruise result = create(Cruise.class, bean); return result; } @Override - public ScientificCruise saveScientificCruise(ScientificCruise bean) { - ScientificCruise result = save(ScientificCruise.class, bean); + public Cruise saveCruise(Cruise bean) { + Cruise result = save(Cruise.class, bean); return result; } @@ -304,11 +304,11 @@ //------------------------------------------------------------------------// @Override - public List<FishingOperation> getAllFishingOperation(final String scientificCruiseId) { + public List<FishingOperation> getAllFishingOperation(final String cruiseId) { List<FishingOperation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperation.class), new Predicate<FishingOperation>() { @Override public boolean apply(FishingOperation input) { - return scientificCruiseId.equals(input.getScientificCruise().getId()); + return cruiseId.equals(input.getCruise().getId()); } })); return result; 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-11 14:19:11 UTC (rev 40) @@ -24,7 +24,7 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.referential.Person; import fr.ifremer.tutti.persistence.entities.referential.Strata; @@ -85,7 +85,7 @@ protected void loadDecorators() { registerMultiJXPathDecorator(Program.class, "${name}$s", "#", " - "); - registerMultiJXPathDecorator(ScientificCruise.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(Cruise.class, "${name}$s", "#", " - "); registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - "); registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - "); registerMultiJXPathDecorator(Vessel.class, "${name}$s#", "#", " - "); @@ -112,7 +112,7 @@ n_("tutti.property.stationNumber"); n_("tutti.property.date"); n_("tutti.property.program"); - n_("tutti.property.scientificCruise"); + n_("tutti.property.cruise"); n_("tutti.property.fishingOperation"); n_("tutti.property.zone"); n_("tutti.property.vessel"); 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-11 14:19:11 UTC (rev 40) @@ -29,7 +29,7 @@ import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch; import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch; import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch; @@ -227,31 +227,31 @@ } //------------------------------------------------------------------------// - //-- ScientificCruise methods --// + //-- Cruise methods --// //------------------------------------------------------------------------// @Override - public List<ScientificCruise> getAllScientificCruise(String programId) { + public List<Cruise> getAllCruise(String programId) { checkDriverExists(); - return driver.getAllScientificCruise(programId); + return driver.getAllCruise(programId); } @Override - public ScientificCruise getScientificCruise(String id) { + public Cruise getCruise(String id) { checkDriverExists(); - return driver.getScientificCruise(id); + return driver.getCruise(id); } @Override - public ScientificCruise createScientificCruise(ScientificCruise bean) { + public Cruise createCruise(Cruise bean) { checkDriverExists(); - return driver.createScientificCruise(bean); + return driver.createCruise(bean); } @Override - public ScientificCruise saveScientificCruise(ScientificCruise bean) { + public Cruise saveCruise(Cruise bean) { checkDriverExists(); - return driver.saveScientificCruise(bean); + return driver.saveCruise(bean); } //------------------------------------------------------------------------// @@ -259,9 +259,9 @@ //------------------------------------------------------------------------// @Override - public List<FishingOperation> getAllFishingOperation(String scientificCruiseId) { + public List<FishingOperation> getAllFishingOperation(String cruiseId) { checkDriverExists(); - return driver.getAllFishingOperation(scientificCruiseId); + return driver.getAllFishingOperation(cruiseId); } @Override 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40) @@ -6,6 +6,7 @@ tutti.property.beaufortScale=Vent beaufort tutti.property.codeMemo=Code Memo tutti.property.country=Pays +tutti.property.cruise=Campagne tutti.property.date=Date tutti.property.firstName=Prénom tutti.property.fishingOperation=Trait @@ -14,7 +15,6 @@ tutti.property.lastName=Nom de Famille tutti.property.name=Nom tutti.property.program=Série de campagne -tutti.property.scientificCruise=Campagne tutti.property.seaState=État de la mer tutti.property.stationNumber=Numéro de station tutti.property.strata=Strate d'association Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -65,15 +65,15 @@ text: "tutti.action.selectCampaign"; toolTipText: "tutti.action.selectCampaign.tip"; mnemonic: S; - enabled: {model.getScreen() != TuttiScreen.SELECT_SCIENTIFIC_CRUISE}; - /*actionIcon: "scientificCruise";*/ + enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE}; + /*actionIcon: "cruise";*/ } #menuActionFillCatches { text: "tutti.action.fillCatches"; toolTipText: "tutti.action.fillCatches.tip"; mnemonic: C; - enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isScientificCruiseContextFilled()}; + enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isCruiseContextFilled()}; /*actionIcon: "catches";*/ } 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -25,15 +25,15 @@ */ import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.config.TuttiServiceConfigOption; import fr.ifremer.tutti.ui.swing.config.TuttiConfig; import fr.ifremer.tutti.ui.swing.config.TuttiConfigOption; -import fr.ifremer.tutti.ui.swing.content.campaign.EditScientificCruiseUI; -import fr.ifremer.tutti.ui.swing.content.campaign.EditProgramUI; -import fr.ifremer.tutti.ui.swing.content.campaign.SelectScientificCruiseUI; -import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI; +import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI; +import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.AboutPanel; @@ -82,7 +82,7 @@ public void propertyChange(PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if (propertyName.equals(TuttiUIContext.PROPERTY_PROGRAM_ID) || - propertyName.equals(TuttiUIContext.PROPERTY_SCIENTIFIC_CRUISE_ID)) { + propertyName.equals(TuttiUIContext.PROPERTY_CRUISE_ID)) { // change the ui title changeTitle(); @@ -111,14 +111,14 @@ TuttiScreen screen; - if (context.isScientificCruiseContextFilled()) { + if (context.isCruiseContextFilled()) { // direct fill catches screen screen = TuttiScreen.FILL_FISHING_OPERATION; } else { - // go to select scientificCruise screen - screen = TuttiScreen.SELECT_SCIENTIFIC_CRUISE; + // go to select cruise screen + screen = TuttiScreen.SELECT_CRUISE; } context.setScreen(screen); @@ -159,8 +159,8 @@ @Override public void run() { - if (TuttiScreen.SELECT_SCIENTIFIC_CRUISE == context.getScreen()) { - // Reselect home scientificCruise + if (TuttiScreen.SELECT_CRUISE == context.getScreen()) { + // Reselect home cruise // SelectCampaignUI homeUI = (SelectCampaignUI) currentBody; // homeUI.getHandler().selectCampaign(); } @@ -230,7 +230,7 @@ } public void showSelectCampaign() { - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); + context.setScreen(TuttiScreen.SELECT_CRUISE); } public void showFillCatches() { @@ -320,16 +320,16 @@ closeCurrentBody(); String surveyId = context.getProgramId(); - String campaignId = context.getScientificCruiseId(); + String campaignId = context.getCruiseId(); JComponent screenUI; String screenTitle; switch (screen) { default: - case SELECT_SCIENTIFIC_CRUISE: + case SELECT_CRUISE: - screenUI = new SelectScientificCruiseUI(context); + screenUI = new SelectCruiseUI(context); screenTitle = _("tutti.title.home"); break; @@ -344,15 +344,15 @@ screenUI = new EditProgramUI(context); break; - case EDIT_SCIENTIFIC_CRUISE: + case EDIT_CRUISE: if (campaignId == null) { - screenTitle = _("tutti.title.create.scientificCruise"); + screenTitle = _("tutti.title.create.cruise"); } else { - screenTitle = _("tutti.title.edit.scientificCruise"); + screenTitle = _("tutti.title.edit.cruise"); } - screenUI = new EditScientificCruiseUI(context); + screenUI = new EditCruiseUI(context); break; case FILL_FISHING_OPERATION: @@ -371,7 +371,7 @@ ErrorDialogUI.showError(e); // go back to home - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); + context.setScreen(TuttiScreen.SELECT_CRUISE); } finally { // free ui @@ -435,7 +435,7 @@ if (surveyId == null) { - // no program selected (so neither scientificCruise) + // no program selected (so neither cruise) title = _("tutti.title.noSelectedProgram"); @@ -447,22 +447,22 @@ title = _("tutti.title.selectedProgram", program.getName()) + " / "; - String campaignId = context.getScientificCruiseId(); + String campaignId = context.getCruiseId(); if (campaignId == null) { - // no selected scientificCruise + // no selected cruise - title += _("tutti.title.noSelectedScientificCruise"); + title += _("tutti.title.noSelectedCruise"); } else { - // selected scientificCruise - ScientificCruise scientificCruise; - scientificCruise = persistenceService.getScientificCruise(campaignId); + // selected cruise + Cruise cruise; + cruise = persistenceService.getCruise(campaignId); - title += _("tutti.title.selectedScientificCruise", scientificCruise.getName()); + title += _("tutti.title.selectedCruise", cruise.getName()); } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-11 14:19:11 UTC (rev 40) @@ -33,11 +33,11 @@ public enum TuttiScreen { /** - * To select program and scientificCruise. + * To select program and cruise. * * @since 0.1 */ - SELECT_SCIENTIFIC_CRUISE, + SELECT_CRUISE, /** * To edit a program. @@ -47,11 +47,11 @@ EDIT_PROGRAM, /** - * To edit a scientificCruise. + * To edit a cruise. * * @since 0.1 */ - EDIT_SCIENTIFIC_CRUISE, + EDIT_CRUISE, /** * To edit a protocol. 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-11 14:19:11 UTC (rev 40) @@ -26,7 +26,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Sets; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; +import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.Program; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.TuttiService; @@ -57,11 +57,11 @@ public static final String PROPERTY_PROGRAM_ID = "programId"; - public static final String PROPERTY_SCIENTIFIC_CRUISE_ID = "scientificCruiseId"; + public static final String PROPERTY_CRUISE_ID = "cruiseId"; public static final String PROPERTY_SCREEN = "screen"; - public static final String PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED = "scientificCruiseContextFilled"; + public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled"; /** * Application context (only one for all the application). @@ -99,11 +99,11 @@ protected String programId; /** - * Id of last selected scientificCruise (can be null if none ever selected). + * Id of last selected cruise (can be null if none ever selected). * * @since 0.1 */ - protected String scientificCruiseId; + protected String cruiseId; /** * Current screen displayed in ui. @@ -142,13 +142,13 @@ return programId; } - public String getScientificCruiseId() { - return scientificCruiseId; + public String getCruiseId() { + return cruiseId; } - public boolean isScientificCruiseContextFilled() { + public boolean isCruiseContextFilled() { return StringUtils.isNotBlank(programId) && - StringUtils.isNotBlank(scientificCruiseId); + StringUtils.isNotBlank(cruiseId); } public TuttiScreen getScreen() { @@ -156,25 +156,25 @@ } public void setProgramId(String programId) { - boolean oldValue = isScientificCruiseContextFilled(); + boolean oldValue = isCruiseContextFilled(); this.programId = programId; // always propagate the change firePropertyChange(PROPERTY_PROGRAM_ID, null, programId); - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED, - oldValue, isScientificCruiseContextFilled()); + firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED, + oldValue, isCruiseContextFilled()); } - public void setScientificCruiseId(String scientificCruiseId) { - boolean oldValue = isScientificCruiseContextFilled(); + public void setCruiseId(String cruiseId) { + boolean oldValue = isCruiseContextFilled(); - this.scientificCruiseId = scientificCruiseId; + this.cruiseId = cruiseId; // always propagate the change - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_ID, null, scientificCruiseId); - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED, - oldValue, isScientificCruiseContextFilled()); + firePropertyChange(PROPERTY_CRUISE_ID, null, cruiseId); + firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED, + oldValue, isCruiseContextFilled()); } public void setScreen(TuttiScreen screen) { @@ -191,10 +191,10 @@ setProgramId(getConfig().getProgramId()); } - if (scientificCruiseId == null) { + if (cruiseId == null) { // load it from config - setScientificCruiseId(getConfig().getScientificCruiseId()); + setCruiseId(getConfig().getCruiseId()); } //check if programId is sane @@ -208,7 +208,7 @@ // not found in this db setProgramId(null); - setScientificCruiseId(null); + setCruiseId(null); if (log.isWarnEnabled()) { log.warn("Remove invalid programId: " + programId); @@ -221,31 +221,31 @@ setProgramId(programId); - // test scientificCruiseId - if (scientificCruiseId != null) { + // test cruiseId + if (cruiseId != null) { - ScientificCruise campaign = - persistenceService.getScientificCruise(scientificCruiseId); + Cruise campaign = + persistenceService.getCruise(cruiseId); if (campaign != null && !campaign.getProgram().getId().equals(programId)) { - // not matchin program, reset scientificCruise id + // not matchin program, reset cruise id campaign = null; } if (campaign == null) { // not found in this db - setScientificCruiseId(null); + setCruiseId(null); if (log.isWarnEnabled()) { - log.warn("Remove invalid scientificCruiseId: " + scientificCruiseId); + log.warn("Remove invalid cruiseId: " + cruiseId); } } else { if (log.isInfoEnabled()) { - log.info("ScientificCruiseId valid: " + scientificCruiseId); + log.info("CruiseId valid: " + cruiseId); } } } @@ -259,7 +259,7 @@ addPropertyChangeListener(new PropertyChangeListener() { Set<String> acceptedProperties = Sets.newHashSet( - PROPERTY_PROGRAM_ID, PROPERTY_SCIENTIFIC_CRUISE_ID); + PROPERTY_PROGRAM_ID, PROPERTY_CRUISE_ID); @Override public void propertyChange(PropertyChangeEvent evt) { @@ -276,7 +276,7 @@ // Clear data references programId = null; - scientificCruiseId = null; + cruiseId = null; IOUtils.closeQuietly(serviceContext); @@ -292,11 +292,11 @@ protected void saveContextToConfig() { if (log.isInfoEnabled()) { - log.info("Save config (programId: " + programId + ", scientificCruiseId: " + - scientificCruiseId + ")"); + log.info("Save config (programId: " + programId + ", cruiseId: " + + cruiseId + ")"); } config.setProgramId(programId); - config.setScientificCruiseId(scientificCruiseId); + config.setCruiseId(cruiseId); config.save(); } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-11 14:19:11 UTC (rev 40) @@ -126,8 +126,8 @@ return applicationConfig.getOption(TuttiConfigOption.PROGRAM_ID.getKey()); } - public String getScientificCruiseId() { - return applicationConfig.getOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey()); + public String getCruiseId() { + return applicationConfig.getOption(TuttiConfigOption.CRUISE_ID.getKey()); } public KeyStroke getShortCut(String actionName) { @@ -173,13 +173,13 @@ } - public void setScientificCruiseId(String scientificCruiseId) { - if (scientificCruiseId == null) { + public void setCruiseId(String cruiseId) { + if (cruiseId == null) { Properties options = applicationConfig.getOptions(); - options.remove(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey()); + options.remove(TuttiConfigOption.CRUISE_ID.getKey()); applicationConfig.setOptions(options); } else { - applicationConfig.setOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey(), scientificCruiseId); + applicationConfig.setOption(TuttiConfigOption.CRUISE_ID.getKey(), cruiseId); } } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-11 14:19:11 UTC (rev 40) @@ -48,8 +48,8 @@ null, String.class ), - SCIENTIFIC_CRUISE_ID("tutti.scientificCruiseId", - n_("tutti.config.scientificCruiseId"), + CRUISE_ID("tutti.cruiseId", + n_("tutti.config.cruiseId"), null, String.class ), Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -1,94 +0,0 @@ -/* - * #%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% - */ - -BeanComboBox { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; -} - -#splitPane { - orientation: {JSplitPane.VERTICAL_SPLIT}; - resizeWeight: 0.3; - oneTouchExpandable: true; - continuousLayout: true; -} - -#form { - border: {BorderFactory.createTitledBorder((String)null)}; -} - -#nameLabel { - text: "tutti.label.program.name"; - labelFor: {nameField}; -} - -#nameField { - text: {model.getName()}; -} - -#commentPane { - columnHeaderView: {new JLabel(_("tutti.label.comment"))}; - minimumSize: {new Dimension(10,50)}; -} - -#commentField { - text: {getStringValue(model.getComment())}; -} - -#zoneLabel { - text: "tutti.label.program.zone"; - labelFor: {zoneComboBox}; -} - -#zoneComboBox { - property: "zone"; - selectedItem: {model.getZone()}; -} - -#saveButton { - text: "tutti.action.save"; - enabled: {model.isModify() && model.isValid()}; - actionIcon: "save"; -} - -#cancelButton { - text: "tutti.action.cancel"; - actionIcon: "cancel"; -} - -#messagePanel { - border: {BorderFactory.createTitledBorder("Messages")}; - height: 200; - width: 500; -} - -#errorTable { - rowSelectionAllowed: true; - autoCreateRowSorter: true; - autoResizeMode: 2; - cellSelectionEnabled: false; - selectionMode: 0; - model: {errorTableModel}; -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -1,125 +0,0 @@ -<!-- - #%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<EditProgramUIModel, EditProgramUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.referential.Zone - fr.ifremer.tutti.ui.swing.TuttiUIContext - - jaxx.runtime.swing.editor.bean.BeanComboBox - jaxx.runtime.validator.swing.SwingValidatorUtil - jaxx.runtime.validator.swing.SwingValidatorMessageTableModel - - java.awt.Dimension - - static org.nuiton.i18n.I18n._ - static jaxx.runtime.SwingUtil.getStringValue - - </import> - - <script><![CDATA[ - - public EditProgramUI(TuttiUIContext context) { - EditProgramUIHandler handler = new EditProgramUIHandler(context, this); - setContextValue(handler); - handler.beforeInitUI(); - } - - protected void $afterCompleteSetup() { - handler.afterInitUI(); - } - ]]></script> - - <EditProgramUIHandler id='handler' - initializer='getContextValue(EditProgramUIHandler.class)'/> - - <EditProgramUIModel id='model' - initializer='getContextValue(EditProgramUIModel.class)'/> - - <SwingValidatorMessageTableModel id='errorTableModel'/> - - <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' - uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='name' component='nameField'/> - <field name='zone' component='zoneComboBox'/> - <field name='comment' component='commentField'/> - </BeanValidator> - - <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> - - <Table id='form' fill='both'> - - <!-- program name --> - <row> - <cell anchor='west'> - <JLabel id='nameLabel'/> - </cell> - <cell weightx='1.0'> - <JTextField id='nameField' - onKeyReleased='handler.setText(event, "name")'/> - </cell> - </row> - - <!-- program zone --> - <row> - <cell> - <JLabel id='zoneLabel'/> - </cell> - <cell> - <BeanComboBox id='zoneComboBox' constructorParams='this' - genericType='Zone'/> - </cell> - </row> - - <!-- program comment --> - <row weighty='0.8'> - <cell columns='2'> - <JScrollPane id='commentPane' - onFocusGained='commentField.requestFocus()'> - <JTextArea id='commentField' - onKeyReleased='handler.setText(event, "comment")'/> - </JScrollPane> - </cell> - </row> - - <!-- actions --> - <row anchor='south'> - <cell columns='2'> - <JPanel layout='{new GridLayout(1, 0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='saveButton' onActionPerformed='handler.save()'/> - </JPanel> - </cell> - </row> - </Table> - - <!-- validation messages --> - <JPanel id='messagePanel' layout='{new GridLayout()}'> - <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> - <JTable id='errorTable' /> - </JScrollPane> - </JPanel> - </JSplitPane> -</JPanel> \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,135 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.Program; -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; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; -import jaxx.runtime.validator.swing.SwingValidatorUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Handler of UI {@link EditProgramUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(EditProgramUIHandler.class); - - private final EditProgramUI ui; - - private final PersistenceService persistenceService; - - public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) { - super(context); - this.ui = ui; - persistenceService = context.getService(PersistenceService.class); - } - - @Override - public void beforeInitUI() { - - EditProgramUIModel model = new EditProgramUIModel(); - - String surveyId = context.getProgramId(); - if (surveyId == null) { - - if (log.isInfoEnabled()) { - log.info("Edit new program"); - } - } else { - - if (log.isInfoEnabled()) { - log.info("Edit existing program " + surveyId); - } - // load existing program - Program program = persistenceService.getProgram(surveyId); - - model.fromBean(program); - } - - listModelIsModify(model); - - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - - EditProgramUIModel model = ui.getModel(); - initBeanComboBox(ui.getZoneComboBox(), - persistenceService.getAllZone(), - model.getZone()); - - SwingValidatorUtil.installUI(ui.getErrorTable(), - new SwingValidatorMessageTableRenderer()); - - listenValidatorValid(ui.getValidator(), model); - - // if new program can already cancel his creation - model.setModify(model.isCreate()); - } - - @Override - public void onCloseUI() { - ui.getValidator().setBean(null); - } - - @Override - protected EditProgramUIModel getModel() { - return ui.getModel(); - } - - public void cancel() { - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); - } - - public void save() { - - EditProgramUIModel model = ui.getModel(); - - Program bean = model.toBean(); - - Program saved; - if (TuttiEntities.isNew(bean)) { - - saved = persistenceService.createProgram(bean); - } else { - saved = persistenceService.saveProgram(bean); - } - - context.setProgramId(saved.getId()); - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,97 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.Program; -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; - -/** - * Bean to edit a program. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> { - - 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 Zone zone; - - protected static Binder<EditProgramUIModel, Program> toBeanBinder = - BinderFactory.newBinder(EditProgramUIModel.class, - Program.class); - - protected static Binder<Program, EditProgramUIModel> fromBeanBinder = - BinderFactory.newBinder(Program.class, EditProgramUIModel.class); - - - public EditProgramUIModel() { - super(Program.class, fromBeanBinder, toBeanBinder); - } - - public String getName() { - return name; - } - - public void setName(String name) { - Object oldValue = getName(); - this.name = name; - firePropertyChange(PROPERTY_NAME, oldValue, name); - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - Object oldValue = getComment(); - this.comment = comment; - firePropertyChange(PROPERTY_COMMENT, oldValue, comment); - } - - public Zone getZone() { - return zone; - } - - public void setZone(Zone zone) { - Object oldValue = getZone(); - this.zone = zone; - firePropertyChange(PROPERTY_ZONE, oldValue, zone); - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -1,223 +0,0 @@ -/* - * #%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% - */ - -JToolBar { - floatable: false; -} - -BeanComboBox { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; -} - -BeanListHeader { - showReset: true; - i18nPrefix: "tutti.property."; -} - -JList { - selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; - model: {new DefaultListModel()}; -} - -NumberEditor { - autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; - showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; - bean: {model}; - showReset: true; -} - -#splitPane { - orientation: {JSplitPane.VERTICAL_SPLIT}; - resizeWeight: 0.3; - oneTouchExpandable: true; - continuousLayout: true; -} - -#nameLabel { - text: "tutti.label.scientificCruise.name"; - labelFor: {nameField}; -} - -#nameField { - text: {model.getName()}; -} - -#yearLabel { - text: "tutti.label.scientificCruise.year"; - labelFor: {yearField}; -} - -#yearField { - property: "year"; - model: {model.getYear()}; - useFloat: false; - numberPattern: {INT_4_DIGITS_PATTERN}; -} - -#surveyPartLabel { - text: "tutti.label.scientificCruise.surveyPart"; - labelFor: {surveyPartField}; -} - -#surveyPartField { - text: {model.getSurveyPart()}; -} - -#countryLabel { - text: "tutti.label.scientificCruise.country"; - labelFor: {countryComboBox}; -} - -#countryComboBox { - property: "country"; - selectedItem: {model.getCountry()}; -} - -#programLabel { - text: "tutti.label.scientificCruise.program"; - labelFor: {surveyComboBox}; -} - -#surveyComboBox { - property: "program"; - selectedItem: {model.getProgram()}; -} - -#beginDateLabel { - text: "tutti.label.scientificCruise.beginDate"; - labelFor: {beginDateField}; -} - -#beginDateField { - date: {model.getBeginDate()}; - formats: {"dd/MM/yyyy"}; -} - -#endDateLabel { - text: "tutti.label.scientificCruise.endDate"; - labelFor: {endDateField}; -} - -#endDateField { - date: {model.getEndDate()}; - formats: {"dd/MM/yyyy"}; -} - -#pocheLabel { - text: "tutti.label.scientificCruise.poche"; - labelFor: {pocheField}; -} - -#pocheField { - property: "poche"; - model: {model.getPoche()}; - useFloat: false; - numberPattern: {INT_1_DIGITS_PATTERN}; -} - -#vesselPane { - horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#vesselHeader { - labelText: {_("tutti.label.list.vessel")}; - list: {vesselList}; - beanType: {Vessel.class}; -} - -#gearPane { - horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#gearHeader { - labelText: {_("tutti.label.list.gear")}; - list: {gearList}; - beanType: {Gear.class}; -} - -#headOfMissionPane { - horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#headOfMissionHeader { - labelText: {_("tutti.label.list.headOfMission")}; - list: {headOfMissionList}; - beanType: {Person.class}; -} - -#headOfSortRoomPane { - horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#headOfSortRoomHeader { - labelText: {_("tutti.label.list.headOfSortRoom")}; - list: {headOfSortRoomList}; - beanType: {Person.class}; -} - -#commentPane { - columnHeaderView: {new JLabel(_("tutti.label.comment"))}; - minimumSize: {new Dimension(10,50)}; -} - -#commentField { - text: {model.getComment()}; -} - -#saveButton { - actionIcon: "save"; - text: "tutti.action.save"; - enabled: {model.isModify() && model.isValid()}; -} - -#cancelButton { - actionIcon: "cancel"; - text: "tutti.action.cancel"; -} - -#generateNameButton { - actionIcon: "generate"; - text: "tutti.action.generateCampaignName"; - enabled: {model.isCanGenerateName()}; -} -#messagePanel { - border: {BorderFactory.createTitledBorder("Messages")}; - height: 200; - width: 500; -} - -#errorTable { - rowSelectionAllowed: true; - autoCreateRowSorter: true; - autoResizeMode: 2; - cellSelectionEnabled: false; - selectionMode: 0; - model: {errorTableModel}; -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -1,238 +0,0 @@ -<!-- - #%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<EditScientificCruiseUIModel, EditScientificCruiseUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.data.Program - fr.ifremer.tutti.persistence.entities.referential.Country - fr.ifremer.tutti.persistence.entities.referential.Gear - fr.ifremer.tutti.persistence.entities.referential.Person - fr.ifremer.tutti.persistence.entities.referential.Vessel - fr.ifremer.tutti.ui.swing.TuttiUIContext - - jaxx.runtime.swing.editor.NumberEditor - jaxx.runtime.swing.editor.bean.BeanComboBox - jaxx.runtime.swing.editor.bean.BeanListHeader - - jaxx.runtime.validator.swing.SwingValidatorUtil - jaxx.runtime.validator.swing.SwingValidatorMessageTableModel - - org.jdesktop.swingx.JXDatePicker - - javax.swing.DefaultListModel - javax.swing.ListSelectionModel - - java.awt.Dimension - - static org.nuiton.i18n.I18n._ - static jaxx.runtime.SwingUtil.getStringValue - </import> - - <script><![CDATA[ - - public EditScientificCruiseUI(TuttiUIContext context) { - EditScientificCruiseUIHandler handler = new EditScientificCruiseUIHandler(context, this); - setContextValue(handler); - handler.beforeInitUI(); - } - - protected void $afterCompleteSetup() { - handler.afterInitUI(); - } - ]]></script> - - <EditScientificCruiseUIHandler id='handler' - initializer='getContextValue(EditScientificCruiseUIHandler.class)'/> - - <EditScientificCruiseUIModel id='model' - initializer='getContextValue(EditScientificCruiseUIModel.class)'/> - - <SwingValidatorMessageTableModel id='errorTableModel'/> - - <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' - uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='program' component='surveyComboBox'/> - <field name='year' component='yearField'/> - <field name='surveyPart' component='surveyPartField'/> - <field name='name' component='nameField'/> - <field name='poche' component='pocheField'/> - <field name='country' component='countryComboBox'/> - <field name='beginDate' component='beginDateField'/> - <field name='endDate' component='endDateField'/> - <field name='vessel' component='vesselPane'/> - <field name='gear' component='gearPane'/> - <field name='headOfMission' component='headOfMissionPane'/> - <field name='headOfSortRoom' component='headOfSortRoomPane'/> - <field name='comment' component='commentField'/> - </BeanValidator> - - <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> - <Table fill='both'> - - <!-- scientificCruise program / year /program part / name --> - <row> - <cell anchor='west'> - <JLabel id='programLabel'/> - </cell> - <cell weightx='0.3'> - <BeanComboBox id='surveyComboBox' constructorParams='this' - genericType='Program'/> - </cell> - <cell anchor='west'> - <JLabel id='yearLabel'/> - </cell> - <cell weightx='0.3'> - <NumberEditor id='yearField' constructorParams='this'/> - </cell> - <cell> - <JLabel id='surveyPartLabel'/> - </cell> - <cell weightx='0.3'> - <JTextField id='surveyPartField' - onKeyReleased='handler.setText(event, "surveyPart")'/> - </cell> - </row> - - <!-- scientificCruise name --> - <row> - <cell> - <JLabel id='nameLabel'/> - </cell> - <cell weightx='0.3'> - <JTextField id='nameField' - onKeyReleased='handler.setText(event, "name")'/> - </cell> - <cell columns='2'> - <JButton id='generateNameButton' - onActionPerformed='handler.generateCampaignName()'/> - </cell> - <cell> - <JLabel id='pocheLabel'/> - </cell> - <cell weightx='0.3'> - <NumberEditor id='pocheField' constructorParams='this'/> - </cell> - </row> - - <!-- scientificCruise country / begin date / end date --> - <row> - <cell> - <JLabel id='countryLabel'/> - </cell> - <cell weightx='0.3'> - <BeanComboBox id='countryComboBox' constructorParams='this' - genericType='Country'/> - </cell> - <cell> - <JLabel id='beginDateLabel'/> - </cell> - <cell weightx='0.3'> - <JXDatePicker id='beginDateField' - onActionPerformed='handler.setDate(event, "beginDate")'/> - </cell> - <cell> - <JLabel id='endDateLabel'/> - </cell> - <cell weightx='0.3'> - <JXDatePicker id='endDateField' - onActionPerformed='handler.setDate(event, "endDate")'/> - </cell> - </row> - - <!-- scientificCruise vessel / gear --> - <row weighty='0.3'> - <cell columns='6'> - <JPanel layout='{new GridLayout(1, 0)}'> - <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}" - onFocusGained='vesselList.requestFocus()'> - <JList id='vesselList' - onValueChanged='handler.selectListData(event, "vessel")'/> - <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='Gear'/> - </JScrollPane> - </JPanel> - </cell> - </row> - - <!-- scientificCruise headOfMission / headOfSortRoom --> - <row weighty='0.3'> - <cell columns='6'> - <JPanel layout='{new GridLayout(1, 0)}'> - - <JScrollPane id='headOfMissionPane' - columnHeaderView="{headOfMissionHeader}" - onFocusGained='headOfMissionList.requestFocus()'> - <JList id='headOfMissionList' - onValueChanged='handler.selectListData(event, "headOfMission")'/> - <BeanListHeader id='headOfMissionHeader' - genericType='Person'/> - </JScrollPane> - <JScrollPane id='headOfSortRoomPane' - columnHeaderView="{headOfSortRoomHeader}" - onFocusGained='headOfSortRoomList.requestFocus()'> - <JList id='headOfSortRoomList' - onValueChanged='handler.selectListData(event, "headOfSortRoom")'/> - <BeanListHeader id='headOfSortRoomHeader' - genericType='Person'/> - </JScrollPane> - </JPanel> - </cell> - </row> - - <!-- scientificCruise comment --> - <row weighty='0.3'> - <cell columns='6'> - <JScrollPane id='commentPane' - onFocusGained='commentField.requestFocus()'> - <JTextArea id='commentField' - onKeyReleased='handler.setText(event, "comment")'/> - </JScrollPane> - </cell> - </row> - - <!-- Form Actions --> - <row> - <cell columns='6'> - <JPanel layout='{new GridLayout(1, 0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='saveButton' onActionPerformed='handler.save()'/> - </JPanel> - </cell> - </row> - </Table> - - <JPanel id='messagePanel' layout='{new GridLayout()}'> - <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> - <JTable id='errorTable' /> - </JScrollPane> - </JPanel> - </JSplitPane> - -</JPanel> \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,176 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.TuttiEntities; -import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; -import fr.ifremer.tutti.persistence.entities.referential.Person; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.TuttiScreen; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; -import jaxx.runtime.validator.swing.SwingValidatorUtil; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; - -/** - * Handler of UI {@link EditScientificCruiseUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class EditScientificCruiseUIHandler extends AbstractTuttiUIHandler<EditScientificCruiseUIModel> { - - private final EditScientificCruiseUI ui; - - private final PersistenceService persistenceService; - - public EditScientificCruiseUIHandler(TuttiUIContext context, EditScientificCruiseUI ui) { - super(context); - this.ui = ui; - persistenceService = context.getService(PersistenceService.class); - } - - @Override - public void beforeInitUI() { - - EditScientificCruiseUIModel model = new EditScientificCruiseUIModel(); - - String campaignId = context.getScientificCruiseId(); - if (campaignId == null) { - - // create new scientificCruise - Program program = - persistenceService.getProgram(context.getProgramId()); - model.setProgram(program); - model.setPoche(1); - } else { - - // load existing program - ScientificCruise scientificCruise = - persistenceService.getScientificCruise(campaignId); - - model.fromBean(scientificCruise); - } - listModelIsModify(model); - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - - initUI(ui); - - List<Person> users = persistenceService.getAllPerson(); - - EditScientificCruiseUIModel model = ui.getModel(); - - initBeanComboBox(ui.getSurveyComboBox(), - persistenceService.getAllProgram(), - model.getProgram()); - - initBeanComboBox(ui.getCountryComboBox(), - persistenceService.getAllCountry(), - model.getCountry()); - - initBeanList(ui.getVesselHeader(), - persistenceService.getAllVessel(), - model.getVessel()); - - initBeanList(ui.getGearHeader(), - persistenceService.getAllGear(), - model.getGear()); - - initBeanList(ui.getHeadOfMissionHeader(), - users, - model.getHeadOfMission()); - - initBeanList(ui.getHeadOfSortRoomHeader(), - users, - model.getHeadOfSortRoom()); - - SwingValidatorUtil.installUI(ui.getErrorTable(), - new SwingValidatorMessageTableRenderer()); - - listenValidatorValid(ui.getValidator(), model); - - // if new fishingOperation can already cancel his creation - model.setModify(model.isCreate()); - } - - @Override - public void onCloseUI() { - } - - @Override - protected EditScientificCruiseUIModel getModel() { - return ui.getModel(); - } - - public void cancel() { - - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); - } - - public void save() { - - EditScientificCruiseUIModel model = ui.getModel(); - - ScientificCruise bean = model.toBean(); - - ScientificCruise saved; - if (TuttiEntities.isNew(bean)) { - - saved = persistenceService.createScientificCruise(bean); - } else { - saved = persistenceService.saveScientificCruise(bean); - } - - context.setProgramId(saved.getProgram().getId()); - context.setScientificCruiseId(saved.getId()); - - context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE); - } - - public static final String scientificCruiseNameFormat = "%1$s_%2$s"; - - public void generateCampaignName() { - - EditScientificCruiseUIModel model = getModel(); - Program program = model.getProgram(); - Integer year = model.getYear(); - String name = String.format(scientificCruiseNameFormat, program.getName(), year); - - String surveyPart = model.getSurveyPart(); - if (StringUtils.isNotEmpty(surveyPart)) { - name += "_" + surveyPart; - } - model.setName(name); - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,247 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; -import fr.ifremer.tutti.persistence.entities.referential.Country; -import fr.ifremer.tutti.persistence.entities.referential.Gear; -import fr.ifremer.tutti.persistence.entities.referential.Person; -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.Date; -import java.util.List; - -/** - * Model of UI {@link EditScientificCruiseUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class EditScientificCruiseUIModel extends AbstractTuttiBeanUIModel<ScientificCruise, EditScientificCruiseUIModel> { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_PROGRAM = "program"; - - 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"; - - public static final String PROPERTY_YEAR = "year"; - - public static final String PROPERTY_POCHE = "poche"; - - public static final String PROPERTY_BEGIN_DATE = "beginDate"; - - public static final String PROPERTY_END_DATE = "endDate"; - - public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName"; - - protected Program program; - - protected Country country; - - protected String name; - - protected String surveyPart; - - protected List<Vessel> vessel; - - protected List<Gear> gear; - - protected List<Person> headOfMission; - - protected List<Person> headOfSortRoom; - - protected String comment; - - protected Integer year; - - protected Integer poche; - - protected Date beginDate; - - protected Date endDate; - - protected static Binder<EditScientificCruiseUIModel, ScientificCruise> toBeanBinder = - BinderFactory.newBinder(EditScientificCruiseUIModel.class, - ScientificCruise.class); - - protected static Binder<ScientificCruise, EditScientificCruiseUIModel> fromBeanBinder = - BinderFactory.newBinder(ScientificCruise.class, EditScientificCruiseUIModel.class); - - public EditScientificCruiseUIModel() { - super(ScientificCruise.class, fromBeanBinder, toBeanBinder); - } - - public Program getProgram() { - return program; - } - - public void setProgram(Program program) { - Object oldValue = getProgram(); - this.program = program; - firePropertyChange(PROPERTY_PROGRAM, oldValue, program); - firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName()); - } - - public String getName() { - return name; - } - - public void setName(String name) { - Object oldValue = getName(); - this.name = name; - firePropertyChange(PROPERTY_NAME, oldValue, name); - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - Object oldValue = getComment(); - this.comment = comment; - firePropertyChange(PROPERTY_COMMENT, oldValue, comment); - } - - public Country getCountry() { - return country; - } - - public void setCountry(Country country) { - Object oldValue = getCountry(); - this.country = country; - firePropertyChange(PROPERTY_COUNTRY, oldValue, country); - } - - public String getSurveyPart() { - return surveyPart; - } - - public void setSurveyPart(String surveyPart) { - Object oldValue = getSurveyPart(); - this.surveyPart = surveyPart; - firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart); - } - - public Integer getYear() { - return year; - } - - public void setYear(Integer year) { - Object oldValue = getYear(); - this.year = year; - firePropertyChange(PROPERTY_YEAR, oldValue, year); - firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName()); - } - - public Integer getPoche() { - return poche; - } - - public void setPoche(Integer poche) { - Object oldValue = getPoche(); - this.poche = poche; - firePropertyChange(PROPERTY_POCHE, oldValue, poche); - } - - public Date getBeginDate() { - return beginDate; - } - - public void setBeginDate(Date beginDate) { - Object oldValue = getBeginDate(); - this.beginDate = beginDate; - firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate); - } - - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - Object oldValue = getEndDate(); - this.endDate = endDate; - firePropertyChange(PROPERTY_END_DATE, oldValue, endDate); - } - - public List<Vessel> getVessel() { - return vessel; - } - - public void setVessel(List<Vessel> vessel) { - this.vessel = vessel; - firePropertyChange(PROPERTY_VESSEL, null, vessel); - } - - public List<Gear> getGear() { - return gear; - } - - public void setGear(List<Gear> gear) { - this.gear = gear; - firePropertyChange(PROPERTY_GEAR, null, gear); - } - - public List<Person> getHeadOfMission() { - return headOfMission; - } - - public void setHeadOfMission(List<Person> headOfMission) { - this.headOfMission = headOfMission; - firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission); - } - - public List<Person> getHeadOfSortRoom() { - return headOfSortRoom; - } - - public void setHeadOfSortRoom(List<Person> headOfSortRoom) { - this.headOfSortRoom = headOfSortRoom; - firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom); - } - - public boolean isCanGenerateName() { - return program != null && year != null; - } - -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -1,77 +0,0 @@ -/* - * #%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% - */ - -BeanComboBox { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; -} - -#programLabel { - text: "tutti.label.program"; -} - -#programCombobox { - property: "program"; - selectedItem: {model.getProgram()}; -} - -#editProgramButton { - enabled: {model.isProgramFound()}; - text: "tutti.action.edit"; - actionIcon: "edit"; -} - -#newProgramButton { - text: "tutti.action.new"; - actionIcon: "add"; -} - -#scientificCruiseLabel { - text: "tutti.label.scientificCruise"; - labelFor: {scientificCruiseCombobox}; -} - -#scientificCruiseCombobox { - property: "scientificCruise"; - enabled: {model.isProgramFound()}; - selectedItem: {model.getScientificCruise()}; -} - -#editScientificCruiseButton { - enabled: {model.isProgramFound() && model.isScientificCruiseFound()}; - text: "tutti.action.edit"; - actionIcon: "edit"; -} - -#newScientificCruiseButton { - actionIcon: "add"; - enabled: {model.isProgramFound()}; - text: "tutti.action.new"; -} - -#showFishingOperationsButton { - text: "tutti.action.catches"; - enabled: {uiContext.isScientificCruiseContextFilled()}; -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -1,102 +0,0 @@ -<!-- - #%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<SelectScientificCruiseUIModel, SelectScientificCruiseUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.data.Program - fr.ifremer.tutti.persistence.entities.data.ScientificCruise - fr.ifremer.tutti.ui.swing.TuttiUIContext - - jaxx.runtime.swing.editor.bean.BeanComboBox - - static org.nuiton.i18n.I18n._ - </import> - - <script><![CDATA[ - - protected TuttiUIContext uiContext; - - public SelectScientificCruiseUI(TuttiUIContext context) { - this.uiContext = context; - SelectScientificCruiseUIHandler handler = - new SelectScientificCruiseUIHandler(context, this); - setContextValue(handler); - handler.beforeInitUI(); - } - - protected void $afterCompleteSetup() { - handler.afterInitUI(); - } - ]]></script> - - <SelectScientificCruiseUIHandler id='handler' - initializer='getContextValue(SelectScientificCruiseUIHandler.class)'/> - - <SelectScientificCruiseUIModel id='model' - initializer='getContextValue(SelectScientificCruiseUIModel.class)'/> - - <Table fill='both' constraints='BorderLayout.CENTER'> - <row> - <cell anchor='west'> - <JLabel id='programLabel'/> - </cell> - <cell weightx='1.0'> - <BeanComboBox id='programCombobox' constructorParams='this' - genericType='Program'/> - </cell> - <cell> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='editProgramButton' - onActionPerformed='handler.showSelectedProgram()'/> - <JButton id='newProgramButton' - onActionPerformed='handler.showNewProgram()'/> - </JPanel> - </cell> - </row> - <row> - <cell> - <JLabel id='scientificCruiseLabel'/> - </cell> - <cell> - <BeanComboBox id='scientificCruiseCombobox' constructorParams='this' - genericType='ScientificCruise'/> - </cell> - <cell> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='editScientificCruiseButton' - onActionPerformed='handler.showSelectedScientificCruise()'/> - <JButton id='newScientificCruiseButton' - onActionPerformed='handler.showNewScientificCruise()'/> - </JPanel> - </cell> - </row> - <row> - <cell columns='3'> - <JButton id='showFishingOperationsButton' - onActionPerformed='handler.showFishingOperations()'/> - </cell> - </row> - </Table> -</JPanel> Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,204 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.TuttiEntities; -import fr.ifremer.tutti.persistence.entities.data.Program; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.TuttiScreen; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import jaxx.runtime.swing.editor.bean.BeanComboBox; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -/** - * Main ui content to select scientificCruise. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SelectScientificCruiseUIHandler extends AbstractTuttiUIHandler<SelectScientificCruiseUIModel> { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(SelectScientificCruiseUIHandler.class); - - protected final PersistenceService persistenceService; - - protected final SelectScientificCruiseUI ui; - - public SelectScientificCruiseUIHandler(TuttiUIContext context, SelectScientificCruiseUI ui) { - super(context); - this.ui = ui; - persistenceService = context.getService(PersistenceService.class); - } - - @Override - protected SelectScientificCruiseUIModel getModel() { - return ui.getModel(); - } - - @Override - public void beforeInitUI() { - SelectScientificCruiseUIModel model = new SelectScientificCruiseUIModel(); - - List<Program> allPrograms = persistenceService.getAllProgram(); - - model.setPrograms(allPrograms); - - if (allPrograms.isEmpty()) { - // do nothing - - if (log.isDebugEnabled()) { - log.debug("No program found."); - } - } else { - - // get selected program (if any) - - String surveyId = context.getProgramId(); - Program selectedProgram = null; - List<ScientificCruise> allScientificCruises = null; - if (surveyId != null) { - selectedProgram = TuttiEntities.findById(allPrograms, surveyId); - allScientificCruises = persistenceService.getAllScientificCruise(surveyId); - } - - model.setProgram(selectedProgram); - model.setScientificCruises(allScientificCruises); - - if (CollectionUtils.isEmpty(allScientificCruises)) { - - // nothing to select - } else { - String campaignId = context.getScientificCruiseId(); - - ScientificCruise selectedCampaign = null; - if (campaignId != null) { - selectedCampaign = - TuttiEntities.findById(allScientificCruises, campaignId); - } - model.setScientificCruise(selectedCampaign); - } - } - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - - SelectScientificCruiseUIModel model = ui.getModel(); - - initBeanComboBox(ui.getProgramCombobox(), - model.getPrograms(), - model.getProgram()); - - initBeanComboBox(ui.getScientificCruiseCombobox(), - model.getScientificCruises(), - model.getScientificCruise()); - - model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Program newValue = (Program) evt.getNewValue(); - boolean noSurvey = newValue == null; - context.setProgramId(noSurvey ? null : newValue.getId()); - List<ScientificCruise> campaigns; - if (noSurvey) { - campaigns = Lists.newArrayList(); - } else { - campaigns = persistenceService.getAllScientificCruise(newValue.getId()); - } - SelectScientificCruiseUIModel model = (SelectScientificCruiseUIModel) evt.getSource(); - model.setScientificCruises(campaigns); - model.setScientificCruise(null); - } - }); - - model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISES, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - // reload combo box - BeanComboBox<ScientificCruise> combobox = ui.getScientificCruiseCombobox(); - List<ScientificCruise> campaigns = (List<ScientificCruise>) evt.getNewValue(); - combobox.setData(null); - combobox.setData(campaigns); - } - }); - - model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISE, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - ScientificCruise newValue = (ScientificCruise) evt.getNewValue(); - context.setScientificCruiseId(newValue == null ? null : newValue.getId()); - } - }); - } - - @Override - public void onCloseUI() { - PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners(); - for (PropertyChangeListener listener : listeners) { - getModel().removePropertyChangeListener(listener); - } - } - - public void showFishingOperations() { - - context.setScreen(TuttiScreen.FILL_FISHING_OPERATION); - } - - public void showSelectedProgram() { - - Program program = getModel().getProgram(); - context.setProgramId(program.getId()); - context.setScreen(TuttiScreen.EDIT_PROGRAM); - } - - public void showNewProgram() { - context.setProgramId(null); - context.setScientificCruiseId(null); - context.setScreen(TuttiScreen.EDIT_PROGRAM); - } - - public void showSelectedScientificCruise() { - ScientificCruise scientificCruise = getModel().getScientificCruise(); - context.setScientificCruiseId(scientificCruise.getId()); - context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE); - } - - public void showNewScientificCruise() { - context.setScientificCruiseId(null); - context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE); - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,123 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.campaign; - -/* - * #%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.ScientificCruise; -import fr.ifremer.tutti.persistence.entities.data.Program; -import org.jdesktop.beans.AbstractSerializableBean; - -import java.util.List; - -/** - * Model of ui {@link SelectScientificCruiseUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class SelectScientificCruiseUIModel extends AbstractSerializableBean { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_PROGRAMS = "programs"; - - public static final String PROPERTY_PROGRAM = "program"; - - public static final String PROPERTY_SCIENTIFIC_CRUISES = "scientificCruises"; - - public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise"; - - public static final String PROPERTY_PROGRAM_FOUND = "programFound"; - - public static final String PROPERTY_SCIENTIFIC_CRUISE_FOUND = "scientificCruiseFound"; - - protected List<Program> programs; - - protected Program program; - - protected List<ScientificCruise> scientificCruises; - - protected ScientificCruise scientificCruise; - - public List<Program> getPrograms() { - return programs; - } - - public void setPrograms(List<Program> programs) { - Object oldValue = getPrograms(); - this.programs = programs; - - // nullify program -// setProgram(null); - firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs); - } - - public Program getProgram() { - return program; - } - - public void setProgram(Program program) { - Program oldValue = getProgram(); - this.program = program; - - // nullify scientificCruises -// setScientificCruises(null); - - firePropertyChange(PROPERTY_PROGRAM, oldValue, program); - firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null); - } - - public boolean isProgramFound() { - return program != null; - } - - public List<ScientificCruise> getScientificCruises() { - return scientificCruises; - } - - public void setScientificCruises(List<ScientificCruise> scientificCruises) { - Object oldValue = getScientificCruises(); - this.scientificCruises = scientificCruises; - - // nullify scientificCruise -// setScientificCruise(null); - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISES, oldValue, scientificCruises); - } - - public ScientificCruise getScientificCruise() { - return scientificCruise; - } - - public void setScientificCruise(ScientificCruise scientificCruise) { - ScientificCruise oldValue = getScientificCruise(); - this.scientificCruise = scientificCruise; - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise); - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_FOUND, oldValue != null, scientificCruise != null); - } - - public boolean isScientificCruiseFound() { - return scientificCruise != null; - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -1,538 +0,0 @@ -/* - * #%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% - */ - -JToolBar { - floatable: false; -} - -BeanComboBox { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; -} - -BeanListHeader { - showReset: true; - i18nPrefix: "tutti.property."; -} - -JList { - selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; - model: {new DefaultListModel()}; -} - -NumberEditor { - autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; - showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; - bean: {model}; - showReset: true; -} - -SimpleTimeEditor { - bean: {model}; -} - -#stationNumberLabel { - text: "tutti.label.fishingOperation.stationNumber"; - labelFor: {stationNumberField}; -} - -#stationNumberField { - property: "stationNumber"; - model: {model.getStationNumber()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#fishingOperationNumberLabel { - text: "tutti.label.fishingOperation.fishingOperationNumber"; - labelFor: {fishingOperationNumberField}; -} - -#fishingOperationNumberField { - property: "fishingOperationNumber"; - model: {model.getFishingOperationNumber()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#dateLabel { - text: "tutti.label.fishingOperation.date"; - labelFor: {dateField}; -} - -#dateField { - date: {model.getDate()}; - formats: {"dd/MM/yyyy"}; -} - -#strataLabel { - text: "tutti.label.fishingOperation.strata"; - labelFor: {strataComboBox}; -} - -#strataComboBox { - property: "strata"; - selectedItem: {model.getStrata()}; -} - -#subStrataLabel { - text: "tutti.label.fishingOperation.subStrata"; - labelFor: {subStrataComboBox}; -} - -#subStrataComboBox { - property: "subStrata"; - selectedItem: {model.getSubStrata()}; -} - -#localiteLabel { - text: "tutti.label.fishingOperation.localite"; - labelFor: {localiteField}; -} - -#localiteField { - text: {model.getLocalite()}; -} - -#gearLongitudeLabel { - text: "tutti.label.fishingOperation.gearLongitude"; -} - -#gearLatitudeLabel { - text: "tutti.label.fishingOperation.gearLatitude"; -} - -#gearDateLabel { - text: "tutti.label.fishingOperation.gearDate"; -} - -#gearTimeLabel { - text: "tutti.label.fishingOperation.gearTime"; -} - -#gearShootingStartLabel { - text: "tutti.label.fishingOperation.gearShootingStart"; -} - -#gearShootingEndLabel { - text: "tutti.label.fishingOperation.gearShootingEnd"; -} - -#gearShootingStartLongitudeField { - text: {getStringValue(model.getGearShootingStartLongitude())}; -} - -#gearShootingStartLatitudeField { - text: {getStringValue(model.getGearShootingStartLatitude())}; -} - -#gearShootingStartDateField { - date: {model.getGearShootingStartDate()}; - formats: {"dd/MM/yyyy"}; -} - -#gearShootingStartTimeField { - property: "gearShootingStartDate"; - date: {model.getGearShootingStartDate()}; -} - -#gearShootingEndLongitudeField { - text: {getStringValue(model.getGearShootingEndLongitude())}; -} - -#gearShootingEndLatitudeField { - text: {getStringValue(model.getGearShootingEndLatitude())}; -} - -#gearShootingEndDateField { - date: {model.getGearShootingEndDate()}; - formats: {"dd/MM/yyyy"}; -} - -#gearShootingEndTimeField { - property: "gearShootingEndDate"; - date: {model.getGearShootingEndDate()}; -} - -#fishingOperationValidPanel { - floatable: false; - borderPainted: false; - opaque: false; -} - -#resetValidStateButton { - actionIcon: "reset"; - text: "tutti.action.reset.fishingOperationValidState"; -} - -#fishingOperationValidRadio { - text: "tutti.label.fishingOperation.fishingOperationValid"; - selected: {model.getFishingOperationValid() == Boolean.TRUE}; - buttonGroup: "fishingOperationValid"; -} - -#fishingOperationInvalidRadio { - text: "tutti.label.fishingOperation.fishingOperationInvalid"; - selected: {model.getFishingOperationValid() == Boolean.FALSE}; - buttonGroup: "fishingOperationValid"; -} -#fishingOperationResetRadio { - selected: {model.getFishingOperationValid() == null}; - buttonGroup: "fishingOperationValid"; -} - -#fishingOperationRectiligneCheckBox { - text: "tutti.label.fishingOperation.fishingOperationRectiligne"; - selected: {model.isFishingOperationRectiligne()}; -} - -#distanceChaluteeLabel { - text: "tutti.label.fishingOperation.distanceChalutee"; - labelFor: {distanceChaluteeField}; -} - -#distanceChaluteeField { - property: "distanceChalutee"; - model: {model.getDistanceChalutee()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; - enabled: {!model.isFishingOperationRectiligne()}; -} - -#beaufortScaleLabel { - text: "tutti.label.fishingOperation.beaufortScale"; - labelFor: {beaufortScaleComboBox}; -} - -#beaufortScaleComboBox { - property: "beaufortScale"; - selectedItem: {model.getBeaufortScale()}; -} - -#windDirectionLabel { - text: "tutti.label.fishingOperation.windDirection"; - labelFor: {windDirectionField}; -} - -#windDirectionField { - property: "windDirection"; - model: {model.getWindDirection()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#seaStateLabel { - text: "tutti.label.fishingOperation.seaState"; - labelFor: {seaStateComboBox}; -} - -#seaStateComboBox { - property: "seaState"; - selectedItem: {model.getSeaState()}; -} - -#ouvertureHorizontaleLabel { - text: "tutti.label.fishingOperation.ouvertureHorizontale"; - labelFor: {ouvertureHorizontaleField}; -} - -#ouvertureHorizontaleVerticaleLabel { - text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale"; -} - -#ouvertureHorizontaleField { - property: "ouvertureHorizontale"; - model: {model.getOuvertureHorizontale()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#ouvertureVerticaleLabel { - text: "tutti.label.fishingOperation.ouvertureVerticale"; - labelFor: {ouvertureVerticaleField}; -} - -#ouvertureVerticaleField { - property: "ouvertureVerticale"; - model: {model.getOuvertureVerticale()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#geometrieMesureeCheckBox { - text: "tutti.label.fishingOperation.geometrieMesuree"; - selected: {model.isGeometrieMesuree()}; -} - -#longueurFunesLabel { - text: "tutti.label.fishingOperation.longueurFunes"; - labelFor: {longueurFunesField}; -} - -#longueurFunesBrasLabel { - text: "tutti.label.fishingOperation.longueurFunesBras"; -} - -#longueurFunesField { - property: "longueurFunes"; - model: {model.getLongueurFunes()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#longueurBrasLabel { - text: "tutti.label.fishingOperation.longueurBras"; - labelFor: {longueurBrasField}; -} - -#longueurBrasField { - property: "longueurBras"; - model: {model.getLongueurBras()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#systemeFermetureCulCheckBox { - text: "tutti.label.fishingOperation.systemeFermetureCul"; - selected: {model.isSystemeFermetureCul()}; -} - -#dureeLabel { - text: "tutti.label.fishingOperation.duree"; - labelFor: {dureeField}; -} - -#dureeField { - property: "duree"; - model: {model.getDuree()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#saisisseurPane { - horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#saisisseurHeader { - labelText: {_("tutti.label.list.saisisseur")}; - list: {saisisseurList}; - beanType: {Person.class}; -} - -#commentPane { - columnHeaderView: {new JLabel(_("tutti.label.comment"))}; - minimumSize: {new Dimension(10,50)}; -} - -#commentField { - text: {model.getComment()}; -} - -#gearShootingStartDepthLabel { - text: "tutti.label.fishingOperation.gearShootingStartDepth"; - labelFor: {gearShootingStartDepthField}; -} - -#gearShootingStartDepthField { - property: "gearShootingStartDepth"; - model: {model.getGearShootingStartDepth()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingEndDepthLabel { - text: "tutti.label.fishingOperation.gearShootingEndDepth"; - labelFor: {gearShootingEndDepthField}; -} - -#gearShootingEndDepthField { - property: "gearShootingEndDepth"; - model: {model.getGearShootingEndDepth()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingStartSurfaceTemperatureLabel { - text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature"; - labelFor: {gearShootingStartSurfaceTemperatureField}; -} - -#gearShootingStartSurfaceTemperatureField { - property: "gearShootingStartSurfaceTemperature"; - model: {model.getGearShootingStartSurfaceTemperature()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingEndSurfaceTemperatureLabel { - text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature"; - labelFor: {gearShootingEndSurfaceTemperatureField}; -} - -#gearShootingEndSurfaceTemperatureField { - property: "gearShootingEndSurfaceTemperature"; - model: {model.getGearShootingEndSurfaceTemperature()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingStartBottomTemperatureLabel { - text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature"; - labelFor: {gearShootingStartBottomTemperatureField}; -} - -#gearShootingStartBottomTemperatureField { - property: "gearShootingStartBottomTemperature"; - model: {model.getGearShootingStartBottomTemperature()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingEndBottomTemperatureLabel { - text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature"; - labelFor: {gearShootingEndBottomTemperatureField}; -} - -#gearShootingEndBottomTemperatureField { - property: "gearShootingEndBottomTemperature"; - model: {model.getGearShootingEndBottomTemperature()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#averageBottomTemperatureLabel { - text: "tutti.label.fishingOperation.averageBottomTemperature"; - labelFor: {averageBottomTemperatureField}; -} - -#averageBottomTemperatureField { - property: "averageBottomTemperature"; - model: {model.getAverageBottomTemperature()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingStartSurfaceSalinityLabel { - text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity"; - labelFor: {gearShootingStartSurfaceSalinityField}; -} - -#gearShootingStartSurfaceSalinityField { - property: "gearShootingStartSurfaceSalinity"; - model: {model.getGearShootingStartSurfaceSalinity()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingEndSurfaceSalinityLabel { - text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity"; - labelFor: {gearShootingEndSurfaceSalinityField}; -} - -#gearShootingEndSurfaceSalinityField { - property: "gearShootingEndSurfaceSalinity"; - model: {model.getGearShootingEndSurfaceSalinity()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingStartBottomSalinityLabel { - text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity"; - labelFor: {gearShootingStartBottomSalinityField}; -} - -#gearShootingStartBottomSalinityField { - property: "gearShootingStartBottomSalinity"; - model: {model.getGearShootingStartBottomSalinity()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#gearShootingEndBottomSalinityLabel { - text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity"; - labelFor: {gearShootingEndBottomSalinityField}; -} - -#gearShootingEndBottomSalinityField { - property: "gearShootingEndBottomSalinity"; - model: {model.getGearShootingEndBottomSalinity()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#averageBottomSalinityLabel { - text: "tutti.label.fishingOperation.averageBottomSalinity"; - labelFor: {averageBottomSalinityField}; -} - -#averageBottomSalinityField { - property: "averageBottomSalinity"; - model: {model.getAverageBottomSalinity()}; - useFloat: false; - numberPattern: {INT_6_DIGITS_PATTERN}; -} - -#noTraitPane { - text: "tutti.label.no.fishingOperation.selected"; - horizontalAlignment: {JLabel.CENTER}; -} - -#saveButton { - actionIcon: "save"; - text: "tutti.action.save"; - enabled: {model.isModify() && model.isValid()}; -} - -#cancelButton { - actionIcon: "cancel"; - text: "tutti.action.cancel"; - enabled: {model.isModify()}; -} - -#importPupitriButton { - actionIcon: "pupitri-import"; - text: "tutti.action.pupitri-import"; -} - -#importCasinoButton { - actionIcon: "casino-import"; - text: "tutti.action.casino-import"; -} - -#messagePanel { - border: {BorderFactory.createTitledBorder("Messages")}; - height: 200; - width: 500; -} - -#errorTable { - rowSelectionAllowed: true; - autoCreateRowSorter: true; - autoResizeMode: 2; - cellSelectionEnabled: false; - selectionMode: 0; - model: {errorTableModel}; -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -1,550 +0,0 @@ -<!-- - #%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<FishingOperationTabUIModel, FishingOperationTabUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.referential.BeaufortScale - fr.ifremer.tutti.persistence.entities.referential.SeaState - fr.ifremer.tutti.persistence.entities.referential.Strata - fr.ifremer.tutti.persistence.entities.data.FishingOperation - fr.ifremer.tutti.persistence.entities.referential.Person - - fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor - - jaxx.runtime.swing.editor.bean.BeanComboBox - jaxx.runtime.swing.editor.bean.BeanListHeader - jaxx.runtime.swing.editor.NumberEditor - jaxx.runtime.swing.editor.TimeEditor - - jaxx.runtime.validator.swing.SwingValidatorUtil - jaxx.runtime.validator.swing.SwingValidatorMessageTableModel - - org.jdesktop.swingx.JXDatePicker - - java.awt.Dimension - - javax.swing.DefaultListModel - javax.swing.ListSelectionModel - - static org.nuiton.i18n.I18n._ - static jaxx.runtime.SwingUtil.getStringValue - </import> - - <script><![CDATA[ - -public FishingOperationTabUI(FishingOperationsUI parentUI) { - FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this); - setContextValue(handler); - handler.beforeInitUI(); -} - -public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); } - -protected void $afterCompleteSetup() { handler.afterInitUI(); } - ]]></script> - - <FishingOperationTabUIHandler id='handler' - initializer='getContextValue(FishingOperationTabUIHandler.class)'/> - - <FishingOperationTabUIModel id='model' - initializer='getContextValue(FishingOperationTabUIModel.class)'/> - - <SwingValidatorMessageTableModel id='errorTableModel'/> - - <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' - uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='stationNumber' component='stationNumberField'/> - <field name='fishingOperationNumber' - component='fishingOperationNumberField'/> - <field name='date' component='dateField'/> - <field name='comment' component='commentField'/> - <field name='saisisseur' component='saisisseurPane'/> - </BeanValidator> - - <JPanel id='traitPane' constraints='BorderLayout.CENTER' - layout='{new BorderLayout()}'> - - <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'> - <tab id='traitGeneralTab' - title='tutti.label.tab.fishingOperation.general'> - <Table fill='both' id='generalForm'> - - <!-- Numero station / Numéro trait / Date --> - <row> - <cell anchor='west'> - <JLabel id='stationNumberLabel'/> - </cell> - <cell weightx='0.3'> - <NumberEditor id='stationNumberField' constructorParams='this'/> - </cell> - <cell> - <JLabel id='fishingOperationNumberLabel'/> - </cell> - <cell weightx='0.3'> - <NumberEditor id='fishingOperationNumberField' - constructorParams='this'/> - </cell> - <cell> - <JLabel id='dateLabel'/> - </cell> - <cell weightx='0.3'> - <JXDatePicker id='dateField' - onActionPerformed='handler.setDate(event, "date")'/> - </cell> - </row> - - <!-- Strate d'association / Sous Strate / Localité --> - <row> - <cell> - <JLabel id='strataLabel'/> - </cell> - <cell weightx='0.3'> - <BeanComboBox id='strataComboBox' constructorParams='this' - genericType='Strata'/> - </cell> - <cell> - <JLabel id='subStrataLabel'/> - </cell> - <cell weightx='0.3'> - <BeanComboBox id='subStrataComboBox' constructorParams='this' - genericType='Strata'/> - </cell> - <cell> - <JLabel id='localiteLabel'/> - </cell> - <cell weightx='0.3'> - <JTextField id='localiteField' - onKeyReleased='handler.setText(event, "localite")'/> - </cell> - </row> - - <!-- début de traine long-lat-date-heure - fin de traine long-lat-date-heure --> - <row> - <cell columns='6'> - <JPanel layout="{new BorderLayout()}"> - <Table id="gearCaracteristicsTable" fill="both" weightx='1' - constraints='BorderLayout.CENTER'> - <row> - <cell> - <JLabel/> - </cell> - <cell> - <JLabel id='gearLongitudeLabel'/> - </cell> - <cell> - <JLabel id='gearLatitudeLabel'/> - </cell> - <cell> - <JLabel id='gearDateLabel'/> - </cell> - <cell> - <JLabel id='gearTimeLabel'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='gearShootingStartLabel'/> - </cell> - <cell> - <JTextField id='gearShootingStartLongitudeField' - onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/> - </cell> - <cell> - <JTextField id='gearShootingStartLatitudeLabel' - onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/> - </cell> - <cell> - <JXDatePicker id='gearShootingStartDateField' - onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/> - </cell> - <cell> - <SimpleTimeEditor id='gearShootingStartTimeField' - constructorParams='this'/> - </cell> - </row> - <row> - <cell> - <JLabel id='gearShootingEndLabel'/> - </cell> - <cell> - <JTextField id='gearShootingEndLongitudeField' - onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/> - </cell> - <cell> - <JTextField id='gearShootingEndLatitudeLabel' - onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/> - </cell> - <cell> - <JXDatePicker id='gearShootingEndDateField' - onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/> - </cell> - <cell> - <SimpleTimeEditor id='gearShootingEndTimeField' - constructorParams='this'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - - <!-- Fishing operation valid / invalid--> - <row> - <cell columns="2"> - <JToolBar id='fishingOperationValidPanel' - layout='{new BorderLayout()}'> - <JButton id='resetValidStateButton' - constraints='BorderLayout.WEST' - onActionPerformed="model.setFishingOperationValid(null)"/> - <JRadioButton id='fishingOperationResetRadio' - constraints='BorderLayout.EAST'/> - </JToolBar> - </cell> - <cell columns="2"> - <JRadioButton id='fishingOperationValidRadio' - onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/> - </cell> - <cell columns="2"> - <JRadioButton id='fishingOperationInvalidRadio' - onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/> - </cell> - </row> - - <!-- FishingOperation rectiligne / distance chalutee / durée --> - <row> - <cell> - <JCheckBox id='fishingOperationRectiligneCheckBox' - onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/> - </cell> - <cell columns="3"> - <JPanel layout="{new BorderLayout()}"> - <JLabel id='distanceChaluteeLabel' - constraints='BorderLayout.WEST'/> - <NumberEditor id='distanceChaluteeField' - constraints='BorderLayout.CENTER' - constructorParams='this'/> - </JPanel> - </cell> - <cell anchor='west'> - <JLabel id='dureeLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='dureeField' constructorParams='this'/> - </cell> - </row> - - <!-- Actions d'import --> - <row> - <cell columns='6'> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='importPupitriButton' - onActionPerformed='handler.importPupitri()'/> - <JButton id='importCasinoButton' - onActionPerformed='handler.importCasino()'/> - </JPanel> - </cell> - </row> - - <!-- Saisisseur --> - <row weighty='0.3'> - <cell columns='6'> - <JScrollPane id='saisisseurPane' - columnHeaderView="{saisisseurHeader}" - onFocusGained='saisisseurList.requestFocus()'> - <JList id='saisisseurList' - onValueChanged='handler.selectListData(event, "saisisseur")'/> - <BeanListHeader id='saisisseurHeader' genericType='Person'/> - </JScrollPane> - </cell> - </row> - - <!-- Commentaire --> - <row weighty='0.3'> - <cell columns='6'> - <JScrollPane id='commentPane' - onFocusGained='commentField.requestFocus()'> - <JTextArea id='commentField' - onKeyReleased='handler.setText(event, "comment")'/> - </JScrollPane> - </cell> - </row> - </Table> - </tab> - - <tab id='traitGearShootingTab' - title='tutti.label.tab.fishingOperation.gearShooting'> - - <Table fill='both' id='gearShootingForm'> - - <!-- GearShootingStart Depth --> - <row> - <cell> - <JLabel id='gearShootingStartDepthLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingStartDepthField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingEnd Depth --> - <row> - <cell> - <JLabel id='gearShootingEndDepthLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingEndDepthField' - constructorParams='this'/> - </cell> - </row> - - <!-- Ouverture horizontale --> - <row> - <cell anchor='west'> - <JLabel id='ouvertureHorizontaleLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='ouvertureHorizontaleField' - constructorParams='this'/> - </cell> - </row> - - <!-- Ouverture verticale --> - <row> - <cell anchor='west'> - <JLabel id='ouvertureVerticaleLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='ouvertureVerticaleField' - constructorParams='this'/> - </cell> - </row> - - <!-- Longueur funes --> - <row> - <cell anchor='west'> - <JLabel id='longueurFunesLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='longueurFunesField' constructorParams='this'/> - </cell> - </row> - - <!-- Longueur bras --> - <row> - <cell anchor='west'> - <JLabel id='longueurBrasLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='longueurBrasField' constructorParams='this'/> - </cell> - </row> - - <!-- Système de fermeture du cul / Geometrie mesuree --> - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1,0)}'> - <JCheckBox id='systemeFermetureCulCheckBox' - onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/> - <JCheckBox id='geometrieMesureeCheckBox' - onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/> - </JPanel> - </cell> - </row> - </Table> - </tab> - - <tab id='environmentTab' - title='tutti.label.tab.fishingOperation.environment'> - - <Table fill='both' id='environmentForm'> - - <!-- Beaufort scale --> - <row> - <cell anchor='west'> - <JLabel id='beaufortScaleLabel'/> - </cell> - <cell weightx='1.0'> - <BeanComboBox id='beaufortScaleComboBox' constructorParams='this' - genericType='BeaufortScale'/> - </cell> - </row> - - <!-- Wind direction --> - <row> - <cell anchor='west'> - <JLabel id='windDirectionLabel'/> - </cell> - <cell fill='horizontal'> - <NumberEditor id='windDirectionField' constructorParams='this'/> - </cell> - </row> - - <!-- Sea state--> - <row> - <cell anchor='west'> - <JLabel id='seaStateLabel'/> - </cell> - <cell fill='horizontal'> - <BeanComboBox id='seaStateComboBox' constructorParams='this' - genericType='SeaState'/> - </cell> - </row> - </Table> - </tab> - - <tab id='traitHydrologyTabContent' - title='tutti.label.tab.fishingOperation.hydrology'> - - <Table fill='both' id='hydrologyForm'> - - <!-- GearShootingStartSurfaceTemperature --> - <row> - <cell> - <JLabel id='gearShootingStartSurfaceTemperatureLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingStartSurfaceTemperatureField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingEndSurfaceTemperature --> - <row> - <cell> - <JLabel id='gearShootingEndSurfaceTemperatureLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingEndSurfaceTemperatureField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingStartBottomTemperature --> - <row> - <cell> - <JLabel id='gearShootingStartBottomTemperatureLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingStartBottomTemperatureField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingEndBottomTemperature --> - <row> - <cell> - <JLabel id='gearShootingEndBottomTemperatureLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingEndBottomTemperatureField' - constructorParams='this'/> - </cell> - </row> - - <!-- AverageBottomTemperature --> - <row> - <cell> - <JLabel id='averageBottomTemperatureLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='averageBottomTemperatureField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingStartSurfaceSalinity --> - <row> - <cell> - <JLabel id='gearShootingStartSurfaceSalinityLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingStartSurfaceSalinityField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingEndSurfaceSalinity --> - <row> - <cell> - <JLabel id='gearShootingEndSurfaceSalinityLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingEndSurfaceSalinityField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingStartBottomSalinity --> - <row> - <cell> - <JLabel id='gearShootingStartBottomSalinityLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingStartBottomSalinityField' - constructorParams='this'/> - </cell> - </row> - - <!-- GearShootingEndBottomSalinity --> - <row> - <cell> - <JLabel id='gearShootingEndBottomSalinityLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='gearShootingEndBottomSalinityField' - constructorParams='this'/> - </cell> - </row> - - <!-- AverageBottomSalinity --> - <row> - <cell> - <JLabel id='averageBottomSalinityLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='averageBottomSalinityField' - constructorParams='this'/> - </cell> - </row> - - </Table> - </tab> - </JTabbedPane> - - <!-- Actions --> - <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'> - <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='saveButton' onActionPerformed='handler.save()'/> - </JPanel> - </JPanel> - - </JPanel> - - <JLabel id='noTraitPane'/> -</JPanel> Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,242 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%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.FishingOperation; -import fr.ifremer.tutti.persistence.entities.referential.Person; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -/** - * Handler for UI {@link FishingOperationTabUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(FishingOperationTabUIHandler.class); - - private final FishingOperationTabUI ui; - - private final FishingOperationsUI parentUi; - - private final PersistenceService persistenceService; - - public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) { - super(parentUi.getHandler().getContext()); - this.ui = ui; - this.parentUi = parentUi; - this.persistenceService = context.getService(PersistenceService.class); - } - - @Override - public void beforeInitUI() { - - FishingOperationTabUIModel model = new FishingOperationTabUIModel(); - model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - JPanel form = ui.getTraitPane(); - JLabel noContentPane = ui.getNoTraitPane(); - - Boolean empty = (Boolean) evt.getNewValue(); - ui.remove(form); - ui.remove(noContentPane); - if (empty) { - ui.add(noContentPane, BorderLayout.CENTER); - } else { - ui.add(form, BorderLayout.CENTER); - } - ui.repaint(); - } - }); - - listModelIsModify(model); - - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - - ui.getFishingOperationValidPanel().remove( - ui.getFishingOperationResetRadio()); - - FishingOperationTabUIModel model = ui.getModel(); - - initUI(ui); - - initBeanList(ui.getSaisisseurHeader(), - persistenceService.getAllPerson(), - model.getSaisisseur()); - - initBeanComboBox(ui.getBeaufortScaleComboBox(), - persistenceService.getAllBeaufortScale(), - model.getBeaufortScale()); - - initBeanComboBox(ui.getStrataComboBox(), - persistenceService.getAllStrata(), - model.getStrata()); - - initBeanComboBox(ui.getSeaStateComboBox(), - persistenceService.getAllSeaState(), - model.getSeaState()); - - model.setEmpty(true); - - listenValidatorValid(ui.getValidator(), getModel()); - } - - @Override - public void onCloseUI() { - } - - @Override - protected FishingOperationTabUIModel getModel() { - return ui.getModel(); - } - - public void selectFishingOperation(FishingOperation bean) { - - boolean empty = bean == null; - - FishingOperationTabUIModel model = getModel(); - - // clean previous selection - ui.getSaisisseurHeader().getList().clearSelection(); - - if (empty) { - - model.fromBean(new FishingOperation()); - } else { - - model.fromBean(bean); - } - - // update saisissuer selection - List<Person> saisisseur = model.getSaisisseur(); - if (CollectionUtils.isNotEmpty(saisisseur)) { - updateIndices(ui.getSaisisseurList(), saisisseur); - } - - // update model empty property - model.setEmpty(empty); - - // reload bean in validator (? really mandatory?) -// ui.getValidator().reloadBean(); - - // if new fishingOperation can already cancel his creation - model.setModify(!empty && model.isCreate()); - } - - public void cancel() { - - String id = getModel().getId(); - - if (log.isInfoEnabled()) { - log.info("Cancel edition for fishingOperation: " + id); - } - boolean newBean = StringUtils.isBlank(id); - - if (newBean) { - - // cancel to create a new fishingOperation - parentUi.getHandler().selectFishingOperation(null); - - } else { - - // reselect in ui the fishingOperation - FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation(); - parentUi.getHandler().selectFishingOperation(selectedFishingOperation); - } - } - - public void save() { - - // get fishingOperation to save - FishingOperation toSave = getModel().toBean(); - - if (log.isInfoEnabled()) { - log.info("Save edition for fishingOperation: " + toSave.getId()); - } - - // keep selected tab (to resotre it after save) - int selectedIndex = ui.getTraitTabPane().getSelectedIndex(); - - // persist current fishingOperation - parentUi.getHandler().saveFishingOperation(toSave); - - // reselect current tab - ui.getTraitTabPane().setSelectedIndex(selectedIndex); - - getModel().setModify(false); - } - - public void importPupitri() { - //TODO - } - - public void importCasino() { - //TODO - } - - public void setGearShootingStartLatitude(String text) { - getModel().setGearShootingStartLatitude(Float.valueOf(text)); - } - - public void setGearShootingStartLongitude(String text) { - getModel().setGearShootingStartLongitude(Float.valueOf(text)); - } - -// public void setGearShootingStartTime(String text) { -// getModel().setGearShootingStartTime(Integer.valueOf(text)); -// } - - public void setGearShootingEndLatitude(String text) { - getModel().setGearShootingEndLatitude(Float.valueOf(text)); - } - - public void setGearShootingEndLongitude(String text) { - getModel().setGearShootingEndLongitude(Float.valueOf(text)); - } - -// public void setGearShootingEndTime(String text) { -// getModel().setGearShootingEndTime(Integer.valueOf(text)); -// } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,633 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%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.FishingOperation; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; -import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; -import fr.ifremer.tutti.persistence.entities.referential.Person; -import fr.ifremer.tutti.persistence.entities.referential.SeaState; -import fr.ifremer.tutti.persistence.entities.referential.Strata; -import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import java.util.Date; -import java.util.List; - -/** - * Model for UI {@link FishingOperationTabUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_EMPTY = "empty"; - - public static final String PROPERTY_STATION_NUMBER = "stationNumber"; - - public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber"; - - public static final String PROPERTY_DATE = "date"; - - public static final String PROPERTY_STRATA = "strata"; - - public static final String PROPERTY_SUB_STRATA = "subStrata"; - - public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude"; - - public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude"; - - public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate"; - - public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth"; - - public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude"; - - public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude"; - - public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate"; - - public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth"; - - public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale"; - - public static final String PROPERTY_WIND_DIRECTION = "windDirection"; - - public static final String PROPERTY_SEA_STATE = "seaState"; - - public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale"; - - public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale"; - - public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree"; - - public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes"; - - public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras"; - - public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul"; - - public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne"; - - public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee"; - - public static final String PROPERTY_DUREE = "duree"; - - public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid"; - - public static final String PROPERTY_LOCALITE = "localite"; - - public static final String PROPERTY_COMMENT = "comment"; - - public static final String PROPERTY_SAISISSEUR = "saisisseur"; - - public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature"; - - public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature"; - - public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature"; - - public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature"; - - public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature"; - - public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity"; - - public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity"; - - public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity"; - - public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity"; - - public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity"; - - protected boolean empty; - - protected ScientificCruise scientificCruise; - - protected Integer stationNumber; - - protected Integer fishingOperationNumber; - - protected Date date; - - protected Strata strata; - - protected Strata subStrata; - - protected Float gearShootingStartLatitude; - - protected Float gearShootingStartLongitude; - - protected Date gearShootingStartDate; - - protected Integer gearShootingStartTime; - - protected Float gearShootingStartDepth; - - protected Float gearShootingEndLatitude; - - protected Float gearShootingEndLongitude; - - protected Date gearShootingEndDate; - - protected Integer 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 fishingOperationRectiligne; - - protected Float distanceChalutee; - - protected Float duree; - - protected Boolean fishingOperationValid; - - protected String localite; - - protected String comment; - - protected List<Person> 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 static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder = - BinderFactory.newBinder(FishingOperationTabUIModel.class, - FishingOperation.class); - - protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder = - BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class); - - public FishingOperationTabUIModel() { - super(FishingOperation.class, fromBeanBinder, toBeanBinder); - } - - public boolean isEmpty() { - return empty; - } - - public void setEmpty(boolean empty) { - Object oldValue = isEmpty(); - this.empty = empty; - firePropertyChange(PROPERTY_EMPTY, oldValue, empty); - } - - public ScientificCruise getScientificCruise() { - return scientificCruise; - } - - public void setScientificCruise(ScientificCruise scientificCruise) { - this.scientificCruise = scientificCruise; - } - - public Integer getStationNumber() { - return stationNumber; - } - - public void setStationNumber(Integer stationNumber) { - Object oldValue = getStationNumber(); - this.stationNumber = stationNumber; - firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber); - } - - public Integer getFishingOperationNumber() { - return fishingOperationNumber; - } - - public void setFishingOperationNumber(Integer fishingOperationNumber) { - Object oldValue = getFishingOperationNumber(); - this.fishingOperationNumber = fishingOperationNumber; - firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber); - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - Object oldValue = getDate(); - this.date = date; - firePropertyChange(PROPERTY_DATE, oldValue, date); - } - - public Strata getStrata() { - return strata; - } - - public void setStrata(Strata strata) { - Object oldValue = getStrata(); - this.strata = strata; - firePropertyChange(PROPERTY_STRATA, oldValue, strata); - } - - public Strata getSubStrata() { - return subStrata; - } - - public void setSubStrata(Strata subStrata) { - Object oldValue = getSubStrata(); - this.subStrata = subStrata; - firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata); - } - - public Float getGearShootingStartLatitude() { - return gearShootingStartLatitude; - } - - public void setGearShootingStartLatitude(Float gearShootingStartLatitude) { - Object oldValue = getGearShootingStartLatitude(); - this.gearShootingStartLatitude = gearShootingStartLatitude; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude); - } - - public Float getGearShootingStartLongitude() { - return gearShootingStartLongitude; - } - - public void setGearShootingStartLongitude(Float gearShootingStartLongitude) { - Object oldValue = getGearShootingStartLongitude(); - this.gearShootingStartLongitude = gearShootingStartLongitude; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude); - } - - public Date getGearShootingStartDate() { - return gearShootingStartDate; - } - - public void setGearShootingStartDate(Date gearShootingStartDate) { - Object oldValue = getGearShootingStartDate(); - this.gearShootingStartDate = gearShootingStartDate; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate); - } - - public Float getGearShootingStartDepth() { - return gearShootingStartDepth; - } - - public void setGearShootingStartDepth(Float gearShootingStartDepth) { - Object oldValue = getGearShootingStartDepth(); - this.gearShootingStartDepth = gearShootingStartDepth; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth); - } - - public Float getGearShootingEndLatitude() { - return gearShootingEndLatitude; - } - - public void setGearShootingEndLatitude(Float gearShootingEndLatitude) { - Object oldValue = getGearShootingEndLatitude(); - this.gearShootingEndLatitude = gearShootingEndLatitude; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude); - } - - public Float getGearShootingEndLongitude() { - return gearShootingEndLongitude; - } - - public void setGearShootingEndLongitude(Float gearShootingEndLongitude) { - Object oldValue = getGearShootingEndLongitude(); - this.gearShootingEndLongitude = gearShootingEndLongitude; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude); - } - - public Date getGearShootingEndDate() { - return gearShootingEndDate; - } - - public void setGearShootingEndDate(Date gearShootingEndDate) { - Object oldValue = getGearShootingEndDate(); - this.gearShootingEndDate = gearShootingEndDate; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate); - } - - public Float getGearShootingEndDepth() { - return gearShootingEndDepth; - } - - public void setGearShootingEndDepth(Float gearShootingEndDepth) { - Object oldValue = getGearShootingEndDepth(); - this.gearShootingEndDepth = gearShootingEndDepth; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth); - } - - public BeaufortScale getBeaufortScale() { - return beaufortScale; - } - - public void setBeaufortScale(BeaufortScale beaufortScale) { - Object oldValue = getBeaufortScale(); - this.beaufortScale = beaufortScale; - firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale); - } - - public Integer getWindDirection() { - return windDirection; - } - - public void setWindDirection(Integer windDirection) { - Object oldValue = getWindDirection(); - this.windDirection = windDirection; - firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection); - } - - public SeaState getSeaState() { - return seaState; - } - - public void setSeaState(SeaState seaState) { - Object oldValue = getSeaState(); - this.seaState = seaState; - firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState); - } - - public Float getOuvertureHorizontale() { - return ouvertureHorizontale; - } - - public void setOuvertureHorizontale(Float ouvertureHorizontale) { - Object oldValue = getOuvertureHorizontale(); - this.ouvertureHorizontale = ouvertureHorizontale; - firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale); - } - - public Float getOuvertureVerticale() { - return ouvertureVerticale; - } - - public void setOuvertureVerticale(Float ouvertureVerticale) { - Object oldValue = getOuvertureVerticale(); - this.ouvertureVerticale = ouvertureVerticale; - firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale); - } - - public boolean isGeometrieMesuree() { - return geometrieMesuree; - } - - public void setGeometrieMesuree(boolean geometrieMesuree) { - Object oldValue = isGeometrieMesuree(); - this.geometrieMesuree = geometrieMesuree; - firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree); - } - - public Float getLongueurFunes() { - return longueurFunes; - } - - public void setLongueurFunes(Float longueurFunes) { - Object oldValue = getLongueurFunes(); - this.longueurFunes = longueurFunes; - firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes); - } - - public Float getLongueurBras() { - return longueurBras; - } - - public void setLongueurBras(Float longueurBras) { - Object oldValue = getLongueurBras(); - this.longueurBras = longueurBras; - firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras); - } - - public boolean isSystemeFermetureCul() { - return systemeFermetureCul; - } - - public void setSystemeFermetureCul(boolean systemeFermetureCul) { - Object oldValue = isSystemeFermetureCul(); - this.systemeFermetureCul = systemeFermetureCul; - firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul); - } - - public boolean isFishingOperationRectiligne() { - return fishingOperationRectiligne; - } - - public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) { - Object oldValue = isFishingOperationRectiligne(); - this.fishingOperationRectiligne = fishingOperationRectiligne; - firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne); - } - - public Float getDistanceChalutee() { - return distanceChalutee; - } - - public void setDistanceChalutee(Float distanceChalutee) { - Object oldValue = getDistanceChalutee(); - this.distanceChalutee = distanceChalutee; - firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee); - } - - public Float getDuree() { - return duree; - } - - public void setDuree(Float duree) { - Object oldValue = getDuree(); - this.duree = duree; - firePropertyChange(PROPERTY_DUREE, oldValue, duree); - } - - public Boolean getFishingOperationValid() { - return fishingOperationValid; - } - - public void setFishingOperationValid(Boolean fishingOperationValid) { - Object oldValue = getFishingOperationValid(); - this.fishingOperationValid = fishingOperationValid; - firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid); - } - - public String getLocalite() { - return localite; - } - - public void setLocalite(String localite) { - Object oldValue = getLocalite(); - this.localite = localite; - firePropertyChange(PROPERTY_LOCALITE, oldValue, localite); - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - Object oldValue = getComment(); - this.comment = comment; - firePropertyChange(PROPERTY_COMMENT, oldValue, comment); - } - - public List<Person> getSaisisseur() { - return saisisseur; - } - - public void setSaisisseur(List<Person> saisisseur) { - this.saisisseur = saisisseur; - firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur); - } - - public Float getGearShootingStartSurfaceTemperature() { - return gearShootingStartSurfaceTemperature; - } - - public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) { - Object oldValue = getGearShootingStartSurfaceTemperature(); - this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature); - } - - public Float getGearShootingEndSurfaceTemperature() { - return gearShootingEndSurfaceTemperature; - } - - public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) { - Object oldValue = getGearShootingEndSurfaceTemperature(); - this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature); - } - - public Float getGearShootingStartBottomTemperature() { - return gearShootingStartBottomTemperature; - } - - public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) { - Object oldValue = getGearShootingStartBottomTemperature(); - this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature); - } - - public Float getGearShootingEndBottomTemperature() { - return gearShootingEndBottomTemperature; - } - - public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) { - Object oldValue = getGearShootingEndBottomTemperature(); - this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature); - } - - public Float getAverageBottomTemperature() { - return averageBottomTemperature; - } - - public void setAverageBottomTemperature(Float averageBottomTemperature) { - Object oldValue = getAverageBottomTemperature(); - this.averageBottomTemperature = averageBottomTemperature; - firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature); - } - - public Float getGearShootingStartSurfaceSalinity() { - return gearShootingStartSurfaceSalinity; - } - - public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) { - Object oldValue = getGearShootingStartSurfaceSalinity(); - this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity); - } - - public Float getGearShootingEndSurfaceSalinity() { - return gearShootingEndSurfaceSalinity; - } - - public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) { - Object oldValue = getGearShootingEndSurfaceSalinity(); - this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity); - } - - public Float getGearShootingStartBottomSalinity() { - return gearShootingStartBottomSalinity; - } - - public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) { - Object oldValue = getGearShootingStartBottomSalinity(); - this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity; - firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity); - } - - public Float getGearShootingEndBottomSalinity() { - return gearShootingEndBottomSalinity; - } - - public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) { - Object oldValue = getGearShootingEndBottomSalinity(); - this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity; - firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity); - } - - public Float getAverageBottomSalinity() { - return averageBottomSalinity; - } - - public void setAverageBottomSalinity(Float averageBottomSalinity) { - Object oldValue = getAverageBottomSalinity(); - this.averageBottomSalinity = averageBottomSalinity; - firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity); - } -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -1,64 +0,0 @@ -/* - * #%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% - */ - -BeanComboBox { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; -} - -#newFishingOperationButton { - text: "tutti.action.new"; - actionIcon: "add"; -} - -#traitComboBox { - property: "selectedFishingOperation"; - selectedItem: {model.getSelectedFishingOperation()}; -} - -#speciesTab { - enabled: {model.getSelectedFishingOperation() != null}; -} - -#benthosTab { - enabled: {model.getSelectedFishingOperation() != null}; -} - -#planctonTab { - enabled: {model.getSelectedFishingOperation() != null}; -} - -#macroDechetTab { - enabled: {model.getSelectedFishingOperation() != null}; -} - -#accidentelTab { - enabled: {model.getSelectedFishingOperation() != null}; -} - -#observationIndividuelTab { - enabled: {false}; - /*enabled: {model.getSelectedFishingOperation() != null};*/ -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -1,99 +0,0 @@ -<!-- - #%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<FishingOperationsUIModel, FishingOperationsUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.data.FishingOperation - - fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI - fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI - fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI - fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI - fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI - - jaxx.runtime.swing.editor.bean.BeanComboBox - - static org.nuiton.i18n.I18n._ - </import> - - <script><![CDATA[ -public FishingOperationsUI(TuttiUIContext context) { - FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this); - setContextValue(handler); - handler.beforeInitUI(); -} - -protected void $afterCompleteSetup() { - handler.afterInitUI(); -} - ]]></script> - - <FishingOperationsUIHandler id='handler' - initializer='getContextValue(FishingOperationsUIHandler.class)'/> - - <FishingOperationsUIModel id='model' - initializer='getContextValue(FishingOperationsUIModel.class)'/> - - <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'> - - <!-- FishingOperations fishingOperation --> - <row> - <cell anchor='west' weightx='1.0'> - <BeanComboBox id='traitComboBox' constructorParams='this' - genericType='FishingOperation'/> - </cell> - <cell anchor='east'> - <JButton id='newFishingOperationButton' - onActionPerformed='getHandler().createNewFishingOperation()'/> - </cell> - </row> - </Table> - - <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'> - <tab id='traitTab' title='tutti.label.tab.fishingOperation'> - <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/> - </tab> - <tab id='speciesTab' title='tutti.label.tab.species'> - <SpeciesTabUI id='speciesTabContent' constructorParams='this'/> - </tab> - <tab id='benthosTab' title='tutti.label.tab.benthos'> - <BenthosTabUI id='benthosTabContent' constructorParams='this'/> - </tab> - <tab id='planctonTab' title='tutti.label.tab.plancton'> - <PlanctonTabUI id='planctonTabContent' constructorParams='this'/> - </tab> - <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'> - <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/> - </tab> - <tab id='accidentelTab' title='tutti.label.tab.accidentel'> - <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/> - </tab> - <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'> - <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> - </tab> - </JTabbedPane> - -</JPanel> \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,209 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%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.TuttiEntities; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.persistence.entities.data.ScientificCruise; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Date; -import java.util.List; - -/** - * Handler of UI {@link FishingOperationsUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> { - - /** Logger. */ - private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class); - - private final FishingOperationsUI ui; - - private final PersistenceService persistenceService; - - public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) { - super(context); - this.ui = ui; - persistenceService = context.getService(PersistenceService.class); - } - - @Override - public void beforeInitUI() { - - FishingOperationsUIModel model = new FishingOperationsUIModel(); - - String campaignId = context.getScientificCruiseId(); - - // load existing scientificCruise - ScientificCruise scientificCruise = persistenceService.getScientificCruise(campaignId); - model.setScientificCruise(scientificCruise); - - List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(campaignId); - model.setFishingOperation(fishingOperations); - - if (log.isInfoEnabled()) { - log.info("Loaded " + fishingOperations.size() + " fishingOperation(s)."); - } - - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - - FishingOperationsUIModel model = getModel(); - - initUI(ui); - - List<FishingOperation> fishingOperations = model.getFishingOperation(); - - initBeanComboBox(ui.getTraitComboBox(), - fishingOperations, - model.getSelectedFishingOperation()); - - model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - selectFishingOperation((FishingOperation) evt.getNewValue()); - } - }); - - model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - ui.getTraitComboBox().setData(null); - ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue()); - } - }); - - if (!fishingOperations.isEmpty()) { - - model.setSelectedFishingOperation(fishingOperations.get(0)); - } - } - - @Override - public void onCloseUI() { - - // ui will be saved so we do not want to keep selected tab indexes - ui.getTabPane().setSelectedIndex(0); - ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0); - - // when quitting ui, let's de-select fishingOperation (will save any changes) - selectFishingOperation(null); - } - - @Override - protected FishingOperationsUIModel getModel() { - return ui.getModel(); - } - - public void createNewFishingOperation() { - - // deselect selected fishingOperation - getModel().setSelectedFishingOperation(null); - - // use a new empty fishingOperation - FishingOperation newFishingOperation = new FishingOperation(); - newFishingOperation.setScientificCruise(getModel().getScientificCruise()); - - // by default use the current day with no time information - Date currentDate = new Date(); - currentDate = DateUtils.setHours(currentDate, 0); - currentDate = DateUtils.setMinutes(currentDate, 0); - - newFishingOperation.setDate(currentDate); - newFishingOperation.setGearShootingStartDate(currentDate); - newFishingOperation.setGearShootingEndDate(currentDate); - selectFishingOperation(newFishingOperation); - } - - public void selectFishingOperation(FishingOperation fishingOperation) { - - if (log.isInfoEnabled()) { - log.info("New selected fishingOperation: " + fishingOperation); - } - // back to fishingOperation tab - ui.getTabPane().setSelectedIndex(0); - - // back to general tab of fishingOperation tabs - ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0); - - // propagate fishingOperation to his tabs - ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation); - ui.getSpeciesTabContent().selectFishingOperation(fishingOperation); - ui.getBenthosTabContent().selectFishingOperation(fishingOperation); - ui.getPlanctonTabContent().selectFishingOperation(fishingOperation); - ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation); - ui.getAccidentelTabContent().selectFishingOperation(fishingOperation); - - // repaint tabs - ui.getTabPane().repaint(); -// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation); - } - - public void saveFishingOperation(FishingOperation toSave) { - - // persist the fishingOperation - - boolean create = toSave.getId() == null; - - FishingOperation savedFishingOperation; - if (create) { - savedFishingOperation = persistenceService.createFishingOperation(toSave); - } else { - savedFishingOperation = persistenceService.saveFishingOperation(toSave); - } - - FishingOperationsUIModel model = getModel(); - - // add the saved fishingOperation to fishingOperation list - - List<FishingOperation> data = model.getFishingOperation(); - - FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId()); - if (existingFishingOperation != null) { - data.remove(existingFishingOperation); - } - data.add(savedFishingOperation); - - // update model fishingOperation list - model.setFishingOperation(data); - - // update model selected fishingOperation - model.setSelectedFishingOperation(savedFishingOperation); - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -1,83 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%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.ScientificCruise; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import org.jdesktop.beans.AbstractSerializableBean; - -import java.util.List; - -/** - * Model fo UI {@link FishingOperationsUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class FishingOperationsUIModel extends AbstractSerializableBean { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_FISHING_OPERATION = "fishingOperation"; - - public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation"; - - public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise"; - - protected List<FishingOperation> fishingOperation; - - protected FishingOperation selectedFishingOperation; - - protected ScientificCruise scientificCruise; - - public List<FishingOperation> getFishingOperation() { - return fishingOperation; - } - - public void setFishingOperation(List<FishingOperation> fishingOperation) { - this.fishingOperation = fishingOperation; - firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation); - } - - public FishingOperation getSelectedFishingOperation() { - return selectedFishingOperation; - } - - public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) { - Object oldValue = getSelectedFishingOperation(); - this.selectedFishingOperation = selectedFishingOperation; - firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation); - } - - public ScientificCruise getScientificCruise() { - return scientificCruise; - } - - public void setScientificCruise(ScientificCruise scientificCruise) { - Object oldValue = getScientificCruise(); - this.scientificCruise = scientificCruise; - firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise); - } -} 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -28,7 +28,7 @@ fr.ifremer.tutti.persistence.entities.data.FishingOperation fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI + fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI jaxx.runtime.swing.editor.NumberEditor 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -30,7 +30,7 @@ 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.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -28,7 +28,7 @@ fr.ifremer.tutti.persistence.entities.data.FishingOperation fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI + fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI jaxx.runtime.swing.editor.NumberEditor 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -30,7 +30,7 @@ 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.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -28,7 +28,7 @@ fr.ifremer.tutti.persistence.entities.data.FishingOperation fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI + fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI jaxx.runtime.swing.editor.NumberEditor 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -30,7 +30,7 @@ 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.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -28,7 +28,7 @@ fr.ifremer.tutti.persistence.entities.data.FishingOperation fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI + fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI jaxx.runtime.swing.editor.NumberEditor 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -30,7 +30,7 @@ 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.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -28,7 +28,7 @@ fr.ifremer.tutti.persistence.entities.data.FishingOperation fr.ifremer.tutti.ui.swing.TuttiUIContext - fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI + fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI org.jdesktop.swingx.JXTable 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -36,7 +36,7 @@ import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.TuttiUI; -import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI; +import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler; Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,223 @@ +/* + * #%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% + */ + +JToolBar { + floatable: false; +} + +BeanComboBox { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; +} + +BeanListHeader { + showReset: true; + i18nPrefix: "tutti.property."; +} + +JList { + selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; + model: {new DefaultListModel()}; +} + +NumberEditor { + autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; + showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; + bean: {model}; + showReset: true; +} + +#splitPane { + orientation: {JSplitPane.VERTICAL_SPLIT}; + resizeWeight: 0.3; + oneTouchExpandable: true; + continuousLayout: true; +} + +#nameLabel { + text: "tutti.label.cruise.name"; + labelFor: {nameField}; +} + +#nameField { + text: {model.getName()}; +} + +#yearLabel { + text: "tutti.label.cruise.year"; + labelFor: {yearField}; +} + +#yearField { + property: "year"; + model: {model.getYear()}; + useFloat: false; + numberPattern: {INT_4_DIGITS_PATTERN}; +} + +#surveyPartLabel { + text: "tutti.label.cruise.surveyPart"; + labelFor: {surveyPartField}; +} + +#surveyPartField { + text: {model.getSurveyPart()}; +} + +#countryLabel { + text: "tutti.label.cruise.country"; + labelFor: {countryComboBox}; +} + +#countryComboBox { + property: "country"; + selectedItem: {model.getCountry()}; +} + +#programLabel { + text: "tutti.label.cruise.program"; + labelFor: {surveyComboBox}; +} + +#surveyComboBox { + property: "program"; + selectedItem: {model.getProgram()}; +} + +#beginDateLabel { + text: "tutti.label.cruise.beginDate"; + labelFor: {beginDateField}; +} + +#beginDateField { + date: {model.getBeginDate()}; + formats: {"dd/MM/yyyy"}; +} + +#endDateLabel { + text: "tutti.label.cruise.endDate"; + labelFor: {endDateField}; +} + +#endDateField { + date: {model.getEndDate()}; + formats: {"dd/MM/yyyy"}; +} + +#pocheLabel { + text: "tutti.label.cruise.poche"; + labelFor: {pocheField}; +} + +#pocheField { + property: "poche"; + model: {model.getPoche()}; + useFloat: false; + numberPattern: {INT_1_DIGITS_PATTERN}; +} + +#vesselPane { + horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#vesselHeader { + labelText: {_("tutti.label.list.vessel")}; + list: {vesselList}; + beanType: {Vessel.class}; +} + +#gearPane { + horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#gearHeader { + labelText: {_("tutti.label.list.gear")}; + list: {gearList}; + beanType: {Gear.class}; +} + +#headOfMissionPane { + horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#headOfMissionHeader { + labelText: {_("tutti.label.list.headOfMission")}; + list: {headOfMissionList}; + beanType: {Person.class}; +} + +#headOfSortRoomPane { + horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#headOfSortRoomHeader { + labelText: {_("tutti.label.list.headOfSortRoom")}; + list: {headOfSortRoomList}; + beanType: {Person.class}; +} + +#commentPane { + columnHeaderView: {new JLabel(_("tutti.label.comment"))}; + minimumSize: {new Dimension(10,50)}; +} + +#commentField { + text: {model.getComment()}; +} + +#saveButton { + actionIcon: "save"; + text: "tutti.action.save"; + enabled: {model.isModify() && model.isValid()}; +} + +#cancelButton { + actionIcon: "cancel"; + text: "tutti.action.cancel"; +} + +#generateNameButton { + actionIcon: "generate"; + text: "tutti.action.generateCampaignName"; + enabled: {model.isCanGenerateName()}; +} +#messagePanel { + border: {BorderFactory.createTitledBorder("Messages")}; + height: 200; + width: 500; +} + +#errorTable { + rowSelectionAllowed: true; + autoCreateRowSorter: true; + autoResizeMode: 2; + cellSelectionEnabled: false; + selectionMode: 0; + model: {errorTableModel}; +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css ___________________________________________________________________ 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/cruise/EditCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,238 @@ +<!-- + #%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<EditCruiseUIModel, EditCruiseUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.data.Program + fr.ifremer.tutti.persistence.entities.referential.Country + fr.ifremer.tutti.persistence.entities.referential.Gear + fr.ifremer.tutti.persistence.entities.referential.Person + fr.ifremer.tutti.persistence.entities.referential.Vessel + fr.ifremer.tutti.ui.swing.TuttiUIContext + + jaxx.runtime.swing.editor.NumberEditor + jaxx.runtime.swing.editor.bean.BeanComboBox + jaxx.runtime.swing.editor.bean.BeanListHeader + + jaxx.runtime.validator.swing.SwingValidatorUtil + jaxx.runtime.validator.swing.SwingValidatorMessageTableModel + + org.jdesktop.swingx.JXDatePicker + + javax.swing.DefaultListModel + javax.swing.ListSelectionModel + + java.awt.Dimension + + static org.nuiton.i18n.I18n._ + static jaxx.runtime.SwingUtil.getStringValue + </import> + + <script><![CDATA[ + + public EditCruiseUI(TuttiUIContext context) { + EditCruiseUIHandler handler = new EditCruiseUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <EditCruiseUIHandler id='handler' + initializer='getContextValue(EditCruiseUIHandler.class)'/> + + <EditCruiseUIModel id='model' + initializer='getContextValue(EditCruiseUIModel.class)'/> + + <SwingValidatorMessageTableModel id='errorTableModel'/> + + <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' + uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> + <field name='program' component='surveyComboBox'/> + <field name='year' component='yearField'/> + <field name='surveyPart' component='surveyPartField'/> + <field name='name' component='nameField'/> + <field name='poche' component='pocheField'/> + <field name='country' component='countryComboBox'/> + <field name='beginDate' component='beginDateField'/> + <field name='endDate' component='endDateField'/> + <field name='vessel' component='vesselPane'/> + <field name='gear' component='gearPane'/> + <field name='headOfMission' component='headOfMissionPane'/> + <field name='headOfSortRoom' component='headOfSortRoomPane'/> + <field name='comment' component='commentField'/> + </BeanValidator> + + <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> + <Table fill='both'> + + <!-- cruise program / year /program part / name --> + <row> + <cell anchor='west'> + <JLabel id='programLabel'/> + </cell> + <cell weightx='0.3'> + <BeanComboBox id='surveyComboBox' constructorParams='this' + genericType='Program'/> + </cell> + <cell anchor='west'> + <JLabel id='yearLabel'/> + </cell> + <cell weightx='0.3'> + <NumberEditor id='yearField' constructorParams='this'/> + </cell> + <cell> + <JLabel id='surveyPartLabel'/> + </cell> + <cell weightx='0.3'> + <JTextField id='surveyPartField' + onKeyReleased='handler.setText(event, "surveyPart")'/> + </cell> + </row> + + <!-- cruise name --> + <row> + <cell> + <JLabel id='nameLabel'/> + </cell> + <cell weightx='0.3'> + <JTextField id='nameField' + onKeyReleased='handler.setText(event, "name")'/> + </cell> + <cell columns='2'> + <JButton id='generateNameButton' + onActionPerformed='handler.generateCampaignName()'/> + </cell> + <cell> + <JLabel id='pocheLabel'/> + </cell> + <cell weightx='0.3'> + <NumberEditor id='pocheField' constructorParams='this'/> + </cell> + </row> + + <!-- cruise country / begin date / end date --> + <row> + <cell> + <JLabel id='countryLabel'/> + </cell> + <cell weightx='0.3'> + <BeanComboBox id='countryComboBox' constructorParams='this' + genericType='Country'/> + </cell> + <cell> + <JLabel id='beginDateLabel'/> + </cell> + <cell weightx='0.3'> + <JXDatePicker id='beginDateField' + onActionPerformed='handler.setDate(event, "beginDate")'/> + </cell> + <cell> + <JLabel id='endDateLabel'/> + </cell> + <cell weightx='0.3'> + <JXDatePicker id='endDateField' + onActionPerformed='handler.setDate(event, "endDate")'/> + </cell> + </row> + + <!-- cruise vessel / gear --> + <row weighty='0.3'> + <cell columns='6'> + <JPanel layout='{new GridLayout(1, 0)}'> + <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}" + onFocusGained='vesselList.requestFocus()'> + <JList id='vesselList' + onValueChanged='handler.selectListData(event, "vessel")'/> + <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='Gear'/> + </JScrollPane> + </JPanel> + </cell> + </row> + + <!-- cruise headOfMission / headOfSortRoom --> + <row weighty='0.3'> + <cell columns='6'> + <JPanel layout='{new GridLayout(1, 0)}'> + + <JScrollPane id='headOfMissionPane' + columnHeaderView="{headOfMissionHeader}" + onFocusGained='headOfMissionList.requestFocus()'> + <JList id='headOfMissionList' + onValueChanged='handler.selectListData(event, "headOfMission")'/> + <BeanListHeader id='headOfMissionHeader' + genericType='Person'/> + </JScrollPane> + <JScrollPane id='headOfSortRoomPane' + columnHeaderView="{headOfSortRoomHeader}" + onFocusGained='headOfSortRoomList.requestFocus()'> + <JList id='headOfSortRoomList' + onValueChanged='handler.selectListData(event, "headOfSortRoom")'/> + <BeanListHeader id='headOfSortRoomHeader' + genericType='Person'/> + </JScrollPane> + </JPanel> + </cell> + </row> + + <!-- cruise comment --> + <row weighty='0.3'> + <cell columns='6'> + <JScrollPane id='commentPane' + onFocusGained='commentField.requestFocus()'> + <JTextArea id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> + </JScrollPane> + </cell> + </row> + + <!-- Form Actions --> + <row> + <cell columns='6'> + <JPanel layout='{new GridLayout(1, 0)}'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='saveButton' onActionPerformed='handler.save()'/> + </JPanel> + </cell> + </row> + </Table> + + <JPanel id='messagePanel' layout='{new GridLayout()}'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' /> + </JScrollPane> + </JPanel> + </JSplitPane> + +</JPanel> \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx ___________________________________________________________________ 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/cruise/EditCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,176 @@ +package fr.ifremer.tutti.ui.swing.content.cruise; + +/* + * #%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.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.Program; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.persistence.entities.referential.Person; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; + +/** + * Handler of UI {@link EditCruiseUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EditCruiseUIHandler extends AbstractTuttiUIHandler<EditCruiseUIModel> { + + private final EditCruiseUI ui; + + private final PersistenceService persistenceService; + + public EditCruiseUIHandler(TuttiUIContext context, EditCruiseUI ui) { + super(context); + this.ui = ui; + persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + EditCruiseUIModel model = new EditCruiseUIModel(); + + String campaignId = context.getCruiseId(); + if (campaignId == null) { + + // create new cruise + Program program = + persistenceService.getProgram(context.getProgramId()); + model.setProgram(program); + model.setPoche(1); + } else { + + // load existing program + Cruise cruise = + persistenceService.getCruise(campaignId); + + model.fromBean(cruise); + } + listModelIsModify(model); + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + + initUI(ui); + + List<Person> users = persistenceService.getAllPerson(); + + EditCruiseUIModel model = ui.getModel(); + + initBeanComboBox(ui.getSurveyComboBox(), + persistenceService.getAllProgram(), + model.getProgram()); + + initBeanComboBox(ui.getCountryComboBox(), + persistenceService.getAllCountry(), + model.getCountry()); + + initBeanList(ui.getVesselHeader(), + persistenceService.getAllVessel(), + model.getVessel()); + + initBeanList(ui.getGearHeader(), + persistenceService.getAllGear(), + model.getGear()); + + initBeanList(ui.getHeadOfMissionHeader(), + users, + model.getHeadOfMission()); + + initBeanList(ui.getHeadOfSortRoomHeader(), + users, + model.getHeadOfSortRoom()); + + SwingValidatorUtil.installUI(ui.getErrorTable(), + new SwingValidatorMessageTableRenderer()); + + listenValidatorValid(ui.getValidator(), model); + + // if new fishingOperation can already cancel his creation + model.setModify(model.isCreate()); + } + + @Override + public void onCloseUI() { + } + + @Override + protected EditCruiseUIModel getModel() { + return ui.getModel(); + } + + public void cancel() { + + context.setScreen(TuttiScreen.SELECT_CRUISE); + } + + public void save() { + + EditCruiseUIModel model = ui.getModel(); + + Cruise bean = model.toBean(); + + Cruise saved; + if (TuttiEntities.isNew(bean)) { + + saved = persistenceService.createCruise(bean); + } else { + saved = persistenceService.saveCruise(bean); + } + + context.setProgramId(saved.getProgram().getId()); + context.setCruiseId(saved.getId()); + + context.setScreen(TuttiScreen.SELECT_CRUISE); + } + + public static final String cruiseNameFormat = "%1$s_%2$s"; + + public void generateCampaignName() { + + EditCruiseUIModel model = getModel(); + Program program = model.getProgram(); + Integer year = model.getYear(); + String name = String.format(cruiseNameFormat, program.getName(), year); + + String surveyPart = model.getSurveyPart(); + if (StringUtils.isNotEmpty(surveyPart)) { + name += "_" + surveyPart; + } + model.setName(name); + } + +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.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/cruise/EditCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,247 @@ +package fr.ifremer.tutti.ui.swing.content.cruise; + +/* + * #%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.Program; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.persistence.entities.referential.Country; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.Person; +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.Date; +import java.util.List; + +/** + * Model of UI {@link EditCruiseUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EditCruiseUIModel extends AbstractTuttiBeanUIModel<Cruise, EditCruiseUIModel> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_PROGRAM = "program"; + + 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"; + + public static final String PROPERTY_YEAR = "year"; + + public static final String PROPERTY_POCHE = "poche"; + + public static final String PROPERTY_BEGIN_DATE = "beginDate"; + + public static final String PROPERTY_END_DATE = "endDate"; + + public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName"; + + protected Program program; + + protected Country country; + + protected String name; + + protected String surveyPart; + + protected List<Vessel> vessel; + + protected List<Gear> gear; + + protected List<Person> headOfMission; + + protected List<Person> headOfSortRoom; + + protected String comment; + + protected Integer year; + + protected Integer poche; + + protected Date beginDate; + + protected Date endDate; + + protected static Binder<EditCruiseUIModel, Cruise> toBeanBinder = + BinderFactory.newBinder(EditCruiseUIModel.class, + Cruise.class); + + protected static Binder<Cruise, EditCruiseUIModel> fromBeanBinder = + BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class); + + public EditCruiseUIModel() { + super(Cruise.class, fromBeanBinder, toBeanBinder); + } + + public Program getProgram() { + return program; + } + + public void setProgram(Program program) { + Object oldValue = getProgram(); + this.program = program; + firePropertyChange(PROPERTY_PROGRAM, oldValue, program); + firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName()); + } + + public String getName() { + return name; + } + + public void setName(String name) { + Object oldValue = getName(); + this.name = name; + firePropertyChange(PROPERTY_NAME, oldValue, name); + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = getComment(); + this.comment = comment; + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); + } + + public Country getCountry() { + return country; + } + + public void setCountry(Country country) { + Object oldValue = getCountry(); + this.country = country; + firePropertyChange(PROPERTY_COUNTRY, oldValue, country); + } + + public String getSurveyPart() { + return surveyPart; + } + + public void setSurveyPart(String surveyPart) { + Object oldValue = getSurveyPart(); + this.surveyPart = surveyPart; + firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart); + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + Object oldValue = getYear(); + this.year = year; + firePropertyChange(PROPERTY_YEAR, oldValue, year); + firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName()); + } + + public Integer getPoche() { + return poche; + } + + public void setPoche(Integer poche) { + Object oldValue = getPoche(); + this.poche = poche; + firePropertyChange(PROPERTY_POCHE, oldValue, poche); + } + + public Date getBeginDate() { + return beginDate; + } + + public void setBeginDate(Date beginDate) { + Object oldValue = getBeginDate(); + this.beginDate = beginDate; + firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate); + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + Object oldValue = getEndDate(); + this.endDate = endDate; + firePropertyChange(PROPERTY_END_DATE, oldValue, endDate); + } + + public List<Vessel> getVessel() { + return vessel; + } + + public void setVessel(List<Vessel> vessel) { + this.vessel = vessel; + firePropertyChange(PROPERTY_VESSEL, null, vessel); + } + + public List<Gear> getGear() { + return gear; + } + + public void setGear(List<Gear> gear) { + this.gear = gear; + firePropertyChange(PROPERTY_GEAR, null, gear); + } + + public List<Person> getHeadOfMission() { + return headOfMission; + } + + public void setHeadOfMission(List<Person> headOfMission) { + this.headOfMission = headOfMission; + firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission); + } + + public List<Person> getHeadOfSortRoom() { + return headOfSortRoom; + } + + public void setHeadOfSortRoom(List<Person> headOfSortRoom) { + this.headOfSortRoom = headOfSortRoom; + firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom); + } + + public boolean isCanGenerateName() { + return program != null && year != null; + } + +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.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/home/SelectCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,77 @@ +/* + * #%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% + */ + +BeanComboBox { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; +} + +#programLabel { + text: "tutti.label.program"; +} + +#programCombobox { + property: "program"; + selectedItem: {model.getProgram()}; +} + +#editProgramButton { + enabled: {model.isProgramFound()}; + text: "tutti.action.edit"; + actionIcon: "edit"; +} + +#newProgramButton { + text: "tutti.action.new"; + actionIcon: "add"; +} + +#cruiseLabel { + text: "tutti.label.cruise"; + labelFor: {cruiseCombobox}; +} + +#cruiseCombobox { + property: "cruise"; + enabled: {model.isProgramFound()}; + selectedItem: {model.getCruise()}; +} + +#editCruiseButton { + enabled: {model.isProgramFound() && model.isCruiseFound()}; + text: "tutti.action.edit"; + actionIcon: "edit"; +} + +#newCruiseButton { + actionIcon: "add"; + enabled: {model.isProgramFound()}; + text: "tutti.action.new"; +} + +#showFishingOperationsButton { + text: "tutti.action.catches"; + enabled: {uiContext.isCruiseContextFilled()}; +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css ___________________________________________________________________ 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/home/SelectCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,102 @@ +<!-- + #%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<SelectCruiseUIModel, SelectCruiseUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.data.Program + fr.ifremer.tutti.persistence.entities.data.Cruise + fr.ifremer.tutti.ui.swing.TuttiUIContext + + jaxx.runtime.swing.editor.bean.BeanComboBox + + static org.nuiton.i18n.I18n._ + </import> + + <script><![CDATA[ + + protected TuttiUIContext uiContext; + + public SelectCruiseUI(TuttiUIContext context) { + this.uiContext = context; + SelectCruiseUIHandler handler = + new SelectCruiseUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <SelectCruiseUIHandler id='handler' + initializer='getContextValue(SelectCruiseUIHandler.class)'/> + + <SelectCruiseUIModel id='model' + initializer='getContextValue(SelectCruiseUIModel.class)'/> + + <Table fill='both' constraints='BorderLayout.CENTER'> + <row> + <cell anchor='west'> + <JLabel id='programLabel'/> + </cell> + <cell weightx='1.0'> + <BeanComboBox id='programCombobox' constructorParams='this' + genericType='Program'/> + </cell> + <cell> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton id='editProgramButton' + onActionPerformed='handler.showSelectedProgram()'/> + <JButton id='newProgramButton' + onActionPerformed='handler.showNewProgram()'/> + </JPanel> + </cell> + </row> + <row> + <cell> + <JLabel id='cruiseLabel'/> + </cell> + <cell> + <BeanComboBox id='cruiseCombobox' constructorParams='this' + genericType='Cruise'/> + </cell> + <cell> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton id='editCruiseButton' + onActionPerformed='handler.showSelectedCruise()'/> + <JButton id='newCruiseButton' + onActionPerformed='handler.showNewCruise()'/> + </JPanel> + </cell> + </row> + <row> + <cell columns='3'> + <JButton id='showFishingOperationsButton' + onActionPerformed='handler.showFishingOperations()'/> + </cell> + </row> + </Table> +</JPanel> Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx ___________________________________________________________________ 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/home/SelectCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,204 @@ +package fr.ifremer.tutti.ui.swing.content.home; + +/* + * #%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.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.Program; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import jaxx.runtime.swing.editor.bean.BeanComboBox; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +/** + * Main ui content to select cruise. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SelectCruiseUIHandler extends AbstractTuttiUIHandler<SelectCruiseUIModel> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(SelectCruiseUIHandler.class); + + protected final PersistenceService persistenceService; + + protected final SelectCruiseUI ui; + + public SelectCruiseUIHandler(TuttiUIContext context, SelectCruiseUI ui) { + super(context); + this.ui = ui; + persistenceService = context.getService(PersistenceService.class); + } + + @Override + protected SelectCruiseUIModel getModel() { + return ui.getModel(); + } + + @Override + public void beforeInitUI() { + SelectCruiseUIModel model = new SelectCruiseUIModel(); + + List<Program> allPrograms = persistenceService.getAllProgram(); + + model.setPrograms(allPrograms); + + if (allPrograms.isEmpty()) { + // do nothing + + if (log.isDebugEnabled()) { + log.debug("No program found."); + } + } else { + + // get selected program (if any) + + String programId = context.getProgramId(); + Program selectedProgram = null; + List<Cruise> allCruises = null; + if (programId != null) { + selectedProgram = TuttiEntities.findById(allPrograms, programId); + allCruises = persistenceService.getAllCruise(programId); + } + + model.setProgram(selectedProgram); + model.setCruises(allCruises); + + if (CollectionUtils.isEmpty(allCruises)) { + + // nothing to select + } else { + String cruiseId = context.getCruiseId(); + + Cruise selectedCampaign = null; + if (cruiseId != null) { + selectedCampaign = + TuttiEntities.findById(allCruises, cruiseId); + } + model.setCruise(selectedCampaign); + } + } + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + + SelectCruiseUIModel model = ui.getModel(); + + initBeanComboBox(ui.getProgramCombobox(), + model.getPrograms(), + model.getProgram()); + + initBeanComboBox(ui.getCruiseCombobox(), + model.getCruises(), + model.getCruise()); + + model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Program newValue = (Program) evt.getNewValue(); + boolean noProgram = newValue == null; + context.setProgramId(noProgram ? null : newValue.getId()); + List<Cruise> campaigns; + if (noProgram) { + campaigns = Lists.newArrayList(); + } else { + campaigns = persistenceService.getAllCruise(newValue.getId()); + } + SelectCruiseUIModel model = (SelectCruiseUIModel) evt.getSource(); + model.setCruises(campaigns); + model.setCruise(null); + } + }); + + model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISES, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + // reload combo box + BeanComboBox<Cruise> combobox = ui.getCruiseCombobox(); + List<Cruise> campaigns = (List<Cruise>) evt.getNewValue(); + combobox.setData(null); + combobox.setData(campaigns); + } + }); + + model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISE, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Cruise newValue = (Cruise) evt.getNewValue(); + context.setCruiseId(newValue == null ? null : newValue.getId()); + } + }); + } + + @Override + public void onCloseUI() { + PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners(); + for (PropertyChangeListener listener : listeners) { + getModel().removePropertyChangeListener(listener); + } + } + + public void showFishingOperations() { + + context.setScreen(TuttiScreen.FILL_FISHING_OPERATION); + } + + public void showSelectedProgram() { + + Program program = getModel().getProgram(); + context.setProgramId(program.getId()); + context.setScreen(TuttiScreen.EDIT_PROGRAM); + } + + public void showNewProgram() { + context.setProgramId(null); + context.setCruiseId(null); + context.setScreen(TuttiScreen.EDIT_PROGRAM); + } + + public void showSelectedCruise() { + Cruise cruise = getModel().getCruise(); + context.setCruiseId(cruise.getId()); + context.setScreen(TuttiScreen.EDIT_CRUISE); + } + + public void showNewCruise() { + context.setCruiseId(null); + context.setScreen(TuttiScreen.EDIT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.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/home/SelectCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,123 @@ +package fr.ifremer.tutti.ui.swing.content.home; + +/* + * #%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.Cruise; +import fr.ifremer.tutti.persistence.entities.data.Program; +import org.jdesktop.beans.AbstractSerializableBean; + +import java.util.List; + +/** + * Model of ui {@link SelectCruiseUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SelectCruiseUIModel extends AbstractSerializableBean { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_PROGRAMS = "programs"; + + public static final String PROPERTY_PROGRAM = "program"; + + public static final String PROPERTY_CRUISES = "cruises"; + + public static final String PROPERTY_CRUISE = "cruise"; + + public static final String PROPERTY_PROGRAM_FOUND = "programFound"; + + public static final String PROPERTY_CRUISE_FOUND = "cruiseFound"; + + protected List<Program> programs; + + protected Program program; + + protected List<Cruise> cruises; + + protected Cruise cruise; + + public List<Program> getPrograms() { + return programs; + } + + public void setPrograms(List<Program> programs) { + Object oldValue = getPrograms(); + this.programs = programs; + + // nullify program +// setProgram(null); + firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs); + } + + public Program getProgram() { + return program; + } + + public void setProgram(Program program) { + Program oldValue = getProgram(); + this.program = program; + + // nullify cruises +// setCruises(null); + + firePropertyChange(PROPERTY_PROGRAM, oldValue, program); + firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null); + } + + public boolean isProgramFound() { + return program != null; + } + + public List<Cruise> getCruises() { + return cruises; + } + + public void setCruises(List<Cruise> cruises) { + Object oldValue = getCruises(); + this.cruises = cruises; + + // nullify cruise +// setCruise(null); + firePropertyChange(PROPERTY_CRUISES, oldValue, cruises); + } + + public Cruise getCruise() { + return cruise; + } + + public void setCruise(Cruise cruise) { + Cruise oldValue = getCruise(); + this.cruise = cruise; + firePropertyChange(PROPERTY_CRUISE, oldValue, cruise); + firePropertyChange(PROPERTY_CRUISE_FOUND, oldValue != null, cruise != null); + } + + public boolean isCruiseFound() { + return cruise != null; + } + +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.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/operation/FishingOperationTabUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,538 @@ +/* + * #%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% + */ + +JToolBar { + floatable: false; +} + +BeanComboBox { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; +} + +BeanListHeader { + showReset: true; + i18nPrefix: "tutti.property."; +} + +JList { + selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; + model: {new DefaultListModel()}; +} + +NumberEditor { + autoPopup: {handler.getConfig().isAutoPopupNumberEditor()}; + showPopupButton: {handler.getConfig().isShowNumberEditorButton()}; + bean: {model}; + showReset: true; +} + +SimpleTimeEditor { + bean: {model}; +} + +#stationNumberLabel { + text: "tutti.label.fishingOperation.stationNumber"; + labelFor: {stationNumberField}; +} + +#stationNumberField { + property: "stationNumber"; + model: {model.getStationNumber()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#fishingOperationNumberLabel { + text: "tutti.label.fishingOperation.fishingOperationNumber"; + labelFor: {fishingOperationNumberField}; +} + +#fishingOperationNumberField { + property: "fishingOperationNumber"; + model: {model.getFishingOperationNumber()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#dateLabel { + text: "tutti.label.fishingOperation.date"; + labelFor: {dateField}; +} + +#dateField { + date: {model.getDate()}; + formats: {"dd/MM/yyyy"}; +} + +#strataLabel { + text: "tutti.label.fishingOperation.strata"; + labelFor: {strataComboBox}; +} + +#strataComboBox { + property: "strata"; + selectedItem: {model.getStrata()}; +} + +#subStrataLabel { + text: "tutti.label.fishingOperation.subStrata"; + labelFor: {subStrataComboBox}; +} + +#subStrataComboBox { + property: "subStrata"; + selectedItem: {model.getSubStrata()}; +} + +#localiteLabel { + text: "tutti.label.fishingOperation.localite"; + labelFor: {localiteField}; +} + +#localiteField { + text: {model.getLocalite()}; +} + +#gearLongitudeLabel { + text: "tutti.label.fishingOperation.gearLongitude"; +} + +#gearLatitudeLabel { + text: "tutti.label.fishingOperation.gearLatitude"; +} + +#gearDateLabel { + text: "tutti.label.fishingOperation.gearDate"; +} + +#gearTimeLabel { + text: "tutti.label.fishingOperation.gearTime"; +} + +#gearShootingStartLabel { + text: "tutti.label.fishingOperation.gearShootingStart"; +} + +#gearShootingEndLabel { + text: "tutti.label.fishingOperation.gearShootingEnd"; +} + +#gearShootingStartLongitudeField { + text: {getStringValue(model.getGearShootingStartLongitude())}; +} + +#gearShootingStartLatitudeField { + text: {getStringValue(model.getGearShootingStartLatitude())}; +} + +#gearShootingStartDateField { + date: {model.getGearShootingStartDate()}; + formats: {"dd/MM/yyyy"}; +} + +#gearShootingStartTimeField { + property: "gearShootingStartDate"; + date: {model.getGearShootingStartDate()}; +} + +#gearShootingEndLongitudeField { + text: {getStringValue(model.getGearShootingEndLongitude())}; +} + +#gearShootingEndLatitudeField { + text: {getStringValue(model.getGearShootingEndLatitude())}; +} + +#gearShootingEndDateField { + date: {model.getGearShootingEndDate()}; + formats: {"dd/MM/yyyy"}; +} + +#gearShootingEndTimeField { + property: "gearShootingEndDate"; + date: {model.getGearShootingEndDate()}; +} + +#fishingOperationValidPanel { + floatable: false; + borderPainted: false; + opaque: false; +} + +#resetValidStateButton { + actionIcon: "reset"; + text: "tutti.action.reset.fishingOperationValidState"; +} + +#fishingOperationValidRadio { + text: "tutti.label.fishingOperation.fishingOperationValid"; + selected: {model.getFishingOperationValid() == Boolean.TRUE}; + buttonGroup: "fishingOperationValid"; +} + +#fishingOperationInvalidRadio { + text: "tutti.label.fishingOperation.fishingOperationInvalid"; + selected: {model.getFishingOperationValid() == Boolean.FALSE}; + buttonGroup: "fishingOperationValid"; +} +#fishingOperationResetRadio { + selected: {model.getFishingOperationValid() == null}; + buttonGroup: "fishingOperationValid"; +} + +#fishingOperationRectiligneCheckBox { + text: "tutti.label.fishingOperation.fishingOperationRectiligne"; + selected: {model.isFishingOperationRectiligne()}; +} + +#distanceChaluteeLabel { + text: "tutti.label.fishingOperation.distanceChalutee"; + labelFor: {distanceChaluteeField}; +} + +#distanceChaluteeField { + property: "distanceChalutee"; + model: {model.getDistanceChalutee()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; + enabled: {!model.isFishingOperationRectiligne()}; +} + +#beaufortScaleLabel { + text: "tutti.label.fishingOperation.beaufortScale"; + labelFor: {beaufortScaleComboBox}; +} + +#beaufortScaleComboBox { + property: "beaufortScale"; + selectedItem: {model.getBeaufortScale()}; +} + +#windDirectionLabel { + text: "tutti.label.fishingOperation.windDirection"; + labelFor: {windDirectionField}; +} + +#windDirectionField { + property: "windDirection"; + model: {model.getWindDirection()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#seaStateLabel { + text: "tutti.label.fishingOperation.seaState"; + labelFor: {seaStateComboBox}; +} + +#seaStateComboBox { + property: "seaState"; + selectedItem: {model.getSeaState()}; +} + +#ouvertureHorizontaleLabel { + text: "tutti.label.fishingOperation.ouvertureHorizontale"; + labelFor: {ouvertureHorizontaleField}; +} + +#ouvertureHorizontaleVerticaleLabel { + text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale"; +} + +#ouvertureHorizontaleField { + property: "ouvertureHorizontale"; + model: {model.getOuvertureHorizontale()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#ouvertureVerticaleLabel { + text: "tutti.label.fishingOperation.ouvertureVerticale"; + labelFor: {ouvertureVerticaleField}; +} + +#ouvertureVerticaleField { + property: "ouvertureVerticale"; + model: {model.getOuvertureVerticale()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#geometrieMesureeCheckBox { + text: "tutti.label.fishingOperation.geometrieMesuree"; + selected: {model.isGeometrieMesuree()}; +} + +#longueurFunesLabel { + text: "tutti.label.fishingOperation.longueurFunes"; + labelFor: {longueurFunesField}; +} + +#longueurFunesBrasLabel { + text: "tutti.label.fishingOperation.longueurFunesBras"; +} + +#longueurFunesField { + property: "longueurFunes"; + model: {model.getLongueurFunes()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#longueurBrasLabel { + text: "tutti.label.fishingOperation.longueurBras"; + labelFor: {longueurBrasField}; +} + +#longueurBrasField { + property: "longueurBras"; + model: {model.getLongueurBras()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#systemeFermetureCulCheckBox { + text: "tutti.label.fishingOperation.systemeFermetureCul"; + selected: {model.isSystemeFermetureCul()}; +} + +#dureeLabel { + text: "tutti.label.fishingOperation.duree"; + labelFor: {dureeField}; +} + +#dureeField { + property: "duree"; + model: {model.getDuree()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#saisisseurPane { + horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#saisisseurHeader { + labelText: {_("tutti.label.list.saisisseur")}; + list: {saisisseurList}; + beanType: {Person.class}; +} + +#commentPane { + columnHeaderView: {new JLabel(_("tutti.label.comment"))}; + minimumSize: {new Dimension(10,50)}; +} + +#commentField { + text: {model.getComment()}; +} + +#gearShootingStartDepthLabel { + text: "tutti.label.fishingOperation.gearShootingStartDepth"; + labelFor: {gearShootingStartDepthField}; +} + +#gearShootingStartDepthField { + property: "gearShootingStartDepth"; + model: {model.getGearShootingStartDepth()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndDepthLabel { + text: "tutti.label.fishingOperation.gearShootingEndDepth"; + labelFor: {gearShootingEndDepthField}; +} + +#gearShootingEndDepthField { + property: "gearShootingEndDepth"; + model: {model.getGearShootingEndDepth()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartSurfaceTemperatureLabel { + text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature"; + labelFor: {gearShootingStartSurfaceTemperatureField}; +} + +#gearShootingStartSurfaceTemperatureField { + property: "gearShootingStartSurfaceTemperature"; + model: {model.getGearShootingStartSurfaceTemperature()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndSurfaceTemperatureLabel { + text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature"; + labelFor: {gearShootingEndSurfaceTemperatureField}; +} + +#gearShootingEndSurfaceTemperatureField { + property: "gearShootingEndSurfaceTemperature"; + model: {model.getGearShootingEndSurfaceTemperature()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartBottomTemperatureLabel { + text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature"; + labelFor: {gearShootingStartBottomTemperatureField}; +} + +#gearShootingStartBottomTemperatureField { + property: "gearShootingStartBottomTemperature"; + model: {model.getGearShootingStartBottomTemperature()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndBottomTemperatureLabel { + text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature"; + labelFor: {gearShootingEndBottomTemperatureField}; +} + +#gearShootingEndBottomTemperatureField { + property: "gearShootingEndBottomTemperature"; + model: {model.getGearShootingEndBottomTemperature()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#averageBottomTemperatureLabel { + text: "tutti.label.fishingOperation.averageBottomTemperature"; + labelFor: {averageBottomTemperatureField}; +} + +#averageBottomTemperatureField { + property: "averageBottomTemperature"; + model: {model.getAverageBottomTemperature()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartSurfaceSalinityLabel { + text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity"; + labelFor: {gearShootingStartSurfaceSalinityField}; +} + +#gearShootingStartSurfaceSalinityField { + property: "gearShootingStartSurfaceSalinity"; + model: {model.getGearShootingStartSurfaceSalinity()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndSurfaceSalinityLabel { + text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity"; + labelFor: {gearShootingEndSurfaceSalinityField}; +} + +#gearShootingEndSurfaceSalinityField { + property: "gearShootingEndSurfaceSalinity"; + model: {model.getGearShootingEndSurfaceSalinity()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartBottomSalinityLabel { + text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity"; + labelFor: {gearShootingStartBottomSalinityField}; +} + +#gearShootingStartBottomSalinityField { + property: "gearShootingStartBottomSalinity"; + model: {model.getGearShootingStartBottomSalinity()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndBottomSalinityLabel { + text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity"; + labelFor: {gearShootingEndBottomSalinityField}; +} + +#gearShootingEndBottomSalinityField { + property: "gearShootingEndBottomSalinity"; + model: {model.getGearShootingEndBottomSalinity()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#averageBottomSalinityLabel { + text: "tutti.label.fishingOperation.averageBottomSalinity"; + labelFor: {averageBottomSalinityField}; +} + +#averageBottomSalinityField { + property: "averageBottomSalinity"; + model: {model.getAverageBottomSalinity()}; + useFloat: false; + numberPattern: {INT_6_DIGITS_PATTERN}; +} + +#noTraitPane { + text: "tutti.label.no.fishingOperation.selected"; + horizontalAlignment: {JLabel.CENTER}; +} + +#saveButton { + actionIcon: "save"; + text: "tutti.action.save"; + enabled: {model.isModify() && model.isValid()}; +} + +#cancelButton { + actionIcon: "cancel"; + text: "tutti.action.cancel"; + enabled: {model.isModify()}; +} + +#importPupitriButton { + actionIcon: "pupitri-import"; + text: "tutti.action.pupitri-import"; +} + +#importCasinoButton { + actionIcon: "casino-import"; + text: "tutti.action.casino-import"; +} + +#messagePanel { + border: {BorderFactory.createTitledBorder("Messages")}; + height: 200; + width: 500; +} + +#errorTable { + rowSelectionAllowed: true; + autoCreateRowSorter: true; + autoResizeMode: 2; + cellSelectionEnabled: false; + selectionMode: 0; + model: {errorTableModel}; +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css ___________________________________________________________________ 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/operation/FishingOperationTabUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,550 @@ +<!-- + #%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<FishingOperationTabUIModel, FishingOperationTabUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.referential.BeaufortScale + fr.ifremer.tutti.persistence.entities.referential.SeaState + fr.ifremer.tutti.persistence.entities.referential.Strata + fr.ifremer.tutti.persistence.entities.data.FishingOperation + fr.ifremer.tutti.persistence.entities.referential.Person + + fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor + + jaxx.runtime.swing.editor.bean.BeanComboBox + jaxx.runtime.swing.editor.bean.BeanListHeader + jaxx.runtime.swing.editor.NumberEditor + jaxx.runtime.swing.editor.TimeEditor + + jaxx.runtime.validator.swing.SwingValidatorUtil + jaxx.runtime.validator.swing.SwingValidatorMessageTableModel + + org.jdesktop.swingx.JXDatePicker + + java.awt.Dimension + + javax.swing.DefaultListModel + javax.swing.ListSelectionModel + + static org.nuiton.i18n.I18n._ + static jaxx.runtime.SwingUtil.getStringValue + </import> + + <script><![CDATA[ + +public FishingOperationTabUI(FishingOperationsUI parentUI) { + FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); +} + +public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); } + +protected void $afterCompleteSetup() { handler.afterInitUI(); } + ]]></script> + + <FishingOperationTabUIHandler id='handler' + initializer='getContextValue(FishingOperationTabUIHandler.class)'/> + + <FishingOperationTabUIModel id='model' + initializer='getContextValue(FishingOperationTabUIModel.class)'/> + + <SwingValidatorMessageTableModel id='errorTableModel'/> + + <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' + uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> + <field name='stationNumber' component='stationNumberField'/> + <field name='fishingOperationNumber' + component='fishingOperationNumberField'/> + <field name='date' component='dateField'/> + <field name='comment' component='commentField'/> + <field name='saisisseur' component='saisisseurPane'/> + </BeanValidator> + + <JPanel id='traitPane' constraints='BorderLayout.CENTER' + layout='{new BorderLayout()}'> + + <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'> + <tab id='traitGeneralTab' + title='tutti.label.tab.fishingOperation.general'> + <Table fill='both' id='generalForm'> + + <!-- Numero station / Numéro trait / Date --> + <row> + <cell anchor='west'> + <JLabel id='stationNumberLabel'/> + </cell> + <cell weightx='0.3'> + <NumberEditor id='stationNumberField' constructorParams='this'/> + </cell> + <cell> + <JLabel id='fishingOperationNumberLabel'/> + </cell> + <cell weightx='0.3'> + <NumberEditor id='fishingOperationNumberField' + constructorParams='this'/> + </cell> + <cell> + <JLabel id='dateLabel'/> + </cell> + <cell weightx='0.3'> + <JXDatePicker id='dateField' + onActionPerformed='handler.setDate(event, "date")'/> + </cell> + </row> + + <!-- Strate d'association / Sous Strate / Localité --> + <row> + <cell> + <JLabel id='strataLabel'/> + </cell> + <cell weightx='0.3'> + <BeanComboBox id='strataComboBox' constructorParams='this' + genericType='Strata'/> + </cell> + <cell> + <JLabel id='subStrataLabel'/> + </cell> + <cell weightx='0.3'> + <BeanComboBox id='subStrataComboBox' constructorParams='this' + genericType='Strata'/> + </cell> + <cell> + <JLabel id='localiteLabel'/> + </cell> + <cell weightx='0.3'> + <JTextField id='localiteField' + onKeyReleased='handler.setText(event, "localite")'/> + </cell> + </row> + + <!-- début de traine long-lat-date-heure + fin de traine long-lat-date-heure --> + <row> + <cell columns='6'> + <JPanel layout="{new BorderLayout()}"> + <Table id="gearCaracteristicsTable" fill="both" weightx='1' + constraints='BorderLayout.CENTER'> + <row> + <cell> + <JLabel/> + </cell> + <cell> + <JLabel id='gearLongitudeLabel'/> + </cell> + <cell> + <JLabel id='gearLatitudeLabel'/> + </cell> + <cell> + <JLabel id='gearDateLabel'/> + </cell> + <cell> + <JLabel id='gearTimeLabel'/> + </cell> + </row> + + <row> + <cell> + <JLabel id='gearShootingStartLabel'/> + </cell> + <cell> + <JTextField id='gearShootingStartLongitudeField' + onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/> + </cell> + <cell> + <JTextField id='gearShootingStartLatitudeLabel' + onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/> + </cell> + <cell> + <JXDatePicker id='gearShootingStartDateField' + onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/> + </cell> + <cell> + <SimpleTimeEditor id='gearShootingStartTimeField' + constructorParams='this'/> + </cell> + </row> + <row> + <cell> + <JLabel id='gearShootingEndLabel'/> + </cell> + <cell> + <JTextField id='gearShootingEndLongitudeField' + onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/> + </cell> + <cell> + <JTextField id='gearShootingEndLatitudeLabel' + onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/> + </cell> + <cell> + <JXDatePicker id='gearShootingEndDateField' + onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/> + </cell> + <cell> + <SimpleTimeEditor id='gearShootingEndTimeField' + constructorParams='this'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + + <!-- Fishing operation valid / invalid--> + <row> + <cell columns="2"> + <JToolBar id='fishingOperationValidPanel' + layout='{new BorderLayout()}'> + <JButton id='resetValidStateButton' + constraints='BorderLayout.WEST' + onActionPerformed="model.setFishingOperationValid(null)"/> + <JRadioButton id='fishingOperationResetRadio' + constraints='BorderLayout.EAST'/> + </JToolBar> + </cell> + <cell columns="2"> + <JRadioButton id='fishingOperationValidRadio' + onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/> + </cell> + <cell columns="2"> + <JRadioButton id='fishingOperationInvalidRadio' + onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/> + </cell> + </row> + + <!-- FishingOperation rectiligne / distance chalutee / durée --> + <row> + <cell> + <JCheckBox id='fishingOperationRectiligneCheckBox' + onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/> + </cell> + <cell columns="3"> + <JPanel layout="{new BorderLayout()}"> + <JLabel id='distanceChaluteeLabel' + constraints='BorderLayout.WEST'/> + <NumberEditor id='distanceChaluteeField' + constraints='BorderLayout.CENTER' + constructorParams='this'/> + </JPanel> + </cell> + <cell anchor='west'> + <JLabel id='dureeLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='dureeField' constructorParams='this'/> + </cell> + </row> + + <!-- Actions d'import --> + <row> + <cell columns='6'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton id='importPupitriButton' + onActionPerformed='handler.importPupitri()'/> + <JButton id='importCasinoButton' + onActionPerformed='handler.importCasino()'/> + </JPanel> + </cell> + </row> + + <!-- Saisisseur --> + <row weighty='0.3'> + <cell columns='6'> + <JScrollPane id='saisisseurPane' + columnHeaderView="{saisisseurHeader}" + onFocusGained='saisisseurList.requestFocus()'> + <JList id='saisisseurList' + onValueChanged='handler.selectListData(event, "saisisseur")'/> + <BeanListHeader id='saisisseurHeader' genericType='Person'/> + </JScrollPane> + </cell> + </row> + + <!-- Commentaire --> + <row weighty='0.3'> + <cell columns='6'> + <JScrollPane id='commentPane' + onFocusGained='commentField.requestFocus()'> + <JTextArea id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> + </JScrollPane> + </cell> + </row> + </Table> + </tab> + + <tab id='traitGearShootingTab' + title='tutti.label.tab.fishingOperation.gearShooting'> + + <Table fill='both' id='gearShootingForm'> + + <!-- GearShootingStart Depth --> + <row> + <cell> + <JLabel id='gearShootingStartDepthLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartDepthField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEnd Depth --> + <row> + <cell> + <JLabel id='gearShootingEndDepthLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndDepthField' + constructorParams='this'/> + </cell> + </row> + + <!-- Ouverture horizontale --> + <row> + <cell anchor='west'> + <JLabel id='ouvertureHorizontaleLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='ouvertureHorizontaleField' + constructorParams='this'/> + </cell> + </row> + + <!-- Ouverture verticale --> + <row> + <cell anchor='west'> + <JLabel id='ouvertureVerticaleLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='ouvertureVerticaleField' + constructorParams='this'/> + </cell> + </row> + + <!-- Longueur funes --> + <row> + <cell anchor='west'> + <JLabel id='longueurFunesLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='longueurFunesField' constructorParams='this'/> + </cell> + </row> + + <!-- Longueur bras --> + <row> + <cell anchor='west'> + <JLabel id='longueurBrasLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='longueurBrasField' constructorParams='this'/> + </cell> + </row> + + <!-- Système de fermeture du cul / Geometrie mesuree --> + <row> + <cell columns='2'> + <JPanel layout='{new GridLayout(1,0)}'> + <JCheckBox id='systemeFermetureCulCheckBox' + onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/> + <JCheckBox id='geometrieMesureeCheckBox' + onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/> + </JPanel> + </cell> + </row> + </Table> + </tab> + + <tab id='environmentTab' + title='tutti.label.tab.fishingOperation.environment'> + + <Table fill='both' id='environmentForm'> + + <!-- Beaufort scale --> + <row> + <cell anchor='west'> + <JLabel id='beaufortScaleLabel'/> + </cell> + <cell weightx='1.0'> + <BeanComboBox id='beaufortScaleComboBox' constructorParams='this' + genericType='BeaufortScale'/> + </cell> + </row> + + <!-- Wind direction --> + <row> + <cell anchor='west'> + <JLabel id='windDirectionLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='windDirectionField' constructorParams='this'/> + </cell> + </row> + + <!-- Sea state--> + <row> + <cell anchor='west'> + <JLabel id='seaStateLabel'/> + </cell> + <cell fill='horizontal'> + <BeanComboBox id='seaStateComboBox' constructorParams='this' + genericType='SeaState'/> + </cell> + </row> + </Table> + </tab> + + <tab id='traitHydrologyTabContent' + title='tutti.label.tab.fishingOperation.hydrology'> + + <Table fill='both' id='hydrologyForm'> + + <!-- GearShootingStartSurfaceTemperature --> + <row> + <cell> + <JLabel id='gearShootingStartSurfaceTemperatureLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartSurfaceTemperatureField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEndSurfaceTemperature --> + <row> + <cell> + <JLabel id='gearShootingEndSurfaceTemperatureLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndSurfaceTemperatureField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingStartBottomTemperature --> + <row> + <cell> + <JLabel id='gearShootingStartBottomTemperatureLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartBottomTemperatureField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEndBottomTemperature --> + <row> + <cell> + <JLabel id='gearShootingEndBottomTemperatureLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndBottomTemperatureField' + constructorParams='this'/> + </cell> + </row> + + <!-- AverageBottomTemperature --> + <row> + <cell> + <JLabel id='averageBottomTemperatureLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='averageBottomTemperatureField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingStartSurfaceSalinity --> + <row> + <cell> + <JLabel id='gearShootingStartSurfaceSalinityLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartSurfaceSalinityField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEndSurfaceSalinity --> + <row> + <cell> + <JLabel id='gearShootingEndSurfaceSalinityLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndSurfaceSalinityField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingStartBottomSalinity --> + <row> + <cell> + <JLabel id='gearShootingStartBottomSalinityLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartBottomSalinityField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEndBottomSalinity --> + <row> + <cell> + <JLabel id='gearShootingEndBottomSalinityLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndBottomSalinityField' + constructorParams='this'/> + </cell> + </row> + + <!-- AverageBottomSalinity --> + <row> + <cell> + <JLabel id='averageBottomSalinityLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='averageBottomSalinityField' + constructorParams='this'/> + </cell> + </row> + + </Table> + </tab> + </JTabbedPane> + + <!-- Actions --> + <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'> + <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='saveButton' onActionPerformed='handler.save()'/> + </JPanel> + </JPanel> + + </JPanel> + + <JLabel id='noTraitPane'/> +</JPanel> Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx ___________________________________________________________________ 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/operation/FishingOperationTabUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,242 @@ +package fr.ifremer.tutti.ui.swing.content.operation; + +/* + * #%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.FishingOperation; +import fr.ifremer.tutti.persistence.entities.referential.Person; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.List; + +/** + * Handler for UI {@link FishingOperationTabUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FishingOperationTabUIHandler.class); + + private final FishingOperationTabUI ui; + + private final FishingOperationsUI parentUi; + + private final PersistenceService persistenceService; + + public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) { + super(parentUi.getHandler().getContext()); + this.ui = ui; + this.parentUi = parentUi; + this.persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + FishingOperationTabUIModel model = new FishingOperationTabUIModel(); + model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + JPanel form = ui.getTraitPane(); + JLabel noContentPane = ui.getNoTraitPane(); + + Boolean empty = (Boolean) evt.getNewValue(); + ui.remove(form); + ui.remove(noContentPane); + if (empty) { + ui.add(noContentPane, BorderLayout.CENTER); + } else { + ui.add(form, BorderLayout.CENTER); + } + ui.repaint(); + } + }); + + listModelIsModify(model); + + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + + ui.getFishingOperationValidPanel().remove( + ui.getFishingOperationResetRadio()); + + FishingOperationTabUIModel model = ui.getModel(); + + initUI(ui); + + initBeanList(ui.getSaisisseurHeader(), + persistenceService.getAllPerson(), + model.getSaisisseur()); + + initBeanComboBox(ui.getBeaufortScaleComboBox(), + persistenceService.getAllBeaufortScale(), + model.getBeaufortScale()); + + initBeanComboBox(ui.getStrataComboBox(), + persistenceService.getAllStrata(), + model.getStrata()); + + initBeanComboBox(ui.getSeaStateComboBox(), + persistenceService.getAllSeaState(), + model.getSeaState()); + + model.setEmpty(true); + + listenValidatorValid(ui.getValidator(), getModel()); + } + + @Override + public void onCloseUI() { + } + + @Override + protected FishingOperationTabUIModel getModel() { + return ui.getModel(); + } + + public void selectFishingOperation(FishingOperation bean) { + + boolean empty = bean == null; + + FishingOperationTabUIModel model = getModel(); + + // clean previous selection + ui.getSaisisseurHeader().getList().clearSelection(); + + if (empty) { + + model.fromBean(new FishingOperation()); + } else { + + model.fromBean(bean); + } + + // update saisissuer selection + List<Person> saisisseur = model.getSaisisseur(); + if (CollectionUtils.isNotEmpty(saisisseur)) { + updateIndices(ui.getSaisisseurList(), saisisseur); + } + + // update model empty property + model.setEmpty(empty); + + // reload bean in validator (? really mandatory?) +// ui.getValidator().reloadBean(); + + // if new fishingOperation can already cancel his creation + model.setModify(!empty && model.isCreate()); + } + + public void cancel() { + + String id = getModel().getId(); + + if (log.isInfoEnabled()) { + log.info("Cancel edition for fishingOperation: " + id); + } + boolean newBean = StringUtils.isBlank(id); + + if (newBean) { + + // cancel to create a new fishingOperation + parentUi.getHandler().selectFishingOperation(null); + + } else { + + // reselect in ui the fishingOperation + FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation(); + parentUi.getHandler().selectFishingOperation(selectedFishingOperation); + } + } + + public void save() { + + // get fishingOperation to save + FishingOperation toSave = getModel().toBean(); + + if (log.isInfoEnabled()) { + log.info("Save edition for fishingOperation: " + toSave.getId()); + } + + // keep selected tab (to resotre it after save) + int selectedIndex = ui.getTraitTabPane().getSelectedIndex(); + + // persist current fishingOperation + parentUi.getHandler().saveFishingOperation(toSave); + + // reselect current tab + ui.getTraitTabPane().setSelectedIndex(selectedIndex); + + getModel().setModify(false); + } + + public void importPupitri() { + //TODO + } + + public void importCasino() { + //TODO + } + + public void setGearShootingStartLatitude(String text) { + getModel().setGearShootingStartLatitude(Float.valueOf(text)); + } + + public void setGearShootingStartLongitude(String text) { + getModel().setGearShootingStartLongitude(Float.valueOf(text)); + } + +// public void setGearShootingStartTime(String text) { +// getModel().setGearShootingStartTime(Integer.valueOf(text)); +// } + + public void setGearShootingEndLatitude(String text) { + getModel().setGearShootingEndLatitude(Float.valueOf(text)); + } + + public void setGearShootingEndLongitude(String text) { + getModel().setGearShootingEndLongitude(Float.valueOf(text)); + } + +// public void setGearShootingEndTime(String text) { +// getModel().setGearShootingEndTime(Integer.valueOf(text)); +// } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.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/operation/FishingOperationTabUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,633 @@ +package fr.ifremer.tutti.ui.swing.content.operation; + +/* + * #%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.FishingOperation; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale; +import fr.ifremer.tutti.persistence.entities.referential.Person; +import fr.ifremer.tutti.persistence.entities.referential.SeaState; +import fr.ifremer.tutti.persistence.entities.referential.Strata; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; + +import java.util.Date; +import java.util.List; + +/** + * Model for UI {@link FishingOperationTabUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_EMPTY = "empty"; + + public static final String PROPERTY_STATION_NUMBER = "stationNumber"; + + public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber"; + + public static final String PROPERTY_DATE = "date"; + + public static final String PROPERTY_STRATA = "strata"; + + public static final String PROPERTY_SUB_STRATA = "subStrata"; + + public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude"; + + public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude"; + + public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate"; + + public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth"; + + public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude"; + + public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude"; + + public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate"; + + public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth"; + + public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale"; + + public static final String PROPERTY_WIND_DIRECTION = "windDirection"; + + public static final String PROPERTY_SEA_STATE = "seaState"; + + public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale"; + + public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale"; + + public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree"; + + public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes"; + + public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras"; + + public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul"; + + public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne"; + + public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee"; + + public static final String PROPERTY_DUREE = "duree"; + + public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid"; + + public static final String PROPERTY_LOCALITE = "localite"; + + public static final String PROPERTY_COMMENT = "comment"; + + public static final String PROPERTY_SAISISSEUR = "saisisseur"; + + public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature"; + + public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature"; + + public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature"; + + public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature"; + + public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature"; + + public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity"; + + public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity"; + + public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity"; + + public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity"; + + public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity"; + + protected boolean empty; + + protected Cruise cruise; + + protected Integer stationNumber; + + protected Integer fishingOperationNumber; + + protected Date date; + + protected Strata strata; + + protected Strata subStrata; + + protected Float gearShootingStartLatitude; + + protected Float gearShootingStartLongitude; + + protected Date gearShootingStartDate; + + protected Integer gearShootingStartTime; + + protected Float gearShootingStartDepth; + + protected Float gearShootingEndLatitude; + + protected Float gearShootingEndLongitude; + + protected Date gearShootingEndDate; + + protected Integer 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 fishingOperationRectiligne; + + protected Float distanceChalutee; + + protected Float duree; + + protected Boolean fishingOperationValid; + + protected String localite; + + protected String comment; + + protected List<Person> 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 static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder = + BinderFactory.newBinder(FishingOperationTabUIModel.class, + FishingOperation.class); + + protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder = + BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class); + + public FishingOperationTabUIModel() { + super(FishingOperation.class, fromBeanBinder, toBeanBinder); + } + + public boolean isEmpty() { + return empty; + } + + public void setEmpty(boolean empty) { + Object oldValue = isEmpty(); + this.empty = empty; + firePropertyChange(PROPERTY_EMPTY, oldValue, empty); + } + + public Cruise getCruise() { + return cruise; + } + + public void setCruise(Cruise cruise) { + this.cruise = cruise; + } + + public Integer getStationNumber() { + return stationNumber; + } + + public void setStationNumber(Integer stationNumber) { + Object oldValue = getStationNumber(); + this.stationNumber = stationNumber; + firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber); + } + + public Integer getFishingOperationNumber() { + return fishingOperationNumber; + } + + public void setFishingOperationNumber(Integer fishingOperationNumber) { + Object oldValue = getFishingOperationNumber(); + this.fishingOperationNumber = fishingOperationNumber; + firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber); + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + Object oldValue = getDate(); + this.date = date; + firePropertyChange(PROPERTY_DATE, oldValue, date); + } + + public Strata getStrata() { + return strata; + } + + public void setStrata(Strata strata) { + Object oldValue = getStrata(); + this.strata = strata; + firePropertyChange(PROPERTY_STRATA, oldValue, strata); + } + + public Strata getSubStrata() { + return subStrata; + } + + public void setSubStrata(Strata subStrata) { + Object oldValue = getSubStrata(); + this.subStrata = subStrata; + firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata); + } + + public Float getGearShootingStartLatitude() { + return gearShootingStartLatitude; + } + + public void setGearShootingStartLatitude(Float gearShootingStartLatitude) { + Object oldValue = getGearShootingStartLatitude(); + this.gearShootingStartLatitude = gearShootingStartLatitude; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude); + } + + public Float getGearShootingStartLongitude() { + return gearShootingStartLongitude; + } + + public void setGearShootingStartLongitude(Float gearShootingStartLongitude) { + Object oldValue = getGearShootingStartLongitude(); + this.gearShootingStartLongitude = gearShootingStartLongitude; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude); + } + + public Date getGearShootingStartDate() { + return gearShootingStartDate; + } + + public void setGearShootingStartDate(Date gearShootingStartDate) { + Object oldValue = getGearShootingStartDate(); + this.gearShootingStartDate = gearShootingStartDate; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate); + } + + public Float getGearShootingStartDepth() { + return gearShootingStartDepth; + } + + public void setGearShootingStartDepth(Float gearShootingStartDepth) { + Object oldValue = getGearShootingStartDepth(); + this.gearShootingStartDepth = gearShootingStartDepth; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth); + } + + public Float getGearShootingEndLatitude() { + return gearShootingEndLatitude; + } + + public void setGearShootingEndLatitude(Float gearShootingEndLatitude) { + Object oldValue = getGearShootingEndLatitude(); + this.gearShootingEndLatitude = gearShootingEndLatitude; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude); + } + + public Float getGearShootingEndLongitude() { + return gearShootingEndLongitude; + } + + public void setGearShootingEndLongitude(Float gearShootingEndLongitude) { + Object oldValue = getGearShootingEndLongitude(); + this.gearShootingEndLongitude = gearShootingEndLongitude; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude); + } + + public Date getGearShootingEndDate() { + return gearShootingEndDate; + } + + public void setGearShootingEndDate(Date gearShootingEndDate) { + Object oldValue = getGearShootingEndDate(); + this.gearShootingEndDate = gearShootingEndDate; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate); + } + + public Float getGearShootingEndDepth() { + return gearShootingEndDepth; + } + + public void setGearShootingEndDepth(Float gearShootingEndDepth) { + Object oldValue = getGearShootingEndDepth(); + this.gearShootingEndDepth = gearShootingEndDepth; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth); + } + + public BeaufortScale getBeaufortScale() { + return beaufortScale; + } + + public void setBeaufortScale(BeaufortScale beaufortScale) { + Object oldValue = getBeaufortScale(); + this.beaufortScale = beaufortScale; + firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale); + } + + public Integer getWindDirection() { + return windDirection; + } + + public void setWindDirection(Integer windDirection) { + Object oldValue = getWindDirection(); + this.windDirection = windDirection; + firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection); + } + + public SeaState getSeaState() { + return seaState; + } + + public void setSeaState(SeaState seaState) { + Object oldValue = getSeaState(); + this.seaState = seaState; + firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState); + } + + public Float getOuvertureHorizontale() { + return ouvertureHorizontale; + } + + public void setOuvertureHorizontale(Float ouvertureHorizontale) { + Object oldValue = getOuvertureHorizontale(); + this.ouvertureHorizontale = ouvertureHorizontale; + firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale); + } + + public Float getOuvertureVerticale() { + return ouvertureVerticale; + } + + public void setOuvertureVerticale(Float ouvertureVerticale) { + Object oldValue = getOuvertureVerticale(); + this.ouvertureVerticale = ouvertureVerticale; + firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale); + } + + public boolean isGeometrieMesuree() { + return geometrieMesuree; + } + + public void setGeometrieMesuree(boolean geometrieMesuree) { + Object oldValue = isGeometrieMesuree(); + this.geometrieMesuree = geometrieMesuree; + firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree); + } + + public Float getLongueurFunes() { + return longueurFunes; + } + + public void setLongueurFunes(Float longueurFunes) { + Object oldValue = getLongueurFunes(); + this.longueurFunes = longueurFunes; + firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes); + } + + public Float getLongueurBras() { + return longueurBras; + } + + public void setLongueurBras(Float longueurBras) { + Object oldValue = getLongueurBras(); + this.longueurBras = longueurBras; + firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras); + } + + public boolean isSystemeFermetureCul() { + return systemeFermetureCul; + } + + public void setSystemeFermetureCul(boolean systemeFermetureCul) { + Object oldValue = isSystemeFermetureCul(); + this.systemeFermetureCul = systemeFermetureCul; + firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul); + } + + public boolean isFishingOperationRectiligne() { + return fishingOperationRectiligne; + } + + public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) { + Object oldValue = isFishingOperationRectiligne(); + this.fishingOperationRectiligne = fishingOperationRectiligne; + firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne); + } + + public Float getDistanceChalutee() { + return distanceChalutee; + } + + public void setDistanceChalutee(Float distanceChalutee) { + Object oldValue = getDistanceChalutee(); + this.distanceChalutee = distanceChalutee; + firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee); + } + + public Float getDuree() { + return duree; + } + + public void setDuree(Float duree) { + Object oldValue = getDuree(); + this.duree = duree; + firePropertyChange(PROPERTY_DUREE, oldValue, duree); + } + + public Boolean getFishingOperationValid() { + return fishingOperationValid; + } + + public void setFishingOperationValid(Boolean fishingOperationValid) { + Object oldValue = getFishingOperationValid(); + this.fishingOperationValid = fishingOperationValid; + firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid); + } + + public String getLocalite() { + return localite; + } + + public void setLocalite(String localite) { + Object oldValue = getLocalite(); + this.localite = localite; + firePropertyChange(PROPERTY_LOCALITE, oldValue, localite); + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = getComment(); + this.comment = comment; + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); + } + + public List<Person> getSaisisseur() { + return saisisseur; + } + + public void setSaisisseur(List<Person> saisisseur) { + this.saisisseur = saisisseur; + firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur); + } + + public Float getGearShootingStartSurfaceTemperature() { + return gearShootingStartSurfaceTemperature; + } + + public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) { + Object oldValue = getGearShootingStartSurfaceTemperature(); + this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature); + } + + public Float getGearShootingEndSurfaceTemperature() { + return gearShootingEndSurfaceTemperature; + } + + public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) { + Object oldValue = getGearShootingEndSurfaceTemperature(); + this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature); + } + + public Float getGearShootingStartBottomTemperature() { + return gearShootingStartBottomTemperature; + } + + public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) { + Object oldValue = getGearShootingStartBottomTemperature(); + this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature); + } + + public Float getGearShootingEndBottomTemperature() { + return gearShootingEndBottomTemperature; + } + + public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) { + Object oldValue = getGearShootingEndBottomTemperature(); + this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature); + } + + public Float getAverageBottomTemperature() { + return averageBottomTemperature; + } + + public void setAverageBottomTemperature(Float averageBottomTemperature) { + Object oldValue = getAverageBottomTemperature(); + this.averageBottomTemperature = averageBottomTemperature; + firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature); + } + + public Float getGearShootingStartSurfaceSalinity() { + return gearShootingStartSurfaceSalinity; + } + + public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) { + Object oldValue = getGearShootingStartSurfaceSalinity(); + this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity); + } + + public Float getGearShootingEndSurfaceSalinity() { + return gearShootingEndSurfaceSalinity; + } + + public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) { + Object oldValue = getGearShootingEndSurfaceSalinity(); + this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity); + } + + public Float getGearShootingStartBottomSalinity() { + return gearShootingStartBottomSalinity; + } + + public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) { + Object oldValue = getGearShootingStartBottomSalinity(); + this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity); + } + + public Float getGearShootingEndBottomSalinity() { + return gearShootingEndBottomSalinity; + } + + public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) { + Object oldValue = getGearShootingEndBottomSalinity(); + this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity); + } + + public Float getAverageBottomSalinity() { + return averageBottomSalinity; + } + + public void setAverageBottomSalinity(Float averageBottomSalinity) { + Object oldValue = getAverageBottomSalinity(); + this.averageBottomSalinity = averageBottomSalinity; + firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity); + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.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/operation/FishingOperationsUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,64 @@ +/* + * #%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% + */ + +BeanComboBox { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; +} + +#newFishingOperationButton { + text: "tutti.action.new"; + actionIcon: "add"; +} + +#traitComboBox { + property: "selectedFishingOperation"; + selectedItem: {model.getSelectedFishingOperation()}; +} + +#speciesTab { + enabled: {model.getSelectedFishingOperation() != null}; +} + +#benthosTab { + enabled: {model.getSelectedFishingOperation() != null}; +} + +#planctonTab { + enabled: {model.getSelectedFishingOperation() != null}; +} + +#macroDechetTab { + enabled: {model.getSelectedFishingOperation() != null}; +} + +#accidentelTab { + enabled: {model.getSelectedFishingOperation() != null}; +} + +#observationIndividuelTab { + enabled: {false}; + /*enabled: {model.getSelectedFishingOperation() != null};*/ +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css ___________________________________________________________________ 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/operation/FishingOperationsUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,99 @@ +<!-- + #%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<FishingOperationsUIModel, FishingOperationsUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.data.FishingOperation + + fr.ifremer.tutti.ui.swing.TuttiUIContext + fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI + fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI + fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI + fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI + fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI + + jaxx.runtime.swing.editor.bean.BeanComboBox + + static org.nuiton.i18n.I18n._ + </import> + + <script><![CDATA[ +public FishingOperationsUI(TuttiUIContext context) { + FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); +} + +protected void $afterCompleteSetup() { + handler.afterInitUI(); +} + ]]></script> + + <FishingOperationsUIHandler id='handler' + initializer='getContextValue(FishingOperationsUIHandler.class)'/> + + <FishingOperationsUIModel id='model' + initializer='getContextValue(FishingOperationsUIModel.class)'/> + + <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'> + + <!-- FishingOperations fishingOperation --> + <row> + <cell anchor='west' weightx='1.0'> + <BeanComboBox id='traitComboBox' constructorParams='this' + genericType='FishingOperation'/> + </cell> + <cell anchor='east'> + <JButton id='newFishingOperationButton' + onActionPerformed='getHandler().createNewFishingOperation()'/> + </cell> + </row> + </Table> + + <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'> + <tab id='traitTab' title='tutti.label.tab.fishingOperation'> + <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/> + </tab> + <tab id='speciesTab' title='tutti.label.tab.species'> + <SpeciesTabUI id='speciesTabContent' constructorParams='this'/> + </tab> + <tab id='benthosTab' title='tutti.label.tab.benthos'> + <BenthosTabUI id='benthosTabContent' constructorParams='this'/> + </tab> + <tab id='planctonTab' title='tutti.label.tab.plancton'> + <PlanctonTabUI id='planctonTabContent' constructorParams='this'/> + </tab> + <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'> + <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/> + </tab> + <tab id='accidentelTab' title='tutti.label.tab.accidentel'> + <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/> + </tab> + <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> + </tab> + </JTabbedPane> + +</JPanel> \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx ___________________________________________________________________ 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/operation/FishingOperationsUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,209 @@ +package fr.ifremer.tutti.ui.swing.content.operation; + +/* + * #%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.TuttiEntities; +import fr.ifremer.tutti.persistence.entities.data.FishingOperation; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Date; +import java.util.List; + +/** + * Handler of UI {@link FishingOperationsUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> { + + /** Logger. */ + private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class); + + private final FishingOperationsUI ui; + + private final PersistenceService persistenceService; + + public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) { + super(context); + this.ui = ui; + persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + FishingOperationsUIModel model = new FishingOperationsUIModel(); + + String cruiseId = context.getCruiseId(); + + // load existing cruise + Cruise cruise = persistenceService.getCruise(cruiseId); + model.setCruise(cruise); + + List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(cruiseId); + model.setFishingOperation(fishingOperations); + + if (log.isInfoEnabled()) { + log.info("Loaded " + fishingOperations.size() + " fishingOperation(s)."); + } + + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + + FishingOperationsUIModel model = getModel(); + + initUI(ui); + + List<FishingOperation> fishingOperations = model.getFishingOperation(); + + initBeanComboBox(ui.getTraitComboBox(), + fishingOperations, + model.getSelectedFishingOperation()); + + model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + selectFishingOperation((FishingOperation) evt.getNewValue()); + } + }); + + model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + ui.getTraitComboBox().setData(null); + ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue()); + } + }); + + if (!fishingOperations.isEmpty()) { + + model.setSelectedFishingOperation(fishingOperations.get(0)); + } + } + + @Override + public void onCloseUI() { + + // ui will be saved so we do not want to keep selected tab indexes + ui.getTabPane().setSelectedIndex(0); + ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0); + + // when quitting ui, let's de-select fishingOperation (will save any changes) + selectFishingOperation(null); + } + + @Override + protected FishingOperationsUIModel getModel() { + return ui.getModel(); + } + + public void createNewFishingOperation() { + + // deselect selected fishingOperation + getModel().setSelectedFishingOperation(null); + + // use a new empty fishingOperation + FishingOperation newFishingOperation = new FishingOperation(); + newFishingOperation.setCruise(getModel().getCruise()); + + // by default use the current day with no time information + Date currentDate = new Date(); + currentDate = DateUtils.setHours(currentDate, 0); + currentDate = DateUtils.setMinutes(currentDate, 0); + + newFishingOperation.setDate(currentDate); + newFishingOperation.setGearShootingStartDate(currentDate); + newFishingOperation.setGearShootingEndDate(currentDate); + selectFishingOperation(newFishingOperation); + } + + public void selectFishingOperation(FishingOperation fishingOperation) { + + if (log.isInfoEnabled()) { + log.info("New selected fishingOperation: " + fishingOperation); + } + // back to fishingOperation tab + ui.getTabPane().setSelectedIndex(0); + + // back to general tab of fishingOperation tabs + ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0); + + // propagate fishingOperation to his tabs + ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation); + ui.getSpeciesTabContent().selectFishingOperation(fishingOperation); + ui.getBenthosTabContent().selectFishingOperation(fishingOperation); + ui.getPlanctonTabContent().selectFishingOperation(fishingOperation); + ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation); + ui.getAccidentelTabContent().selectFishingOperation(fishingOperation); + + // repaint tabs + ui.getTabPane().repaint(); +// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation); + } + + public void saveFishingOperation(FishingOperation toSave) { + + // persist the fishingOperation + + boolean create = toSave.getId() == null; + + FishingOperation savedFishingOperation; + if (create) { + savedFishingOperation = persistenceService.createFishingOperation(toSave); + } else { + savedFishingOperation = persistenceService.saveFishingOperation(toSave); + } + + FishingOperationsUIModel model = getModel(); + + // add the saved fishingOperation to fishingOperation list + + List<FishingOperation> data = model.getFishingOperation(); + + FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId()); + if (existingFishingOperation != null) { + data.remove(existingFishingOperation); + } + data.add(savedFishingOperation); + + // update model fishingOperation list + model.setFishingOperation(data); + + // update model selected fishingOperation + model.setSelectedFishingOperation(savedFishingOperation); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.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/operation/FishingOperationsUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,83 @@ +package fr.ifremer.tutti.ui.swing.content.operation; + +/* + * #%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.Cruise; +import fr.ifremer.tutti.persistence.entities.data.FishingOperation; +import org.jdesktop.beans.AbstractSerializableBean; + +import java.util.List; + +/** + * Model fo UI {@link FishingOperationsUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FishingOperationsUIModel extends AbstractSerializableBean { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_FISHING_OPERATION = "fishingOperation"; + + public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation"; + + public static final String PROPERTY_CRUISE = "cruise"; + + protected List<FishingOperation> fishingOperation; + + protected FishingOperation selectedFishingOperation; + + protected Cruise cruise; + + public List<FishingOperation> getFishingOperation() { + return fishingOperation; + } + + public void setFishingOperation(List<FishingOperation> fishingOperation) { + this.fishingOperation = fishingOperation; + firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation); + } + + public FishingOperation getSelectedFishingOperation() { + return selectedFishingOperation; + } + + public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) { + Object oldValue = getSelectedFishingOperation(); + this.selectedFishingOperation = selectedFishingOperation; + firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation); + } + + public Cruise getCruise() { + return cruise; + } + + public void setCruise(Cruise cruise) { + Object oldValue = getCruise(); + this.cruise = cruise; + firePropertyChange(PROPERTY_CRUISE, oldValue, cruise); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.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/program/EditProgramUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,94 @@ +/* + * #%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% + */ + +BeanComboBox { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; +} + +#splitPane { + orientation: {JSplitPane.VERTICAL_SPLIT}; + resizeWeight: 0.3; + oneTouchExpandable: true; + continuousLayout: true; +} + +#form { + border: {BorderFactory.createTitledBorder((String)null)}; +} + +#nameLabel { + text: "tutti.label.program.name"; + labelFor: {nameField}; +} + +#nameField { + text: {model.getName()}; +} + +#commentPane { + columnHeaderView: {new JLabel(_("tutti.label.comment"))}; + minimumSize: {new Dimension(10,50)}; +} + +#commentField { + text: {getStringValue(model.getComment())}; +} + +#zoneLabel { + text: "tutti.label.program.zone"; + labelFor: {zoneComboBox}; +} + +#zoneComboBox { + property: "zone"; + selectedItem: {model.getZone()}; +} + +#saveButton { + text: "tutti.action.save"; + enabled: {model.isModify() && model.isValid()}; + actionIcon: "save"; +} + +#cancelButton { + text: "tutti.action.cancel"; + actionIcon: "cancel"; +} + +#messagePanel { + border: {BorderFactory.createTitledBorder("Messages")}; + height: 200; + width: 500; +} + +#errorTable { + rowSelectionAllowed: true; + autoCreateRowSorter: true; + autoResizeMode: 2; + cellSelectionEnabled: false; + selectionMode: 0; + model: {errorTableModel}; +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css ___________________________________________________________________ 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/program/EditProgramUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,125 @@ +<!-- + #%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<EditProgramUIModel, EditProgramUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.referential.Zone + fr.ifremer.tutti.ui.swing.TuttiUIContext + + jaxx.runtime.swing.editor.bean.BeanComboBox + jaxx.runtime.validator.swing.SwingValidatorUtil + jaxx.runtime.validator.swing.SwingValidatorMessageTableModel + + java.awt.Dimension + + static org.nuiton.i18n.I18n._ + static jaxx.runtime.SwingUtil.getStringValue + + </import> + + <script><![CDATA[ + + public EditProgramUI(TuttiUIContext context) { + EditProgramUIHandler handler = new EditProgramUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <EditProgramUIHandler id='handler' + initializer='getContextValue(EditProgramUIHandler.class)'/> + + <EditProgramUIModel id='model' + initializer='getContextValue(EditProgramUIModel.class)'/> + + <SwingValidatorMessageTableModel id='errorTableModel'/> + + <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' + uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> + <field name='name' component='nameField'/> + <field name='zone' component='zoneComboBox'/> + <field name='comment' component='commentField'/> + </BeanValidator> + + <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> + + <Table id='form' fill='both'> + + <!-- program name --> + <row> + <cell anchor='west'> + <JLabel id='nameLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='nameField' + onKeyReleased='handler.setText(event, "name")'/> + </cell> + </row> + + <!-- program zone --> + <row> + <cell> + <JLabel id='zoneLabel'/> + </cell> + <cell> + <BeanComboBox id='zoneComboBox' constructorParams='this' + genericType='Zone'/> + </cell> + </row> + + <!-- program comment --> + <row weighty='0.8'> + <cell columns='2'> + <JScrollPane id='commentPane' + onFocusGained='commentField.requestFocus()'> + <JTextArea id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> + </JScrollPane> + </cell> + </row> + + <!-- actions --> + <row anchor='south'> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0)}'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='saveButton' onActionPerformed='handler.save()'/> + </JPanel> + </cell> + </row> + </Table> + + <!-- validation messages --> + <JPanel id='messagePanel' layout='{new GridLayout()}'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' /> + </JScrollPane> + </JPanel> + </JSplitPane> +</JPanel> \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx ___________________________________________________________________ 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/program/EditProgramUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,135 @@ +package fr.ifremer.tutti.ui.swing.content.program; + +/* + * #%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.Program; +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; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Handler of UI {@link EditProgramUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(EditProgramUIHandler.class); + + private final EditProgramUI ui; + + private final PersistenceService persistenceService; + + public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) { + super(context); + this.ui = ui; + persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + EditProgramUIModel model = new EditProgramUIModel(); + + String surveyId = context.getProgramId(); + if (surveyId == null) { + + if (log.isInfoEnabled()) { + log.info("Edit new program"); + } + } else { + + if (log.isInfoEnabled()) { + log.info("Edit existing program " + surveyId); + } + // load existing program + Program program = persistenceService.getProgram(surveyId); + + model.fromBean(program); + } + + listModelIsModify(model); + + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + + EditProgramUIModel model = ui.getModel(); + initBeanComboBox(ui.getZoneComboBox(), + persistenceService.getAllZone(), + model.getZone()); + + SwingValidatorUtil.installUI(ui.getErrorTable(), + new SwingValidatorMessageTableRenderer()); + + listenValidatorValid(ui.getValidator(), model); + + // if new program can already cancel his creation + model.setModify(model.isCreate()); + } + + @Override + public void onCloseUI() { + ui.getValidator().setBean(null); + } + + @Override + protected EditProgramUIModel getModel() { + return ui.getModel(); + } + + public void cancel() { + context.setScreen(TuttiScreen.SELECT_CRUISE); + } + + public void save() { + + EditProgramUIModel model = ui.getModel(); + + Program bean = model.toBean(); + + Program saved; + if (TuttiEntities.isNew(bean)) { + + saved = persistenceService.createProgram(bean); + } else { + saved = persistenceService.saveProgram(bean); + } + + context.setProgramId(saved.getId()); + context.setScreen(TuttiScreen.SELECT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.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/program/EditProgramUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,97 @@ +package fr.ifremer.tutti.ui.swing.content.program; + +/* + * #%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.Program; +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; + +/** + * Bean to edit a program. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> { + + 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 Zone zone; + + protected static Binder<EditProgramUIModel, Program> toBeanBinder = + BinderFactory.newBinder(EditProgramUIModel.class, + Program.class); + + protected static Binder<Program, EditProgramUIModel> fromBeanBinder = + BinderFactory.newBinder(Program.class, EditProgramUIModel.class); + + + public EditProgramUIModel() { + super(Program.class, fromBeanBinder, toBeanBinder); + } + + public String getName() { + return name; + } + + public void setName(String name) { + Object oldValue = getName(); + this.name = name; + firePropertyChange(PROPERTY_NAME, oldValue, name); + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + Object oldValue = getComment(); + this.comment = comment; + firePropertyChange(PROPERTY_COMMENT, oldValue, comment); + } + + public Zone getZone() { + return zone; + } + + public void setZone(Zone zone) { + Object oldValue = getZone(); + this.zone = zone; + firePropertyChange(PROPERTY_ZONE, oldValue, zone); + } + +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%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% - --> -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> -<validators> - - <field name="name"> - - <field-validator type="requiredstring" short-circuit="true"> - <message>tutti.validator.error.program.name.required</message> - </field-validator> - - </field> - - <field name="zone"> - - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.program.zone.required</message> - </field-validator> - - </field> -</validators> Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%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% - --> -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> -<validators> - - <field name="name"> - <field-validator type="requiredstring" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.name.required</message> - </field-validator> - </field> - - <field name="program"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.program.required</message> - </field-validator> - </field> - - <field name="year"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.year.required</message> - </field-validator> - </field> - - <field name="poche"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.poche.required</message> - </field-validator> - </field> - - <field name="beginDate"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.beginDate.required</message> - </field-validator> - </field> - - <field name="endDate"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.endDate.required</message> - </field-validator> - </field> - - - <field name="country"> - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.scientificCruise.country.required</message> - </field-validator> - </field> - - <field name="vessel"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ vessel != null && !vessel.empty ]]> - </param> - <message>tutti.validator.error.scientificCruise.vessel.required</message> - </field-validator> - </field> - - <field name="gear"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ gear != null && !gear.empty ]]> - </param> - <message>tutti.validator.error.scientificCruise.gear.required</message> - </field-validator> - </field> - - <field name="headOfMission"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ headOfMission != null && !headOfMission.empty ]]> - </param> - <message>tutti.validator.error.scientificCruise.headOfMission.required</message> - </field-validator> - </field> - - <field name="headOfSortRoom"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]> - </param> - <message>tutti.validator.error.scientificCruise.headOfSortRoom.required</message> - </field-validator> - </field> - -</validators> Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%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% - --> -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> -<validators> - - <field name="stationNumber"> - - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.fishingOperation.stationNumber.required</message> - </field-validator> - - </field> - - <field name="date"> - - <field-validator type="required" short-circuit="true"> - <message>tutti.validator.error.fishingOperation.date.required</message> - </field-validator> - - </field> -</validators> Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml) =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (rev 0) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%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% + --> +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="name"> + <field-validator type="requiredstring" short-circuit="true"> + <message>tutti.validator.error.cruise.name.required</message> + </field-validator> + </field> + + <field name="program"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.program.required</message> + </field-validator> + </field> + + <field name="year"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.year.required</message> + </field-validator> + </field> + + <field name="poche"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.poche.required</message> + </field-validator> + </field> + + <field name="beginDate"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.beginDate.required</message> + </field-validator> + </field> + + <field name="endDate"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.endDate.required</message> + </field-validator> + </field> + + + <field name="country"> + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.cruise.country.required</message> + </field-validator> + </field> + + <field name="vessel"> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ vessel != null && !vessel.empty ]]> + </param> + <message>tutti.validator.error.cruise.vessel.required</message> + </field-validator> + </field> + + <field name="gear"> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ gear != null && !gear.empty ]]> + </param> + <message>tutti.validator.error.cruise.gear.required</message> + </field-validator> + </field> + + <field name="headOfMission"> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ headOfMission != null && !headOfMission.empty ]]> + </param> + <message>tutti.validator.error.cruise.headOfMission.required</message> + </field-validator> + </field> + + <field name="headOfSortRoom"> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]> + </param> + <message>tutti.validator.error.cruise.headOfSortRoom.required</message> + </field-validator> + </field> + +</validators> Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml) =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (rev 0) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%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% + --> +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="stationNumber"> + + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.fishingOperation.stationNumber.required</message> + </field-validator> + + </field> + + <field name="date"> + + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.fishingOperation.date.required</message> + </field-validator> + + </field> +</validators> Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml) =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (rev 0) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40) @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%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% + --> +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="name"> + + <field-validator type="requiredstring" short-circuit="true"> + <message>tutti.validator.error.program.name.required</message> + </field-validator> + + </field> + + <field name="zone"> + + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.program.zone.required</message> + </field-validator> + + </field> +</validators> Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml ___________________________________________________________________ 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-10 13:33:13 UTC (rev 39) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40) @@ -36,8 +36,8 @@ tutti.config.category.other.description=Autres options tutti.config.category.shortcuts=Raccourcis tutti.config.category.shortcuts.description=Liste des raccourcis clavier +tutti.config.cruiseId=Identifiant de la dernière campagne utilisée tutti.config.programId=Identifiant de la dernière série de campagne utilisée -tutti.config.scientificCruiseId=Identifiant de la dernière campagne utilisée tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie @@ -46,6 +46,15 @@ tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné tutti.label.captureAccidentel.totalWeight=Poids total tutti.label.comment=Commentaire +tutti.label.cruise=Campagne +tutti.label.cruise.beginDate=Date de début +tutti.label.cruise.country=Pays +tutti.label.cruise.endDate=Date de fin +tutti.label.cruise.name=Nom +tutti.label.cruise.poche=Nombre de poches +tutti.label.cruise.program=Série +tutti.label.cruise.surveyPart=Série partielle +tutti.label.cruise.year=Année tutti.label.fishingOperation.averageBottomSalinity=Salinité de fond moyenne tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne tutti.label.fishingOperation.beaufortScale=Force du vent @@ -116,15 +125,6 @@ tutti.label.program=Série de campagne tutti.label.program.name=Nom tutti.label.program.zone=Zone -tutti.label.scientificCruise=Campagne -tutti.label.scientificCruise.beginDate=Date de début -tutti.label.scientificCruise.country=Pays -tutti.label.scientificCruise.endDate=Date de fin -tutti.label.scientificCruise.name=Nom -tutti.label.scientificCruise.poche=Nombre de poches -tutti.label.scientificCruise.program=Série -tutti.label.scientificCruise.surveyPart=Série partielle -tutti.label.scientificCruise.year=Année tutti.label.species.sampleVracWeight=Poids total vrac échant. tutti.label.species.totalHorsVracWeight=Poids total hors vrac tutti.label.species.totalVracWeight=Poids total vrac @@ -188,30 +188,30 @@ tutti.table.species.frequency.header.weight=Poids observé tutti.timeeditor.H=H tutti.title.about=À propos de Tutti +tutti.title.create.cruise=Créer une nouvelle campagne tutti.title.create.program=Créer une nouvelle série de campagne -tutti.title.create.scientificCruise=Créer une nouvelle campagne +tutti.title.edit.cruise=Editer une campagne existante tutti.title.edit.program=Editer une série de campagne existante -tutti.title.edit.scientificCruise=Editer une campagne existante tutti.title.fill.catches=Saisie des captures tutti.title.frequency=Saisie des mensurations tutti.title.home=Sélection de la campagne +tutti.title.noSelectedCruise=Pas de campagne sélectionné tutti.title.noSelectedProgram=Pas de série de campagne sélectionné -tutti.title.noSelectedScientificCruise=Pas de campagne sélectionné +tutti.title.selectedCruise=Campagne %s tutti.title.selectedProgram=Série de campagne %s -tutti.title.selectedScientificCruise=Campagne %s tutti.to.be.done=< A FAIRE > +tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire +tutti.validator.error.cruise.country.required=Le pays est obligatoire +tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire +tutti.validator.error.cruise.gear.required=Au moins un engin doit être sélectionné +tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit être sélectionné +tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné +tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire +tutti.validator.error.cruise.poche.required=Le nombre de poche est obligatoire +tutti.validator.error.cruise.program.required=La série est obligatoire +tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné +tutti.validator.error.cruise.year.required=L'année est obligatoire tutti.validator.error.fishingOperation.date.required=La date du fishingOperation est obligatoire tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire tutti.validator.error.program.name.required=Le nom de la série est obligatoire tutti.validator.error.program.zone.required=La zone de la série est obligatoire -tutti.validator.error.scientificCruise.beginDate.required=La date de début est obligatoire -tutti.validator.error.scientificCruise.country.required=Le pays est obligatoire -tutti.validator.error.scientificCruise.endDate.required=La date de fin est obligatoire -tutti.validator.error.scientificCruise.gear.required=Au moins un engin doit être sélectionné -tutti.validator.error.scientificCruise.headOfMission.required=Au moins un chef de mission doit être sélectionné -tutti.validator.error.scientificCruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné -tutti.validator.error.scientificCruise.name.required=Le nom de la campagne est obligatoire -tutti.validator.error.scientificCruise.poche.required=Le nombre de poche est obligatoire -tutti.validator.error.scientificCruise.program.required=La série est obligatoire -tutti.validator.error.scientificCruise.vessel.required=Au moins un bateau doit être sélectionné -tutti.validator.error.scientificCruise.year.required=L'année est obligatoire