Author: tchemit Date: 2012-11-24 14:10:24 +0100 (Sat, 24 Nov 2012) New Revision: 15 Url: http://forge.codelutin.com/repositories/revision/tutti/15 Log: - remove codelutin from copyright - finish trait editform - improve ui forms Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml Removed: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/application/ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIModel.java Modified: trunk/pom.xml trunk/src/site/rst/index.rst trunk/src/site/site_fr.xml trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfig.java trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java trunk/tutti-persistence-dev/src/test/resources/log4j.properties trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceTechnicalException.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigOption.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigProvider.java trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties trunk/tutti-ui-swing/pom.xml trunk/tutti-ui-swing/src/main/assembly/bin.xml trunk/tutti-ui-swing/src/main/filtered-resources/tutti.properties trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx 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/RunTutti.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/TuttiUI.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/TuttiUIUtil.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiApplicationConfigProvider.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/campaign/EditCampaignUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties trunk/tutti-ui-swing/src/main/resources/log4j.properties trunk/tutti-ui-swing/src/main/resources/validators.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/pom.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -106,9 +106,7 @@ <relativizeDecorationLinks>false</relativizeDecorationLinks> <!-- license header configuration --> - <license.organizationName> - Ifremer, Code Lutin - </license.organizationName> + <license.organizationName>Ifremer</license.organizationName> <license.licenseName>gpl_v3</license.licenseName> </properties> Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/src/site/rst/index.rst 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ .. * $Id$ .. * $HeadURL$ .. * %% -.. * Copyright (C) 2012 Ifremer, Code Lutin +.. * 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 @@ -21,6 +21,7 @@ .. * <http://www.gnu.org/licenses/gpl-3.0.html>. .. * #L% .. - + ===== Tutti ===== Modified: trunk/src/site/site_fr.xml =================================================================== --- trunk/src/site/site_fr.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/src/site/site_fr.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -23,7 +23,6 @@ #L% --> - <project name="${project.name}"> <skin> 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java (from rev 12, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java) =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java (rev 0) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,48 @@ +package fr.ifremer.tutti.persistence.entities; + +/* + * #%L + * Tutti :: Persistence API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.io.Serializable; + +/** + * Abstract tutti bean. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractTuttiBean implements Serializable { + + private static final long serialVersionUID = 1L; + + protected String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} \ No newline at end of file Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiBean.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-11-24 13:10:24 UTC (rev 15) @@ -1,52 +0,0 @@ -package fr.ifremer.tutti.persistence.entities; - -/* - * #%L - * Tutti :: Persistence API - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.jdesktop.beans.AbstractSerializableBean; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class AbstractTuttiEntity extends AbstractSerializableBean { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_ID = "id"; - - protected String id; - - public String getId() { - return id; - } - - public void setId(String id) { - Object oldValue = getId(); - this.id = id; - firePropertyChange(PROPERTY_ID, oldValue, id); - } -} \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -25,12 +25,12 @@ */ /** - * Represents the beaufort scale. + * Represents a beaufort scale. * * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class BeaufortScaleBean extends AbstractTuttiEntity { +public class BeaufortScaleBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -32,7 +32,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class CampaignBean extends AbstractTuttiEntity { +public class CampaignBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class CountryBean extends AbstractTuttiEntity { +public class CountryBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class GearBean extends AbstractTuttiEntity { +public class GearBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class SeaStateBean extends AbstractTuttiEntity { +public class SeaStateBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/StrataBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class StrataBean extends AbstractTuttiEntity { +public class StrataBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class SurveyBean extends AbstractTuttiEntity { +public class SurveyBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -45,9 +45,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } public String getComment() { @@ -55,9 +53,7 @@ } public void setComment(String comment) { - Object oldValue = getComment(); this.comment = comment; - firePropertyChange("comment", oldValue, comment); } public ZoneBean getZone() { @@ -65,8 +61,6 @@ } public void setZone(ZoneBean zone) { - Object oldValue = getZone(); this.zone = zone; - firePropertyChange("zone", oldValue, zone); } } Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -33,7 +33,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class TraitBean extends AbstractTuttiEntity { +public class TraitBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -37,11 +37,11 @@ */ public class TuttiBeans { - public static <B extends AbstractTuttiEntity> Predicate<B> newIdPredicate(String id) { + public static <B extends AbstractTuttiBean> Predicate<B> newIdPredicate(String id) { return new IdPredicate<B>(id); } - public static <B extends AbstractTuttiEntity> B findById(Collection<B> beans, + public static <B extends AbstractTuttiBean> B findById(Collection<B> beans, String id) { B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull(); return result; @@ -51,7 +51,7 @@ // helper class does not instanciate } - protected static class IdPredicate<B extends AbstractTuttiEntity> implements Predicate<B> { + protected static class IdPredicate<B extends AbstractTuttiBean> implements Predicate<B> { private final String id; Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class UserBean extends AbstractTuttiEntity { +public class UserBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class VesselBean extends AbstractTuttiEntity { +public class VesselBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -30,7 +30,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class ZoneBean extends AbstractTuttiEntity { +public class ZoneBean extends AbstractTuttiBean { private static final long serialVersionUID = 1L; @@ -41,9 +41,7 @@ } public void setName(String name) { - Object oldValue = getName(); this.name = name; - firePropertyChange("name", oldValue, name); } } \ No newline at end of file Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -64,7 +64,6 @@ protected final List<UserBean> user = Lists.newArrayList(); - protected final List<StrataBean> strata = Lists.newArrayList(); protected final List<SeaStateBean> seaState = Lists.newArrayList(); 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -29,7 +29,7 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig; -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; +import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean; import fr.ifremer.tutti.persistence.entities.CampaignBean; import fr.ifremer.tutti.persistence.entities.CountryBean; @@ -290,12 +290,12 @@ return result; } - protected <B extends AbstractTuttiEntity> void persist(Class<B> beanType, - B source, - B target, - List<B> entities) { + protected <B extends AbstractTuttiBean> void persist(Class<B> beanType, + B source, + B target, + List<B> entities) { BinderFactory.newBinder(beanType).copyExcluding( - source, target, AbstractTuttiEntity.PROPERTY_ID); + source, target, "id"); if (source.getId() == null) { target.setId(UUID.randomUUID().toString()); } Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfig.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfig.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfig.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java =================================================================== --- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceDevConfigOption.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java =================================================================== --- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-persistence-dev/src/test/resources/log4j.properties =================================================================== --- trunk/tutti-persistence-dev/src/test/resources/log4j.properties 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-persistence-dev/src/test/resources/log4j.properties 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 2012 Ifremer, Code Lutin +# 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -38,6 +38,8 @@ import org.nuiton.util.decorator.Decorator; import org.nuiton.util.decorator.DecoratorProvider; +import static org.nuiton.i18n.I18n.n_; + /** * Tutti decorator service. * @@ -73,20 +75,37 @@ @Override protected void loadDecorators() { - registerMultiJXPathDecorator(SurveyBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(CampaignBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(TraitBean.class, "${id}$s#${stationNumber}$s", "#", " - "); - registerMultiJXPathDecorator(ZoneBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(VesselBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(CountryBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(GearBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(UserBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(BeaufortScaleBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(SeaStateBean.class, "${id}$s#${name}$s", "#", " - "); - registerMultiJXPathDecorator(StrataBean.class, "${id}$s#${name}$s", "#", " - "); + registerMultiJXPathDecorator(SurveyBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(CampaignBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${date}$td/%2$tm/%2$tY", "#", " - "); + registerMultiJXPathDecorator(ZoneBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(VesselBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(CountryBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(GearBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(UserBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(BeaufortScaleBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(SeaStateBean.class, "${name}$s", "#", " - "); + registerMultiJXPathDecorator(StrataBean.class, "${name}$s", "#", " - "); } }; } + static { + n_("tutti.property.name"); + n_("tutti.property.stationNumber"); + n_("tutti.property.date"); + n_("tutti.property.surveyBean"); + n_("tutti.property.campaignBean"); + n_("tutti.property.traitBean"); + n_("tutti.property.zoneBean"); + n_("tutti.property.vesselBean"); + n_("tutti.property.countryBean"); + n_("tutti.property.gearBean"); + n_("tutti.property.userBean"); + n_("tutti.property.beaufortScaleBean"); + n_("tutti.property.seaStateBean"); + n_("tutti.property.strataBean"); + } + } 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiService.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiService.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceTechnicalException.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceTechnicalException.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceTechnicalException.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigOption.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigOption.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigOption.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigProvider.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigProvider.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfigProvider.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-11-24 13:10:24 UTC (rev 15) @@ -6,4 +6,18 @@ tutti.config.surveyId=Identifiant de la dernière série de campagne utilisée tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application) tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques +tutti.property.beaufortScaleBean=Vent beaufort +tutti.property.campaignBean=Campagne +tutti.property.countryBean=Pays +tutti.property.date=Date +tutti.property.gearBean=Engin +tutti.property.name=Nom +tutti.property.seaStateBean=État de la mer +tutti.property.stationNumber=Numéro de station +tutti.property.strataBean=Strate d'association +tutti.property.surveyBean=Série de campagne +tutti.property.traitBean=Trait +tutti.property.userBean=Utilisateur +tutti.property.vesselBean=Navire +tutti.property.zoneBean=Zone tutti.service.config=Configuration des services de Tutti Modified: trunk/tutti-ui-swing/pom.xml =================================================================== --- trunk/tutti-ui-swing/pom.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/pom.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -220,6 +220,11 @@ </dependency> <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> Modified: trunk/tutti-ui-swing/src/main/assembly/bin.xml =================================================================== --- trunk/tutti-ui-swing/src/main/assembly/bin.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/assembly/bin.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti.properties =================================================================== --- trunk/tutti-ui-swing/src/main/filtered-resources/tutti.properties 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti.properties 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 2012 Ifremer, Code Lutin +# 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 Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,61 @@ +package fr.ifremer.tutti.ui.swing; + +import org.jdesktop.beans.AbstractSerializableBean; + +/** + * Abstract UI model to edit a bean. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractTuttiBeanUIModel extends AbstractSerializableBean { + + private static final long serialVersionUID = 1L; + + + public static final String PROPERTY_ID = "id"; + + public static final String PROPERTY_MODIFY = "modify"; + + public static final String PROPERTY_VALID = "valid"; + + protected String id; + + protected boolean modify; + + protected boolean valid; + + public String getId() { + return id; + } + + public void setId(String id) { + Object oldValue = getId(); + this.id = id; + firePropertyChange(PROPERTY_ID, oldValue, id); + } + + public boolean isModify() { + return modify; + } + + public void setModify(boolean modify) { + Object oldValue = isModify(); + this.modify = modify; + firePropertyChange(PROPERTY_MODIFY, oldValue, modify); + } + + public boolean isValid() { + return valid; + } + + public void setValid(boolean valid) { + Object oldValue = isValid(); + this.valid = valid; + firePropertyChange(PROPERTY_VALID, oldValue, valid); + } + + public boolean isCreate() { + return id == null; + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiBeanUIModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -27,9 +27,11 @@ import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean; +import fr.ifremer.tutti.service.DecoratorService; +import fr.ifremer.tutti.service.TuttiServiceTechnicalException; import fr.ifremer.tutti.ui.swing.config.TuttiConfig; -import fr.ifremer.tutti.service.DecoratorService; -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; import jaxx.runtime.swing.OneClicListSelectionModel; import jaxx.runtime.swing.editor.NumberEditor; import jaxx.runtime.swing.editor.TimeEditor; @@ -37,20 +39,31 @@ import jaxx.runtime.swing.editor.bean.BeanListHeader; import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer; +import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXDatePicker; import org.nuiton.util.decorator.Decorator; import org.nuiton.util.decorator.JXPathDecorator; +import org.nuiton.validator.bean.simple.SimpleBeanValidator; import javax.swing.JList; import javax.swing.ListCellRenderer; import javax.swing.ListModel; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; import javax.swing.table.TableCellRenderer; +import javax.swing.text.JTextComponent; +import java.awt.event.ItemEvent; +import java.awt.event.KeyEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Set; /** * Contract of any UI handler. @@ -58,7 +71,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public abstract class AbstractTuttiUIHandler { +public abstract class AbstractTuttiUIHandler<M> { /** Logger. */ private static final Log log = @@ -70,6 +83,8 @@ public abstract void onCloseUI(); + protected abstract M getModel(); + protected final TuttiUIContext context; protected AbstractTuttiUIHandler(TuttiUIContext context) { @@ -84,25 +99,79 @@ return context.getConfig(); } + public void setText(KeyEvent event, String property) { + JTextComponent field = (JTextComponent) event.getSource(); + String value = field.getText(); + setProperty(getModel(), property, value); + } + + public void setBoolean(ItemEvent event, String property) { + boolean value = event.getStateChange() == ItemEvent.SELECTED; + setProperty(getModel(), property, value); + } + + public void selectListData(ListSelectionEvent event, String property) { + if (!event.getValueIsAdjusting()) { + JList list = (JList) event.getSource(); + ListSelectionModel selectionModel = list.getSelectionModel(); + + selectionModel.setValueIsAdjusting(true); + try { + List selectedList = Lists.newLinkedList(); + + for (int index : list.getSelectedIndices()) { + Object o = list.getModel().getElementAt(index); + selectedList.add(o); + } + setProperty(getModel(), property, selectedList); + } finally { + selectionModel.setValueIsAdjusting(false); + } + } + } + + protected void setProperty(Object bean, String property, Object value) { + try { + PropertyUtils.setSimpleProperty(bean, property, value); + } catch (Exception e) { + throw new TuttiServiceTechnicalException("Could not set property", e); + } + } + + protected void initUI(TuttiUI ui) { + + for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) { + Object component = entry.getValue(); + if (component instanceof NumberEditor) { + initNumberEditor((NumberEditor) component); + } else if (component instanceof JXDatePicker) { + initDatePicker((JXDatePicker) component); + } else if (component instanceof TimeEditor) { + initTimeEditor((TimeEditor) component); + } + } + } + /** * Prépare un component de choix d'entités pour un type d'entité donné et * pour un service de persistance donné. * - * @param <E> le type de l'entité - * @param entityClass le type de l'entité - * @param comboBox le component graphique à initialiser + * @param comboBox le component graphique à initialiser */ - protected <E extends AbstractTuttiEntity> void initBeanComboBox( - Class<E> entityClass, + protected <E extends AbstractTuttiBean> void initBeanComboBox( BeanComboBox<E> comboBox, List<E> data, E selectedData) { - // init combobox - Decorator<E> decorator = context.getService(DecoratorService.class).getDecoratorByType(entityClass); + Class<E> beanType = (Class<E>) comboBox.getHandler().getTargetClass(); + DecoratorService decoratorService = + context.getService(DecoratorService.class); + Decorator<E> decorator = decoratorService.getDecoratorByType(beanType); + if (log.isInfoEnabled()) { - log.info("entity list [" + entityClass.getName() + "] : " + data.size()); + log.info("entity list [" + beanType.getName() + "] : " + + (data == null ? 0 : data.size())); } // add data list to combo box @@ -111,7 +180,7 @@ comboBox.setSelectedItem(selectedData); if (log.isDebugEnabled()) { - log.debug("combo list [" + entityClass.getName() + "] : " + + log.debug("combo [" + beanType.getName() + "] : " + comboBox.getData().size()); } } @@ -120,35 +189,34 @@ * Prépare un component de choix d'entités pour un type d'entité donné et * pour un service de persistance donné. * - * @param <E> le type de l'entité - * @param entityClass le type de l'entité - * @param comboBox le component graphique à initialiser + * @param listHeader le component graphique à initialiser */ - protected <E extends AbstractTuttiEntity> void initBeanList( - Class<E> entityClass, - BeanListHeader<E> comboBox, + protected <E extends AbstractTuttiBean> void initBeanList( + BeanListHeader<E> listHeader, List<E> data, List<E> selectedData) { - // init combobox + Class<E> beanType = listHeader.getBeanType(); + DecoratorService decoratorService = context.getService(DecoratorService.class); - Decorator<E> decorator = decoratorService.getDecoratorByType(entityClass); + Decorator<E> decorator = decoratorService.getDecoratorByType(beanType); if (log.isInfoEnabled()) { - log.info("entity list [" + entityClass.getName() + "] : " + data.size()); + log.info("entity list [" + beanType.getName() + "] : " + + (data == null ? 0 : data.size())); } // add data list to combo box - comboBox.init((JXPathDecorator<E>) decorator, data); + listHeader.init((JXPathDecorator<E>) decorator, data); - OneClicListSelectionModel.installModel(comboBox.getList()); + OneClicListSelectionModel.installModel(listHeader.getList()); - updateIndices(comboBox.getList(), selectedData); + updateIndices(listHeader.getList(), selectedData); if (log.isDebugEnabled()) { - log.debug("combo list [" + entityClass.getName() + "] : " + - comboBox.getData().size()); + log.debug("Jlist [" + beanType.getName() + "] : " + + listHeader.getData().size()); } } @@ -175,8 +243,8 @@ picker.getEditor().setEditable(false); } - protected <B extends AbstractTuttiEntity> void updateIndices(JList<B> jlist, - List<B> list) { + protected <B extends AbstractTuttiBean> void updateIndices(JList<B> jlist, + List<B> list) { List<String> ids = list == null ? Collections.<String>emptyList() : @@ -239,4 +307,31 @@ DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator); return result; } + + protected void listenValidatorValid(SimpleBeanValidator validator, + final AbstractTuttiBeanUIModel model) { + validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + model.setValid((Boolean) evt.getNewValue()); + } + }); + } + + + protected void listModelIsModify(AbstractTuttiBeanUIModel model) { + model.addPropertyChangeListener(new PropertyChangeListener() { + + final Set<String> excludeProperties = Sets.newHashSet( + AbstractTuttiBeanUIModel.PROPERTY_MODIFY, + AbstractTuttiBeanUIModel.PROPERTY_VALID); + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (!excludeProperties.contains(evt.getPropertyName())) { + ((AbstractTuttiBeanUIModel) evt.getSource()).setModify(true); + } + } + }); + } } 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -56,7 +56,7 @@ text:"tutti.action.manageProtocol"; toolTipText:"tutti.action.manageProtocol.tip"; mnemonic:P; - enabled:{uiContext.getScreen() != TuttiScreen.EDIT_PROTOCOL}; + enabled:{model.getScreen() != TuttiScreen.EDIT_PROTOCOL}; /*actionIcon:"protocol";*/ } @@ -64,7 +64,7 @@ text:"tutti.action.selectCampaign"; toolTipText:"tutti.action.selectCampaign.tip"; mnemonic:S; - enabled:{uiContext.getScreen() != TuttiScreen.SELECT_CAMPAIGN}; + enabled:{model.getScreen() != TuttiScreen.SELECT_CAMPAIGN}; /*actionIcon:"campaign";*/ } @@ -72,7 +72,7 @@ text:"tutti.action.fillCatches"; toolTipText:"tutti.action.fillCatches.tip"; mnemonic:C; - enabled:{uiContext.getScreen() != TuttiScreen.FILL_CATCHES && uiContext.isCampaignContextFilled()}; + enabled:{model.getScreen() != TuttiScreen.FILL_CATCHES && model.isCampaignContextFilled()}; /*actionIcon:"catches";*/ } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,7 +22,7 @@ #L% --> <JFrame id='mainFrame' onWindowClosing='getHandler().closeTutti()' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<MainUIHandler>' + implements='fr.ifremer.tutti.ui.swing.TuttiUI<TuttiUIContext, MainUIHandler>' width='800' height='600'> <import> @@ -31,15 +31,15 @@ org.jdesktop.swingx.JXTitledPanel </import> + <TuttiUIContext id='model' + initializer='getContextValue(TuttiUIContext.class)'/> <MainUIHandler id='handler' initializer='getContextValue(MainUIHandler.class)'/> <script><![CDATA[ - protected TuttiUIContext uiContext; - public MainUI(TuttiUIContext context) { - this.uiContext = context; + setContextValue(context); MainUIHandler handler = new MainUIHandler(context, this); setContextValue(handler); handler.beforeInitUI(); 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,13 +24,12 @@ * #L% */ -import fr.ifremer.tutti.service.TuttiServiceContext; +import fr.ifremer.tutti.persistence.entities.CampaignBean; +import fr.ifremer.tutti.persistence.entities.SurveyBean; +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.service.PersistenceService; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.SurveyBean; import fr.ifremer.tutti.ui.swing.content.campaign.EditCampaignUI; import fr.ifremer.tutti.ui.swing.content.campaign.EditSurveyUI; import fr.ifremer.tutti.ui.swing.content.campaign.SelectCampaignUI; @@ -58,7 +57,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class MainUIHandler extends AbstractTuttiUIHandler { +public class MainUIHandler extends AbstractTuttiUIHandler<TuttiUIContext> { /** Logger. */ private static final Log log = LogFactory.getLog(MainUIHandler.class); @@ -67,7 +66,6 @@ protected JComponent currentBody; - protected final PersistenceService persistenceService; protected MainUIHandler(TuttiUIContext context, MainUI ui) { @@ -76,17 +74,8 @@ this.persistenceService = context.getService(PersistenceService.class); } - public MainUI getUI() { - return ui; - } - - public TuttiServiceContext getAppContext() { - return context.getAppContext(); - } - @Override public void beforeInitUI() { - // nothing to do context.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { @@ -119,7 +108,19 @@ changeTitle(); - context.setScreen(TuttiScreen.SELECT_CAMPAIGN); + TuttiScreen screen; + + if (context.isCampaignContextFilled()) { + + // direct fill catches screen + screen = TuttiScreen.FILL_CATCHES; + } else { + + // go to select campaign screen + screen = TuttiScreen.SELECT_CAMPAIGN; + } + + context.setScreen(screen); } @Override @@ -130,6 +131,11 @@ context.close(); } + @Override + protected TuttiUIContext getModel() { + return ui.getModel(); + } + public void showConfig() { TuttiConfig config = context.getConfig(); @@ -390,7 +396,7 @@ protected void closeCurrentBody() { if (currentBody != null) { - TuttiUI<?> body = (TuttiUI<?>) currentBody; + TuttiUI<?,?> body = (TuttiUI<?,?>) currentBody; body.getHandler().onCloseUI(); context.getSwingSession().save(); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -32,8 +32,10 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public interface TuttiUI<H extends AbstractTuttiUIHandler> extends JAXXObject { +public interface TuttiUI<M, H extends AbstractTuttiUIHandler<M>> extends JAXXObject { + M getModel(); + H getHandler(); /** 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -42,7 +42,6 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Closeable; -import java.io.IOException; import java.util.Set; /** @@ -107,13 +106,6 @@ protected String campaignId; /** - * Id of last selected trait (can be null if none ever selected. - * - * @since 0.1 - */ - protected String traitId; - - /** * Current screen displayed in ui. * * @since 0.1 @@ -122,10 +114,9 @@ public static TuttiUIContext newContext(TuttiConfig config) { Preconditions.checkNotNull(config); - Preconditions.checkState(applicationContext != null, "Application context was already opened!"); + Preconditions.checkState(applicationContext == null, + "Application context was already opened!"); applicationContext = new TuttiUIContext(config); - - return applicationContext; } @@ -135,18 +126,10 @@ this.swingSession = new SwingSession(getConfig().getUIConfigFile(), false); } - public TuttiServiceContext getAppContext() { - return serviceContext; - } - public <S extends TuttiService> S getService(Class<S> serviceType) { return serviceContext.getService(serviceType); } - public <S extends TuttiService> void closeService(S service) throws IOException { - serviceContext.closeService(service); - } - public TuttiConfig getConfig() { return config; } @@ -159,6 +142,19 @@ return surveyId; } + public String getCampaignId() { + return campaignId; + } + + public boolean isCampaignContextFilled() { + return StringUtils.isNotBlank(surveyId) && + StringUtils.isNotBlank(campaignId); + } + + public TuttiScreen getScreen() { + return screen; + } + public void setSurveyId(String surveyId) { boolean oldValue = isCampaignContextFilled(); @@ -170,10 +166,6 @@ oldValue, isCampaignContextFilled()); } - public String getCampaignId() { - return campaignId; - } - public void setCampaignId(String campaignId) { boolean oldValue = isCampaignContextFilled(); @@ -185,26 +177,6 @@ oldValue, isCampaignContextFilled()); } - public String getTraitId() { - return traitId; - } - - public void setTraitId(String traitId) { - this.traitId = traitId; - - // always propagate the change - firePropertyChange("traitId", null, traitId); - } - - public boolean isCampaignContextFilled() { - return StringUtils.isNotBlank(surveyId) && - StringUtils.isNotBlank(campaignId); - } - - public TuttiScreen getScreen() { - return screen; - } - public void setScreen(TuttiScreen screen) { Object oldValue = getScreen(); this.screen = screen; @@ -301,23 +273,12 @@ }); } - public void saveContextToConfig() { - if (log.isInfoEnabled()) { - log.info("Save config (surveyId: " + surveyId + ", campaignId: " + - campaignId + ")"); - } - config.setSurveyId(surveyId); - config.setCampaignId(campaignId); - config.save(); - } - @Override public void close() { // Clear data references surveyId = null; campaignId = null; - traitId = null; IOUtils.closeQuietly(serviceContext); @@ -330,4 +291,14 @@ removePropertyChangeListener(listener); } } + + protected void saveContextToConfig() { + if (log.isInfoEnabled()) { + log.info("Save config (surveyId: " + surveyId + ", campaignId: " + + campaignId + ")"); + } + config.setSurveyId(surveyId); + config.setCampaignId(campaignId); + config.save(); + } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiApplicationConfigProvider.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiApplicationConfigProvider.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiApplicationConfigProvider.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -28,13 +28,13 @@ BeanComboBox { showReset:true; - i18nPrefix:"tutti.common."; + i18nPrefix:"tutti.property."; bean:{model}; } BeanListHeader { showReset:true; - i18nPrefix:"tutti.common."; + i18nPrefix:"tutti.property."; } JList { @@ -49,101 +49,101 @@ continuousLayout:true; } -#campaignNameLabel { +#nameLabel { text:"tutti.label.campaign.name"; - labelFor:{campaignNameField}; + labelFor:{nameField}; } -#campaignNameField { - text:{getModel().getName()}; +#nameField { + text:{model.getName()}; } -#campaignSurveyPartLabel { +#surveyPartLabel { text:"tutti.label.campaign.surveyPart"; - labelFor:{campaignSurveyPartField}; + labelFor:{surveyPartField}; } -#campaignSurveyPartField { - text:{getModel().getSurveyPart()}; +#surveyPartField { + text:{model.getSurveyPart()}; } -#campaignCountryLabel { +#countryLabel { text:"tutti.label.campaign.country"; - labelFor:{campaignCountryComboBox}; + labelFor:{countryComboBox}; } -#campaignCountryComboBox { +#countryComboBox { property:"country"; selectedItem:{model.getCountry()}; } -#campaignSurveyLabel { +#surveyLabel { text:"tutti.label.campaign.survey"; - labelFor:{campaignSurveyComboBox}; + labelFor:{surveyComboBox}; } -#campaignSurveyComboBox { +#surveyComboBox { property:"survey"; selectedItem:{model.getSurvey()}; } -#campaignVesselPane { +#vesselPane { horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; } -#campaignVesselHeader { +#vesselHeader { labelText:{_("tutti.label.list.vessel")}; - list:{campaignVesselList}; + list:{vesselList}; beanType:{VesselBean.class}; } -#campaignGearPane { +#gearPane { horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; } -#campaignGearHeader { +#gearHeader { labelText:{_("tutti.label.list.gear")}; - list:{campaignGearList}; + list:{gearList}; beanType:{GearBean.class}; } -#campaignHeadOfMissionPane { +#headOfMissionPane { horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; } -#campaignHeadOfMissionHeader { +#headOfMissionHeader { labelText:{_("tutti.label.list.headOfMission")}; - list:{campaignHeadOfMissionList}; + list:{headOfMissionList}; beanType:{UserBean.class}; } -#campaignHeadOfSortRoomPane { +#headOfSortRoomPane { horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; } -#campaignHeadOfSortRoomHeader { +#headOfSortRoomHeader { labelText:{_("tutti.label.list.headOfSortRoom")}; - list:{campaignHeadOfSortRoomList}; + list:{headOfSortRoomList}; beanType:{UserBean.class}; } -#campaignCommentPane { +#commentPane { columnHeaderView:{new JLabel(_("tutti.label.comment"))}; minimumSize:{new Dimension(10,50)}; } -#campaignCommentField { - text:{getStringValue(model.getComment())}; +#commentField { + text:{model.getComment()}; } #saveButton { actionIcon:"save"; text:"tutti.action.save"; - enabled:{validator.isValid()}; + enabled:{model.isModify() && model.isValid()}; } #cancelButton { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,7 +22,7 @@ #L% --> <JPanel id='homePanel' layout='{new BorderLayout()}' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIHandler>'> + implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIModel, EditCampaignUIHandler>'> <import> fr.ifremer.tutti.persistence.entities.CountryBean @@ -70,15 +70,15 @@ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='name' component='campaignNameField'/> - <field name='comment' component='campaignCommentField'/> - <field name='surveyPart' component='campaignSurveyPartField'/> - <field name='country' component='campaignCountryComboBox'/> - <field name='survey' component='campaignSurveyComboBox'/> - <field name='vessel' component='campaignVesselPane'/> - <field name='gear' component='campaignGearPane'/> - <field name='headOfMission' component='campaignHeadOfMissionPane'/> - <field name='headOfSortRoom' component='campaignHeadOfSortRoomPane'/> + <field name='name' component='nameField'/> + <field name='comment' component='commentField'/> + <field name='surveyPart' component='surveyPartField'/> + <field name='country' component='countryComboBox'/> + <field name='survey' component='surveyComboBox'/> + <field name='vessel' component='vesselPane'/> + <field name='gear' component='gearPane'/> + <field name='headOfMission' component='headOfMissionPane'/> + <field name='headOfSortRoom' component='headOfSortRoomPane'/> </BeanValidator> <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> @@ -87,92 +87,86 @@ <!-- campaign survey --> <row> <cell anchor='west'> - <JLabel id='campaignSurveyLabel'/> + <JLabel id='surveyLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='4'> - <BeanComboBox id='campaignSurveyComboBox' constructorParams='this' + <cell weightx='1.0'> + <BeanComboBox id='surveyComboBox' constructorParams='this' genericType='SurveyBean'/> </cell> </row> <!-- campaign country --> <row> - <cell anchor='west'> - <JLabel id='campaignCountryLabel'/> + <cell> + <JLabel id='countryLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='4'> - <BeanComboBox id='campaignCountryComboBox' constructorParams='this' + <cell> + <BeanComboBox id='countryComboBox' constructorParams='this' genericType='CountryBean'/> </cell> </row> <!-- campaign name --> <row> - <cell anchor='west'> - <JLabel id='campaignNameLabel'/> + <cell> + <JLabel id='nameLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='4'> - <JTextField id='campaignNameField' - onKeyReleased='getModel().setName(campaignNameField.getText())'/> + <cell> + <JTextField id='nameField' + onKeyReleased='handler.setText(event, "name")'/> </cell> </row> <!-- campaign survey part --> <row> - <cell anchor='west'> - <JLabel id='campaignSurveyPartLabel'/> + <cell> + <JLabel id='surveyPartLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='2'> - <JTextField id='campaignSurveyPartField' - onKeyReleased='getModel().setSurveyPart(campaignSurveyPartField.getText())'/> + <cell> + <JTextField id='surveyPartField' + onKeyReleased='handler.setText(event, "surveyPart")'/> </cell> </row> <!-- campaign vessel / gear --> - <row fill="both" weighty='0.3'> - <cell fill='both' weightx='1.0' columns='3'> - - <JPanel layout='{new GridLayout(1,0)}'> - - <JScrollPane id='campaignVesselPane' - columnHeaderView="{campaignVesselHeader}" - onFocusGained='campaignVesselList.requestFocus()'> - <JList id='campaignVesselList' - onValueChanged='if ( !event.getValueIsAdjusting()) { handler.selectVessels(((JList)event.getSource()).getSelectedValues()); }'/> - <BeanListHeader id='campaignVesselHeader' - genericType='VesselBean'/> + <row weighty='0.3'> + <cell columns='2'> + <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='VesselBean'/> </JScrollPane> - <JScrollPane id='campaignGearPane' - columnHeaderView="{campaignGearHeader}" - onFocusGained='campaignGearList.requestFocus()'> - <JList id='campaignGearList' - onValueChanged='if ( !event.getValueIsAdjusting()) { handler.selectGears(((JList)event.getSource()).getSelectedValues()); }'/> - <BeanListHeader id='campaignGearHeader' genericType='GearBean'/> + <JScrollPane id='gearPane' columnHeaderView="{gearHeader}" + onFocusGained='gearList.requestFocus()'> + <JList id='gearList' + onValueChanged='handler.selectListData(event, "gear")'/> + <BeanListHeader id='gearHeader' genericType='GearBean'/> </JScrollPane> </JPanel> </cell> </row> <!-- campaign headOfMission / headOfSortRoom --> - <row fill="both" weighty='0.3'> - <cell fill='both' weightx='1.0' columns='3'> + <row weighty='0.3'> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0)}'> - <JPanel layout='{new GridLayout(1,0)}'> - - <JScrollPane id='campaignHeadOfMissionPane' - columnHeaderView="{campaignHeadOfMissionHeader}" - onFocusGained='campaignHeadOfMissionList.requestFocus()'> - <JList id='campaignHeadOfMissionList' - onValueChanged='if ( !event.getValueIsAdjusting()) { handler.selectHeadOfMission(((JList)event.getSource()).getSelectedValues()); }'/> - <BeanListHeader id='campaignHeadOfMissionHeader' + <JScrollPane id='headOfMissionPane' + columnHeaderView="{headOfMissionHeader}" + onFocusGained='headOfMissionList.requestFocus()'> + <JList id='headOfMissionList' + onValueChanged='handler.selectListData(event, "headOfMission")'/> + <BeanListHeader id='headOfMissionHeader' genericType='UserBean'/> </JScrollPane> - <JScrollPane id='campaignHeadOfSortRoomPane' - columnHeaderView="{campaignHeadOfSortRoomHeader}" - onFocusGained='campaignHeadOfSortRoomList.requestFocus()'> - <JList id='campaignHeadOfSortRoomList' - onValueChanged='if ( !event.getValueIsAdjusting()) { handler.selectHeadOfSortRoom(((JList)event.getSource()).getSelectedValues()); }'/> - <BeanListHeader id='campaignHeadOfSortRoomHeader' + <JScrollPane id='headOfSortRoomPane' + columnHeaderView="{headOfSortRoomHeader}" + onFocusGained='headOfSortRoomList.requestFocus()'> + <JList id='headOfSortRoomList' + onValueChanged='handler.selectListData(event, "headOfSortRoom")'/> + <BeanListHeader id='headOfSortRoomHeader' genericType='UserBean'/> </JScrollPane> </JPanel> @@ -180,20 +174,20 @@ </row> <!-- campaign comment --> - <row fill="both" weighty='0.3'> - <cell columns='3'> - <JScrollPane id='campaignCommentPane' - onFocusGained='campaignCommentField.requestFocus()'> - <JTextArea id='campaignCommentField' - onKeyReleased='getModel().setComment(campaignCommentField.getText())'/> + <row weighty='0.3'> + <cell columns='2'> + <JScrollPane id='commentPane' + onFocusGained='commentField.requestFocus()'> + <JTextArea id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> </JScrollPane> </cell> </row> <!-- Actions --> <row> - <cell columns='3' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0)}'> <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> <JButton id='saveButton' onActionPerformed='handler.save()'/> </JPanel> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,13 +24,9 @@ * #L% */ -import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.CountryBean; -import fr.ifremer.tutti.persistence.entities.GearBean; import fr.ifremer.tutti.persistence.entities.SurveyBean; import fr.ifremer.tutti.persistence.entities.UserBean; -import fr.ifremer.tutti.persistence.entities.VesselBean; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiScreen; @@ -38,7 +34,6 @@ import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; import jaxx.runtime.validator.swing.SwingValidatorUtil; -import javax.swing.ListSelectionModel; import java.util.List; /** @@ -47,7 +42,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class EditCampaignUIHandler extends AbstractTuttiUIHandler { +public class EditCampaignUIHandler extends AbstractTuttiUIHandler<EditCampaignUIModel> { private final EditCampaignUI ui; @@ -67,8 +62,6 @@ String campaignId = context.getCampaignId(); if (campaignId == null) { - model.setCreate(true); - SurveyBean survey = persistenceService.getSurvey(context.getSurveyId()); model.setSurvey(survey); @@ -79,57 +72,59 @@ model.fromBean(campaign); } + listModelIsModify(model); ui.setContextValue(model); } @Override public void afterInitUI() { - - List<SurveyBean> surveys = persistenceService.getAllSurveys(); - List<CountryBean> countries = persistenceService.getAllCountries(); - List<VesselBean> vessels = persistenceService.getAllVessels(); - List<GearBean> gears = persistenceService.getAllGears(); List<UserBean> users = persistenceService.getAllUsers(); - initBeanComboBox(SurveyBean.class, - ui.getCampaignSurveyComboBox(), - surveys, - ui.getModel().getSurvey()); + EditCampaignUIModel model = ui.getModel(); - initBeanComboBox(CountryBean.class, - ui.getCampaignCountryComboBox(), - countries, - ui.getModel().getCountry()); + initBeanComboBox(ui.getSurveyComboBox(), + persistenceService.getAllSurveys(), + model.getSurvey()); - initBeanList(VesselBean.class, - ui.getCampaignVesselHeader(), - vessels, - ui.getModel().getVessel()); + initBeanComboBox(ui.getCountryComboBox(), + persistenceService.getAllCountries(), + model.getCountry()); - initBeanList(GearBean.class, - ui.getCampaignGearHeader(), - gears, - ui.getModel().getGear()); + initBeanList(ui.getVesselHeader(), + persistenceService.getAllVessels(), + model.getVessel()); - initBeanList(UserBean.class, - ui.getCampaignHeadOfMissionHeader(), + initBeanList(ui.getGearHeader(), + persistenceService.getAllGears(), + model.getGear()); + + initBeanList(ui.getHeadOfMissionHeader(), users, - ui.getModel().getHeadOfMission()); + model.getHeadOfMission()); - initBeanList(UserBean.class, - ui.getCampaignHeadOfSortRoomHeader(), + initBeanList(ui.getHeadOfSortRoomHeader(), users, - ui.getModel().getHeadOfSortRoom()); + model.getHeadOfSortRoom()); SwingValidatorUtil.installUI(ui.getErrorTable(), new SwingValidatorMessageTableRenderer()); + + listenValidatorValid(ui.getValidator(), model); + + // if new trait can already cancel his creation + model.setModify(model.isCreate()); } @Override public void onCloseUI() { } + @Override + protected EditCampaignUIModel getModel() { + return ui.getModel(); + } + public void cancel() { context.setScreen(TuttiScreen.SELECT_CAMPAIGN); @@ -155,64 +150,4 @@ context.setScreen(TuttiScreen.SELECT_CAMPAIGN); } - public void selectGears(Object... selected) { - - ListSelectionModel selectionModel = - ui.getCampaignGearList().getSelectionModel(); - selectionModel.setValueIsAdjusting(true); - try { - List<GearBean> selectedList = Lists.newLinkedList(); - for (Object o : selected) { - selectedList.add((GearBean) o); - } - ui.getModel().setGear(selectedList); - } finally { - selectionModel.setValueIsAdjusting(false); - } - } - - public void selectVessels(Object... selected) { - ListSelectionModel selectionModel = - ui.getCampaignVesselList().getSelectionModel(); - selectionModel.setValueIsAdjusting(true); - try { - List<VesselBean> selectedList = Lists.newLinkedList(); - for (Object o : selected) { - selectedList.add((VesselBean) o); - } - ui.getModel().setVessel(selectedList); - } finally { - selectionModel.setValueIsAdjusting(false); - } - } - - public void selectHeadOfMission(Object... selected) { - ListSelectionModel selectionModel = - ui.getCampaignHeadOfMissionList().getSelectionModel(); - selectionModel.setValueIsAdjusting(true); - try { - List<UserBean> selectedList = Lists.newLinkedList(); - for (Object o : selected) { - selectedList.add((UserBean) o); - } - ui.getModel().setHeadOfMission(selectedList); - } finally { - selectionModel.setValueIsAdjusting(false); - } - } - - public void selectHeadOfSortRoom(Object... selected) { - ListSelectionModel selectionModel = - ui.getCampaignHeadOfSortRoomList().getSelectionModel(); - selectionModel.setValueIsAdjusting(true); - try { - List<UserBean> selectedList = Lists.newLinkedList(); - for (Object o : selected) { - selectedList.add((UserBean) o); - } - ui.getModel().setHeadOfSortRoom(selectedList); - } finally { - selectionModel.setValueIsAdjusting(false); - } - } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,13 +24,13 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; import fr.ifremer.tutti.persistence.entities.CampaignBean; import fr.ifremer.tutti.persistence.entities.CountryBean; import fr.ifremer.tutti.persistence.entities.GearBean; import fr.ifremer.tutti.persistence.entities.SurveyBean; import fr.ifremer.tutti.persistence.entities.UserBean; import fr.ifremer.tutti.persistence.entities.VesselBean; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; import org.nuiton.util.beans.BinderFactory; import java.util.List; @@ -41,12 +41,10 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1O */ -public class EditCampaignUIModel extends AbstractTuttiEntity { +public class EditCampaignUIModel extends AbstractTuttiBeanUIModel { private static final long serialVersionUID = 1L; - protected boolean create; - protected SurveyBean survey; protected CountryBean country; @@ -65,16 +63,18 @@ protected String comment; - public boolean isCreate() { - return create; - } +// protected boolean create; +// +// public boolean isCreate() { +// return create; +// } +// +// public void setCreate(boolean create) { +// Object oldValue = isCreate(); +// this.create = create; +// firePropertyChange("create", oldValue, create); +// } - public void setCreate(boolean create) { - Object oldValue = isCreate(); - this.create = create; - firePropertyChange("create", oldValue, create); - } - public SurveyBean getSurvey() { return survey; } @@ -112,7 +112,7 @@ public void setCountry(CountryBean country) { Object oldValue = getCountry(); this.country = country; - firePropertyChange("comment", oldValue, comment); + firePropertyChange("country", oldValue, country); } public String getSurveyPart() { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -21,6 +21,13 @@ * <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; @@ -32,40 +39,37 @@ border:{BorderFactory.createTitledBorder((String)null)}; } -#surveyNameLabel { +#nameLabel { text:"tutti.label.survey.name"; - labelFor:{surveyNameField}; + labelFor:{nameField}; } -#surveyNameField { - text:{getModel().getName()}; +#nameField { + text:{model.getName()}; } -#surveyCommentPane { +#commentPane { columnHeaderView:{new JLabel(_("tutti.label.comment"))}; minimumSize:{new Dimension(10,50)}; } -#surveyCommentField { +#commentField { text:{getStringValue(model.getComment())}; } -#surveyZoneLabel { +#zoneLabel { text:"tutti.label.survey.zone"; - labelFor:{surveyZoneComboBox}; + labelFor:{zoneComboBox}; } -#surveyZoneComboBox { +#zoneComboBox { property:"zone"; - bean:{model}; - showReset:true; - i18nPrefix:"tutti.common."; selectedItem:{model.getZone()}; } #saveButton { text:"tutti.action.save"; - enabled:{validator.isValid()}; + enabled:{model.isModify() && model.isValid()}; actionIcon:"save"; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,7 +22,7 @@ #L% --> <JPanel id='homePanel' layout='{new BorderLayout()}' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIHandler>'> + implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIModel, EditSurveyUIHandler>'> <import> fr.ifremer.tutti.persistence.entities.ZoneBean @@ -62,9 +62,9 @@ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel' uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='name' component='surveyNameField'/> - <field name='zone' component='surveyZoneComboBox'/> - <field name='comment' component='surveyCommentField'/> + <field name='name' component='nameField'/> + <field name='zone' component='zoneComboBox'/> + <field name='comment' component='commentField'/> </BeanValidator> <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> @@ -74,46 +74,40 @@ <!-- survey name --> <row> <cell anchor='west'> - <JLabel id='surveyNameLabel'/> + <JLabel id='nameLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='4'> - <JTextField id='surveyNameField' - onKeyReleased='getModel().setName(surveyNameField.getText())'/> + <cell weightx='1.0'> + <JTextField id='nameField' + onKeyReleased='handler.setText(event, "name")'/> </cell> </row> <!-- survey zone --> <row> - <cell anchor='west'> - <JLabel id='surveyZoneLabel'/> + <cell> + <JLabel id='zoneLabel'/> </cell> - <cell fill='horizontal' weightx='1.0' columns='4'> - <BeanComboBox id='surveyZoneComboBox' constructorParams='this' + <cell> + <BeanComboBox id='zoneComboBox' constructorParams='this' genericType='ZoneBean'/> </cell> </row> <!-- survey comment --> - <row fill="both" weighty='0.8'> - <cell columns='5'> - <JScrollPane id='surveyCommentPane' - onFocusGained='surveyCommentField.requestFocus()'> - <JTextArea id='surveyCommentField' - onKeyReleased='getModel().setComment(surveyCommentField.getText())'/> + <row weighty='0.8'> + <cell columns='2'> + <JScrollPane id='commentPane' + onFocusGained='commentField.requestFocus()'> + <JTextArea id='commentField' + onKeyReleased='handler.setText(event, "comment")'/> </JScrollPane> </cell> </row> - <!--row fill="both" weighty='0.2'> - <cell columns='5'> - <JPanel/> - </cell> - </row--> - <!-- actions --> <row anchor='south'> - <cell columns='5' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0)}'> <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> <JButton id='saveButton' onActionPerformed='handler.save()'/> </JPanel> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -25,7 +25,6 @@ */ import fr.ifremer.tutti.persistence.entities.SurveyBean; -import fr.ifremer.tutti.persistence.entities.ZoneBean; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiScreen; @@ -35,15 +34,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.util.List; - /** * Handler of UI {@link EditSurveyUI}. * * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class EditSurveyUIHandler extends AbstractTuttiUIHandler { +public class EditSurveyUIHandler extends AbstractTuttiUIHandler<EditSurveyUIModel> { /** Logger. */ private static final Log log = LogFactory.getLog(EditSurveyUIHandler.class); @@ -69,7 +66,6 @@ if (log.isInfoEnabled()) { log.info("Edit new survey"); } - model.setCreate(true); } else { if (log.isInfoEnabled()) { @@ -80,21 +76,27 @@ model.fromBean(survey); } + + listModelIsModify(model); + ui.setContextValue(model); } @Override public void afterInitUI() { - List<ZoneBean> zones = persistenceService.getAllZones(); + EditSurveyUIModel model = ui.getModel(); + initBeanComboBox(ui.getZoneComboBox(), + persistenceService.getAllZones(), + model.getZone()); - initBeanComboBox(ZoneBean.class, - ui.getSurveyZoneComboBox(), - zones, - ui.getModel().getZone()); - SwingValidatorUtil.installUI(ui.getErrorTable(), new SwingValidatorMessageTableRenderer()); + + listenValidatorValid(ui.getValidator(), model); + + // if new survey can already cancel his creation + model.setModify(model.isCreate()); } @Override @@ -102,6 +104,11 @@ ui.getValidator().setBean(null); } + @Override + protected EditSurveyUIModel getModel() { + return ui.getModel(); + } + public void cancel() { context.setScreen(TuttiScreen.SELECT_CAMPAIGN); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,9 +24,9 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; import fr.ifremer.tutti.persistence.entities.SurveyBean; import fr.ifremer.tutti.persistence.entities.ZoneBean; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; import org.nuiton.util.beans.BinderFactory; /** @@ -35,7 +35,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class EditSurveyUIModel extends AbstractTuttiEntity { +public class EditSurveyUIModel extends AbstractTuttiBeanUIModel { private static final long serialVersionUID = 1L; @@ -45,18 +45,18 @@ protected ZoneBean zone; - protected boolean create; +// protected boolean create; +// +// public boolean isCreate() { +// return create; +// } +// +// public void setCreate(boolean create) { +// Object oldValue = isCreate(); +// this.create = create; +// firePropertyChange("create", oldValue, create); +// } - public boolean isCreate() { - return create; - } - - public void setCreate(boolean create) { - Object oldValue = isCreate(); - this.create = create; - firePropertyChange("create", oldValue, create); - } - public String getName() { return name; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -21,12 +21,20 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ + +BeanComboBox { + showReset:true; + i18nPrefix:"tutti.property."; + bean:{model}; +} + #surveyLabel { text: "tutti.label.survey"; } #surveyCombobox { - model: {surveyListModel}; + property:"survey"; + selectedItem:{model.getSurvey()}; } #editSurveyButton { @@ -46,8 +54,9 @@ } #campaignCombobox { + property:"campaign"; enabled: {model.isSurveyFound()}; - model: {campaignListModel}; + selectedItem:{model.getCampaign()}; } #editCampaignButton { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,7 +22,7 @@ #L% --> <JPanel id='homePanel' layout='{new BorderLayout()}' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCampaignUIHandler>'> + implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCampaignUIModel, SelectCampaignUIHandler>'> <import> fr.ifremer.tutti.persistence.entities.SurveyBean @@ -30,7 +30,7 @@ fr.ifremer.tutti.persistence.entities.TraitBean fr.ifremer.tutti.ui.swing.TuttiUIContext - jaxx.runtime.swing.model.GenericListModel + jaxx.runtime.swing.editor.bean.BeanComboBox static org.nuiton.i18n.I18n._ </import> @@ -47,62 +47,57 @@ } protected void $afterCompleteSetup() { - getHandler().afterInitUI(); + handler.afterInitUI(); } ]]></script> <SelectCampaignUIHandler id='handler' - initializer='getContextValue(SelectCampaignUIHandler.class)'/> + initializer='getContextValue(SelectCampaignUIHandler.class)'/> - <SelectCampaignUIModel id='model'/> + <SelectCampaignUIModel id='model' + initializer='getContextValue(SelectCampaignUIModel.class)'/> - <GenericListModel id='surveyListModel' genericType='SurveyBean'/> - - <GenericListModel id='campaignListModel' genericType='CampaignBean'/> - - <GenericListModel id='traitListModel' genericType='TraitBean'/> - <Table fill='both' constraints='BorderLayout.CENTER'> <row> <cell anchor='west'> <JLabel id='surveyLabel'/> </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id='surveyCombobox' - onActionPerformed='getHandler().selectSurvey()'/> + <cell weightx='1.0'> + <BeanComboBox id='surveyCombobox' constructorParams='this' + genericType='SurveyBean'/> </cell> <cell> - <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JPanel layout='{new GridLayout(1,0)}'> <JButton id='editSurveyButton' - onActionPerformed='getHandler().showSelectedSurvey()'/> + onActionPerformed='handler.showSelectedSurvey()'/> <JButton id='newSurveyButton' - onActionPerformed='getHandler().showNewSurvey()'/> + onActionPerformed='handler.showNewSurvey()'/> </JPanel> </cell> </row> <row> - <cell anchor='west'> + <cell> <JLabel id='campaignLabel'/> </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id='campaignCombobox' - onActionPerformed='getHandler().selectCampaign()'/> + <cell> + <BeanComboBox id='campaignCombobox' constructorParams='this' + genericType='CampaignBean'/> </cell> <cell> - <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JPanel layout='{new GridLayout(1,0)}'> <JButton id='editCampaignButton' - onActionPerformed='getHandler().showSelectedCampaign()'/> + onActionPerformed='handler.showSelectedCampaign()'/> <JButton id='newCampaignButton' - onActionPerformed='getHandler().showNewCampaign()'/> + onActionPerformed='handler.showNewCampaign()'/> </JPanel> </cell> </row> <row> - <cell fill='both' columns='3'> - <JPanel layout='{new GridLayout(1,0,0,0)}'> + <cell columns='3'> + <!--JPanel layout='{new GridLayout(1,0)}'--> <JButton id='showCatchesButton' - onActionPerformed='getHandler().showCatches()'/> - </JPanel> + onActionPerformed='handler.showCatches()'/> + <!--/JPanel--> </cell> </row> </Table> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,6 +24,7 @@ * #L% */ +import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.entities.CampaignBean; import fr.ifremer.tutti.persistence.entities.SurveyBean; import fr.ifremer.tutti.persistence.entities.TuttiBeans; @@ -31,6 +32,8 @@ 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; @@ -44,17 +47,12 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class SelectCampaignUIHandler extends AbstractTuttiUIHandler { +public class SelectCampaignUIHandler extends AbstractTuttiUIHandler<SelectCampaignUIModel> { /** Logger. */ private static final Log log = LogFactory.getLog(SelectCampaignUIHandler.class); - // XXX-fdesbois-2012-07-23 : used to avoid set unexpected set null during - // selections, this is a strange behavior of setElements that clear with - // fire remove previous elements and put selection to null - protected boolean comboIsAdjusting; - protected final PersistenceService persistenceService; protected final SelectCampaignUI ui; @@ -65,26 +63,19 @@ persistenceService = context.getService(PersistenceService.class); } + @Override protected SelectCampaignUIModel getModel() { return ui.getModel(); } @Override public void beforeInitUI() { - } + SelectCampaignUIModel model = new SelectCampaignUIModel(); - @Override - public void afterInitUI() { - - ui.getCampaignCombobox().setRenderer( - newListCellRender(CampaignBean.class)); - - ui.getSurveyCombobox().setRenderer( - newListCellRender(SurveyBean.class)); - List<SurveyBean> allSurveys = persistenceService.getAllSurveys(); - ui.getSurveyListModel().setElements(allSurveys); + model.setSurveys(allSurveys); + if (allSurveys.isEmpty()) { // do nothing @@ -94,28 +85,17 @@ String surveyId = context.getSurveyId(); SurveyBean selectedSurvey = null; + List<CampaignBean> allCampaigns = null; if (surveyId != null) { selectedSurvey = TuttiBeans.findById(allSurveys, surveyId); + allCampaigns = persistenceService.getAllCampaigns(surveyId); } - if (selectedSurvey == null) { - // select first one - selectedSurvey = allSurveys.get(0); - surveyId = selectedSurvey.getId(); + model.setSurvey(selectedSurvey); + model.setCampaigns(allCampaigns); - // repush it in model - context.setSurveyId(surveyId); - } + if (CollectionUtils.isEmpty(allCampaigns)) { - ui.getSurveyListModel().setSelectedItem(selectedSurvey); - - selectSurvey(); - - List<CampaignBean> allCampaigns = - persistenceService.getAllCampaigns(surveyId); - - if (allCampaigns.isEmpty()) { - // nothing to select } else { String campaignId = context.getCampaignId(); @@ -125,32 +105,57 @@ selectedCampaign = TuttiBeans.findById(allCampaigns, campaignId); } + model.setCampaign(selectedCampaign); + } + } + ui.setContextValue(model); + } - if (selectedCampaign == null) { + @Override + public void afterInitUI() { - // select first one - selectedCampaign = allCampaigns.get(0); - campaignId = selectedCampaign.getId(); + SelectCampaignUIModel model = ui.getModel(); - // repush it in model - context.setCampaignId(campaignId); - } + initBeanComboBox(ui.getSurveyCombobox(), + model.getSurveys(), + model.getSurvey()); - ui.getCampaignListModel().setSelectedItem(selectedCampaign); - } - selectCampaign(); - } + initBeanComboBox(ui.getCampaignCombobox(), + model.getCampaigns(), + model.getCampaign()); - ui.getModel().addPropertyChangeListener("survey", new PropertyChangeListener() { + model.addPropertyChangeListener("survey", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SurveyBean newValue = (SurveyBean) evt.getNewValue(); - context.setSurveyId(newValue == null ? null : newValue.getId()); + boolean noSurvey = newValue == null; + context.setSurveyId(noSurvey ? null : newValue.getId()); + List<CampaignBean> campaigns; + if (noSurvey) { + campaigns = Lists.newArrayList(); + } else { + campaigns = persistenceService.getAllCampaigns(newValue.getId()); + } + SelectCampaignUIModel model = (SelectCampaignUIModel) evt.getSource(); + model.setCampaigns(campaigns); + model.setCampaign(null); } }); - ui.getModel().addPropertyChangeListener("campaign", new PropertyChangeListener() { + + model.addPropertyChangeListener("campaigns", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { + // reload combo box + BeanComboBox<CampaignBean> combobox = ui.getCampaignCombobox(); + List<CampaignBean> campaigns = (List<CampaignBean>) evt.getNewValue(); + combobox.setData(null); + combobox.setData(campaigns); + } + }); + + model.addPropertyChangeListener("campaign", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { CampaignBean newValue = (CampaignBean) evt.getNewValue(); context.setCampaignId(newValue == null ? null : newValue.getId()); } @@ -159,7 +164,6 @@ @Override public void onCloseUI() { - // nothing to do PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners(); for (PropertyChangeListener listener : listeners) { getModel().removePropertyChangeListener(listener); @@ -194,38 +198,4 @@ context.setCampaignId(null); context.setScreen(TuttiScreen.EDIT_CAMPAIGN); } - - public void selectSurvey() { - - if (!comboIsAdjusting) { - - comboIsAdjusting = true; - - SurveyBean survey = ui.getSurveyListModel().getSelectedItem(); - getModel().setSurvey(survey); - - List<CampaignBean> allCampaigns = - persistenceService.getAllCampaigns(survey.getId()); - - ui.getCampaignListModel().setElements(allCampaigns); - ui.getCampaignListModel().setSelectedItem(null); - } - comboIsAdjusting = false; - - selectCampaign(); - } - - public void selectCampaign() { - - if (!comboIsAdjusting) { - - comboIsAdjusting = true; - - CampaignBean campaign = ui.getCampaignListModel().getSelectedItem(); - getModel().setCampaign(campaign); - - comboIsAdjusting = false; - } - } - } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -69,7 +69,7 @@ this.surveys = surveys; // nullify survey - setSurvey(null); +// setSurvey(null); firePropertyChange(PROPERTY_SURVEYS, oldValue, surveys); } @@ -82,7 +82,7 @@ this.survey = survey; // nullify campaigns - setCampaigns(null); +// setCampaigns(null); firePropertyChange(PROPERTY_SURVEY, oldValue, survey); firePropertyChange(PROPERTY_SURVEY_FOUND, oldValue != null, survey != null); @@ -101,7 +101,7 @@ this.campaigns = campaigns; // nullify campaign - setCampaign(null); +// setCampaign(null); firePropertyChange(PROPERTY_CAMPAIGNS, oldValue, campaigns); } @@ -120,5 +120,4 @@ return campaign != null; } - } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,7 +24,7 @@ BeanComboBox { showReset:true; - i18nPrefix:"tutti.common."; + i18nPrefix:"tutti.property."; bean:{model}; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,7 +22,7 @@ #L% --> <JPanel id='homePanel' layout='{new BorderLayout()}' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<CatchesUIHandler>'> + implements='fr.ifremer.tutti.ui.swing.TuttiUI<CatchesUIModel, CatchesUIHandler>'> <import> fr.ifremer.tutti.persistence.entities.TraitBean @@ -67,26 +67,26 @@ </Table> <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'> - <tab id='traitConfigTab' title='tutti.label.tab.trait'> - <TraitConfigTabUI id='traitConfigTabContent' constructorParams='this'/> + <tab id='traitTab' title='tutti.label.tab.trait'> + <TraitTabUI id='traitTabContent' constructorParams='this'/> </tab> <tab id='fishesTab' title='tutti.label.tab.fishes'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> <tab id='benthosTab' title='tutti.label.tab.benthos'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> <tab id='planctonTab' title='tutti.label.tab.plancton'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> <tab id='macroDechetsTab' title='tutti.label.tab.macroDechets'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> <tab id='captureAccidentellesTab' title='tutti.label.tab.captureAccidentelles'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> <tab id='observationIndividuellesTab' title='tutti.label.tab.observationIndividuelles'> - <JLabel text='tutti.to.be.done'/> + <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/> </tab> </JTabbedPane> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -26,6 +26,7 @@ import fr.ifremer.tutti.persistence.entities.CampaignBean; import fr.ifremer.tutti.persistence.entities.TraitBean; +import fr.ifremer.tutti.persistence.entities.TuttiBeans; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.TuttiUIContext; @@ -34,6 +35,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Date; import java.util.List; /** @@ -42,7 +44,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class CatchesUIHandler extends AbstractTuttiUIHandler { +public class CatchesUIHandler extends AbstractTuttiUIHandler<CatchesUIModel> { /** Logger. */ private static final Log log = LogFactory.getLog(CatchesUIHandler.class); @@ -75,11 +77,6 @@ log.info("Loaded " + traits.size() + " trait(s)."); } - if (!traits.isEmpty()) { - - model.setSelectedTrait(traits.get(0)); - } - ui.setContextValue(model); } @@ -88,33 +85,58 @@ CatchesUIModel model = ui.getModel(); - initBeanComboBox(TraitBean.class, - ui.getTraitComboBox(), - model.getTrait(), + initUI(ui); + + List<TraitBean> traits = model.getTrait(); + + initBeanComboBox(ui.getTraitComboBox(), + traits, model.getSelectedTrait()); - model.addPropertyChangeListener("selectedTrait", new PropertyChangeListener() { + model.addPropertyChangeListener(CatchesUIModel.PROPERTY_SELECTED_TRAIT, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { selectTrait((TraitBean) evt.getNewValue()); } }); -// selectTrait(null); + model.addPropertyChangeListener(CatchesUIModel.PROPERTY_TRAIT, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + ui.getTraitComboBox().setData(null); + ui.getTraitComboBox().setData((List<TraitBean>) evt.getNewValue()); + } + }); + + if (!traits.isEmpty()) { + + model.setSelectedTrait(traits.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.getTraitTabContent().getTraitTabPane().setSelectedIndex(0); } + @Override + protected CatchesUIModel getModel() { + return ui.getModel(); + } + public void createNewTrait() { // deselect selected trait ui.getModel().setSelectedTrait(null); // use a new empty trait - TraitBean selectedTrait = new TraitBean(); - selectTrait(selectedTrait); + TraitBean newTrait = new TraitBean(); + newTrait.setCampaign(ui.getModel().getCampaign()); + newTrait.setDate(new Date()); + selectTrait(newTrait); } public void selectTrait(TraitBean selectedTrait) { @@ -122,9 +144,18 @@ if (log.isInfoEnabled()) { log.info("New selected trait: " + selectedTrait); } + // back to trait tab + ui.getTabPane().setSelectedIndex(0); - ui.getTraitConfigTabContent().selectTrait(selectedTrait); + // back to general tab of trait tabs + ui.getTraitTabContent().getTraitTabPane().setSelectedIndex(0); + // propagate trait to his tabs + ui.getTraitTabContent().selectTrait(selectedTrait); + + // repaint tabs + ui.getTabPane().repaint(); + // ui.getFishesTabContent().selectTrait(selectedTrait); // ui.getBenthosTabContent().selectTrait(selectedTrait); // ui.getPlanctonTabContent().selectTrait(selectedTrait); @@ -132,4 +163,36 @@ // ui.getCaptureAccidentellesTabContent().selectTrait(selectedTrait); // ui.getObservationIndividuellesTabContent().selectTrait(selectedTrait); } + + public void saveTrait(TraitBean toSave) { + + // persist the trait + + boolean create = toSave.getId() == null; + + TraitBean savedTrait; + if (create) { + savedTrait = persistenceService.createTrait(toSave); + } else { + savedTrait = persistenceService.saveTrait(toSave); + } + + CatchesUIModel model = ui.getModel(); + + // add the saved trait to trait list + + List<TraitBean> data = model.getTrait(); + + TraitBean existingTrait = TuttiBeans.findById(data, savedTrait.getId()); + if (existingTrait != null) { + data.remove(existingTrait); + } + data.add(savedTrait); + + // update model trait list + model.setTrait(data); + + // update model selected trait + model.setSelectedTrait(savedTrait); + } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2012 Ifremer, Code Lutin + * 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 @@ -24,9 +24,9 @@ * #L% */ -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; import fr.ifremer.tutti.persistence.entities.CampaignBean; import fr.ifremer.tutti.persistence.entities.TraitBean; +import org.jdesktop.beans.AbstractSerializableBean; import java.util.List; @@ -36,10 +36,16 @@ * @author tchemit <chemit@codelutin.com> * @since 0.1 */ -public class CatchesUIModel extends AbstractTuttiEntity { +public class CatchesUIModel extends AbstractSerializableBean { private static final long serialVersionUID = 1L; + public static final String PROPERTY_TRAIT = "trait"; + + public static final String PROPERTY_SELECTED_TRAIT = "selectedTrait"; + + public static final String PROPERTY_CAMPAIGN = "campaign"; + protected List<TraitBean> trait; protected TraitBean selectedTrait; @@ -52,7 +58,7 @@ public void setTrait(List<TraitBean> trait) { this.trait = trait; - firePropertyChange("trait", null, trait); + firePropertyChange(PROPERTY_TRAIT, null, trait); } public TraitBean getSelectedTrait() { @@ -62,7 +68,7 @@ public void setSelectedTrait(TraitBean selectedTrait) { Object oldValue = getSelectedTrait(); this.selectedTrait = selectedTrait; - firePropertyChange("selectedTrait", oldValue, selectedTrait); + firePropertyChange(PROPERTY_SELECTED_TRAIT, oldValue, selectedTrait); } public CampaignBean getCampaign() { @@ -72,6 +78,6 @@ public void setCampaign(CampaignBean campaign) { Object oldValue = getCampaign(); this.campaign = campaign; - firePropertyChange("campaign", oldValue, campaign); + firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign); } } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.css 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -1,136 +0,0 @@ -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer, Code Lutin - * %% - * 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.common."; - bean:{model}; -} - -BeanListHeader { - showReset:true; - i18nPrefix:"tutti.common."; -} - -JList { - selectionMode:{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; - model:{new DefaultListModel()}; -} - -NumberEditor { - autoPopup:{handler.getConfig().isAutoPopupNumberEditor()}; - showPopupButton:{handler.getConfig().isShowNumberEditorButton()}; -} - -#stationNumberLabel { - text:"tutti.label.trait.stationNumber"; - labelFor:{stationNumberField}; -} - -#stationNumberField { - bean:{model}; - property:"stationNumber"; - model:{model.getStationNumber()}; - showReset:true; - useFloat:false; - numberPattern:{INT_6_DIGITS_PATTERN}; -} - -#traitNumberLabel { - text:"tutti.label.trait.traitNumber"; - labelFor:{traitNumberField}; -} - -#traitNumberField { - bean:{model}; - property:"traitNumber"; - model:{model.getTraitNumber()}; - showReset:true; - useFloat:false; - numberPattern:{INT_6_DIGITS_PATTERN}; -} - -#dateLabel { - text:"tutti.label.trait.date"; - labelFor:{dateField}; -} - -#dateField { - date:{model.getDate()}; - formats:{"dd/MM/yyyy"}; -} - -#saisisseurPane { - horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; - verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; -} - -#saisisseurHeader { - labelText:{_("tutti.label.list.saisisseur")}; - list:{saisisseurList}; - beanType:{UserBean.class}; -} - -#commentPane { - columnHeaderView:{new JLabel(_("tutti.label.comment"))}; - minimumSize:{new Dimension(10,50)}; -} - -#commentField { - text:{getStringValue(model.getComment())}; -} - -#noSelectionPane { - text:"tutti.to.be.done"; -} - -#saveButton { - actionIcon:"save"; - text:"tutti.action.save"; - enabled:{validator.isValid()}; -} - -#cancelButton { - actionIcon:"cancel"; - text:"tutti.action.cancel"; -} - -#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/TraitConfigTabUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.jaxx 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -1,154 +0,0 @@ -<!-- - #%L - Tutti :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2012 Ifremer, Code Lutin - %% - 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<TraitConfigTabUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.CountryBean - fr.ifremer.tutti.persistence.entities.GearBean - fr.ifremer.tutti.persistence.entities.SurveyBean - fr.ifremer.tutti.persistence.entities.UserBean - fr.ifremer.tutti.persistence.entities.VesselBean - fr.ifremer.tutti.persistence.entities.TraitBean - fr.ifremer.tutti.ui.swing.TuttiUIContext - - jaxx.runtime.swing.editor.bean.BeanComboBox - jaxx.runtime.swing.editor.bean.BeanListHeader - jaxx.runtime.swing.editor.NumberEditor - - 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 TraitConfigTabUI(CatchesUI parentUI) { - TraitConfigTabUIHandler handler = - new TraitConfigTabUIHandler(parentUI, this); - setContextValue(handler); - handler.beforeInitUI(); -} - -public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } - -protected void $afterCompleteSetup() { handler.afterInitUI(); } - ]]></script> - - <TraitConfigTabUIHandler id='handler' - initializer='getContextValue(TraitConfigTabUIHandler.class)'/> - - <TraitConfigTabUIModel id='model' - initializer='getContextValue(TraitConfigTabUIModel.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='traitNumber' component='traitNumberField'/> - <field name='date' component='dateField'/> - <field name='comment' component='commentField'/> - <field name='saisisseur' component='saisisseurPane'/> - </BeanValidator> - - <Table fill='both' id='traitForm' constraints='BorderLayout.CENTER'> - - <!-- Trait numero station --> - <row> - <cell> - <JLabel id='stationNumberLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='stationNumberField' constructorParams='this'/> - </cell> - </row> - - <!-- Trait numero trait / chalut --> - <row> - <cell> - <JLabel id='traitNumberLabel'/> - </cell> - <cell> - <NumberEditor id='traitNumberField' constructorParams='this'/> - </cell> - </row> - - <!-- Trait date --> - <row> - <cell> - <JLabel id='dateLabel'/> - </cell> - <cell> - <JXDatePicker id='dateField' - onActionPerformed='getModel().setDate(((JXDatePicker)event.getSource()).getDate())'/> - </cell> - </row> - - <!-- Trait saisisseur --> - <row> - <cell columns='2'> - <JScrollPane id='saisisseurPane' - columnHeaderView="{saisisseurHeader}" - onFocusGained='saisisseurList.requestFocus()'> - <JList id='saisisseurList' genericType='UserBean' - onValueChanged='if ( !event.getValueIsAdjusting()) { handler.selectSaisisseur(((JList)event.getSource()).getSelectedValues()); }'/> - <BeanListHeader id='saisisseurHeader' genericType='UserBean'/> - </JScrollPane> - </cell> - </row> - - <!-- Trait comment --> - <row weighty='0.3'> - <cell columns='2'> - <JScrollPane id='commentPane' - onFocusGained='commentField.requestFocus()'> - <JTextArea id='commentField' - onKeyReleased='getModel().setComment(((JTextArea)event.getSource()).getText())'/> - </JScrollPane> - </cell> - </row> - - <!-- Actions --> - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='saveButton' onActionPerformed='handler.save()'/> - </JPanel> - </cell> - </row> - </Table> - - <JLabel id='noSelectionPane'/> -</JPanel> Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIHandler.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -1,176 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer, Code Lutin - * %% - * 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.TraitBean; -import fr.ifremer.tutti.persistence.entities.UserBean; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import jaxx.runtime.swing.Table; -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.ListSelectionModel; -import java.awt.BorderLayout; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -/** - * Handler for UI {@link TraitConfigTabUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class TraitConfigTabUIHandler extends AbstractTuttiUIHandler { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(TraitConfigTabUIHandler.class); - - private final TraitConfigTabUI ui; - - private final CatchesUI parentUi; - - private final PersistenceService persistenceService; - - public TraitConfigTabUIHandler(CatchesUI parentUi, - TraitConfigTabUI ui) { - super(parentUi.getHandler().getContext()); - this.ui = ui; - this.parentUi = parentUi; - persistenceService = context.getService(PersistenceService.class); - } - - @Override - public void beforeInitUI() { - - TraitConfigTabUIModel model = new TraitConfigTabUIModel(); - model.addPropertyChangeListener("empty", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Table form = ui.getTraitForm(); - JLabel noContentPane = ui.getNoSelectionPane(); - - 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.setContextValue(model); - } - - @Override - public void afterInitUI() { - - TraitConfigTabUIModel model = ui.getModel(); - - List<UserBean> users = persistenceService.getAllUsers(); - - initBeanList(UserBean.class, - ui.getSaisisseurHeader(), - users, - model.getSaisisseur()); - - initNumberEditor(ui.getStationNumberField()); - initNumberEditor(ui.getTraitNumberField()); - initDatePicker(ui.getDateField()); - - model.setEmpty(true); - } - - @Override - public void onCloseUI() { - } - - public void selectSaisisseur(Object... selected) { - - ListSelectionModel selectionModel = - ui.getSaisisseurList().getSelectionModel(); - selectionModel.setValueIsAdjusting(true); - try { - List<UserBean> selectedList = Lists.newLinkedList(); - for (Object o : selected) { - selectedList.add((UserBean) o); - } - ui.getModel().setSaisisseur(selectedList); - } finally { - selectionModel.setValueIsAdjusting(false); - } - } - - public void selectTrait(TraitBean bean) { - - boolean empty = bean == null; - - TraitConfigTabUIModel model = ui.getModel(); - - // clean previous selection - ui.getSaisisseurHeader().getList().clearSelection(); - - if (empty) { - - model.fromBean(new TraitBean()); - } else { - - model.fromBean(bean); - } - - model.setEmpty(empty); - - ui.getValidator().reloadBean(); - } - - public void cancel() { - - String id = ui.getModel().getId(); - boolean newBean = StringUtils.isBlank(id); - - if (newBean) { - - // cancel to create a new trait - parentUi.getHandler().selectTrait(null); - - } else { - - // reselect in ui the trait - TraitBean selectedTrait = parentUi.getModel().getSelectedTrait(); - parentUi.getHandler().selectTrait(selectedTrait); - } - - } - - public void save() { - - } -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIModel.java 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -1,415 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.catches; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 Ifremer, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity; -import fr.ifremer.tutti.persistence.entities.CampaignBean; -import fr.ifremer.tutti.persistence.entities.TraitBean; -import fr.ifremer.tutti.persistence.entities.UserBean; -import org.nuiton.util.beans.BinderFactory; - -import java.util.Date; -import java.util.List; - -/** - * Model for UI {@link TraitConfigTabUI}. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class TraitConfigTabUIModel extends AbstractTuttiEntity { - - private static final long serialVersionUID = 1L; - - protected boolean empty; - - protected CampaignBean campaign; - - protected Integer stationNumber; - - protected Integer traitNumber; - - protected Date date; - - protected Object associationStrate; - - protected Float enPecheLatitude; - - protected Float enPecheLongitude; - - protected Date enPecheTime; - - protected Float enPecheProfondeur; - - protected Float sortieDeLEauLatitude; - - protected Float sortieDeLEauLongitude; - - protected Date sortieDeLEauTime; - - protected Float sortieDeLEauProfondeur; - - protected Integer forceVent; - - protected Integer directionVent; - - protected Object etatMer; - - protected Float ouvertureHorizontale; - - protected Float ouvertureVerticale; - - protected Boolean geometrieMesuree; - - protected Float longueurFunes; - - protected Float longueurBras; - - protected Boolean systemeFermetureCul; - - protected Boolean traitRectiligne; - - protected Float distanceChalutee; - - protected Float duree; - - protected Boolean traitValid; - - protected String localite; - - protected String comment; - - protected List<UserBean> saisisseur; - - - public boolean isEmpty() { - return empty; - } - - public void setEmpty(boolean empty) { - Object oldValue = isEmpty(); - this.empty = empty; - firePropertyChange("empty", oldValue, empty); - } - - public CampaignBean getCampaign() { - return campaign; - } - - public void setCampaign(CampaignBean campaign) { - this.campaign = campaign; - } - - public Integer getStationNumber() { - return stationNumber; - } - - public void setStationNumber(Integer stationNumber) { - Object oldValue = getStationNumber(); - this.stationNumber = stationNumber; - firePropertyChange("stationNumber", oldValue, stationNumber); - } - - public Integer getTraitNumber() { - return traitNumber; - } - - public void setTraitNumber(Integer traitNumber) { - Object oldValue = getTraitNumber(); - this.traitNumber = traitNumber; - firePropertyChange("traitNumber", oldValue, traitNumber); - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - Object oldValue = getDate(); - this.date = date; - firePropertyChange("date", oldValue, date); - } - - public Object getAssociationStrate() { - return associationStrate; - } - - public void setAssociationStrate(Object associationStrate) { - Object oldValue = getAssociationStrate(); - this.associationStrate = associationStrate; - firePropertyChange("associationStrate", oldValue, associationStrate); - } - - public Float getEnPecheLatitude() { - return enPecheLatitude; - } - - public void setEnPecheLatitude(Float enPecheLatitude) { - Object oldValue = getEnPecheLatitude(); - this.enPecheLatitude = enPecheLatitude; - firePropertyChange("enPecheLatitude", oldValue, enPecheLatitude); - } - - public Float getEnPecheLongitude() { - return enPecheLongitude; - } - - public void setEnPecheLongitude(Float enPecheLongitude) { - Object oldValue = getEnPecheLongitude(); - this.enPecheLongitude = enPecheLongitude; - firePropertyChange("enPecheLongitude", oldValue, enPecheLongitude); - } - - public Date getEnPecheTime() { - return enPecheTime; - } - - public void setEnPecheTime(Date enPecheTime) { - Object oldValue = getEnPecheTime(); - this.enPecheTime = enPecheTime; - firePropertyChange("enPecheTime", oldValue, enPecheTime); - } - - public Float getEnPecheProfondeur() { - return enPecheProfondeur; - } - - public void setEnPecheProfondeur(Float enPecheProfondeur) { - Object oldValue = getEnPecheProfondeur(); - this.enPecheProfondeur = enPecheProfondeur; - firePropertyChange("enPecheProfondeur", oldValue, enPecheProfondeur); - } - - public Float getSortieDeLEauLatitude() { - return sortieDeLEauLatitude; - } - - public void setSortieDeLEauLatitude(Float sortieDeLEauLatitude) { - Object oldValue = getSortieDeLEauLatitude(); - this.sortieDeLEauLatitude = sortieDeLEauLatitude; - firePropertyChange("sortieDeLEauLatitude", oldValue, sortieDeLEauLatitude); - } - - public Float getSortieDeLEauLongitude() { - return sortieDeLEauLongitude; - } - - public void setSortieDeLEauLongitude(Float sortieDeLEauLongitude) { - Object oldValue = getSortieDeLEauLongitude(); - this.sortieDeLEauLongitude = sortieDeLEauLongitude; - firePropertyChange("sortieDeLEauLongitude", oldValue, sortieDeLEauLongitude); - } - - public Date getSortieDeLEauTime() { - return sortieDeLEauTime; - } - - public void setSortieDeLEauTime(Date sortieDeLEauTime) { - Object oldValue = getSortieDeLEauTime(); - this.sortieDeLEauTime = sortieDeLEauTime; - firePropertyChange("sortieDeLEauTime", oldValue, sortieDeLEauTime); - } - - public Float getSortieDeLEauProfondeur() { - return sortieDeLEauProfondeur; - } - - public void setSortieDeLEauProfondeur(Float sortieDeLEauProfondeur) { - Object oldValue = getSortieDeLEauProfondeur(); - this.sortieDeLEauProfondeur = sortieDeLEauProfondeur; - firePropertyChange("sortieDeLEauProfondeur", oldValue, sortieDeLEauProfondeur); - } - - public Integer getForceVent() { - return forceVent; - } - - public void setForceVent(Integer forceVent) { - Object oldValue = getForceVent(); - this.forceVent = forceVent; - firePropertyChange("forceVent", oldValue, forceVent); - } - - public Integer getDirectionVent() { - return directionVent; - } - - public void setDirectionVent(Integer directionVent) { - Object oldValue = getDirectionVent(); - this.directionVent = directionVent; - firePropertyChange("directionVent", oldValue, directionVent); - } - - public Object getEtatMer() { - return etatMer; - } - - public void setEtatMer(Object etatMer) { - Object oldValue = getEtatMer(); - this.etatMer = etatMer; - firePropertyChange("etatMer", oldValue, etatMer); - } - - public Float getOuvertureHorizontale() { - return ouvertureHorizontale; - } - - public void setOuvertureHorizontale(Float ouvertureHorizontale) { - Object oldValue = getOuvertureHorizontale(); - this.ouvertureHorizontale = ouvertureHorizontale; - firePropertyChange("ouvertureHorizontale", oldValue, ouvertureHorizontale); - } - - public Float getOuvertureVerticale() { - return ouvertureVerticale; - } - - public void setOuvertureVerticale(Float ouvertureVerticale) { - Object oldValue = getOuvertureVerticale(); - this.ouvertureVerticale = ouvertureVerticale; - firePropertyChange("ouvertureVerticale", oldValue, ouvertureVerticale); - } - - public Boolean getGeometrieMesuree() { - return geometrieMesuree; - } - - public void setGeometrieMesuree(Boolean geometrieMesuree) { - Object oldValue = getGeometrieMesuree(); - this.geometrieMesuree = geometrieMesuree; - firePropertyChange("geometrieMesuree", oldValue, geometrieMesuree); - } - - public Float getLongueurFunes() { - return longueurFunes; - } - - public void setLongueurFunes(Float longueurFunes) { - Object oldValue = getLongueurFunes(); - this.longueurFunes = longueurFunes; - firePropertyChange("longueurFunes", oldValue, longueurFunes); - } - - public Float getLongueurBras() { - return longueurBras; - } - - public void setLongueurBras(Float longueurBras) { - Object oldValue = getLongueurBras(); - this.longueurBras = longueurBras; - firePropertyChange("longueurBras", oldValue, longueurBras); - } - - public Boolean getSystemeFermetureCul() { - return systemeFermetureCul; - } - - public void setSystemeFermetureCul(Boolean systemeFermetureCul) { - Object oldValue = getSystemeFermetureCul(); - this.systemeFermetureCul = systemeFermetureCul; - firePropertyChange("systemeFermetureCul", oldValue, systemeFermetureCul); - } - - public Boolean getTraitRectiligne() { - return traitRectiligne; - } - - public void setTraitRectiligne(Boolean traitRectiligne) { - Object oldValue = getTraitRectiligne(); - this.traitRectiligne = traitRectiligne; - firePropertyChange("traitRectiligne", oldValue, traitRectiligne); - } - - public Float getDistanceChalutee() { - return distanceChalutee; - } - - public void setDistanceChalutee(Float distanceChalutee) { - Object oldValue = getDistanceChalutee(); - this.distanceChalutee = distanceChalutee; - firePropertyChange("distanceChalutee", oldValue, distanceChalutee); - } - - public Float getDuree() { - return duree; - } - - public void setDuree(Float duree) { - Object oldValue = getDuree(); - this.duree = duree; - firePropertyChange("duree", oldValue, duree); - } - - public Boolean getTraitValid() { - return traitValid; - } - - public void setTraitValid(Boolean traitValid) { - Object oldValue = getTraitValid(); - this.traitValid = traitValid; - firePropertyChange("traitValid", oldValue, traitValid); - } - - public String getLocalite() { - return localite; - } - - public void setLocalite(String localite) { - Object oldValue = getLocalite(); - this.localite = localite; - firePropertyChange("localite", oldValue, localite); - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - Object oldValue = getComment(); - this.comment = comment; - firePropertyChange("comment", oldValue, comment); - } - - public List<UserBean> getSaisisseur() { - return saisisseur; - } - - public void setSaisisseur(List<UserBean> saisisseur) { - this.saisisseur = saisisseur; - firePropertyChange("saisisseur", null, saisisseur); - } - - public void fromBean(TraitBean bean) { - BinderFactory.newBinder(TraitBean.class, - TraitConfigTabUIModel.class).copy(bean, this); - } - - public TraitBean toBean() { - TraitBean result = new TraitBean(); - BinderFactory.newBinder(TraitConfigTabUIModel.class, - TraitBean.class).copy(this, result); - return result; - } -} \ No newline at end of file Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css (from rev 12, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,493 @@ +/* + * #%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; +} + +#stationNumberLabel { + text:"tutti.label.trait.stationNumber"; + labelFor:{stationNumberField}; +} + +#stationNumberTraitNumberLabel { + text:"tutti.label.trait.stationNumberTraitNumber"; +} + +#stationNumberField { + property:"stationNumber"; + model:{model.getStationNumber()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#traitNumberLabel { + text:"tutti.label.trait.traitNumber"; + labelFor:{traitNumberField}; +} + +#traitNumberField { + property:"traitNumber"; + model:{model.getTraitNumber()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#dateLabel { + text:"tutti.label.trait.date"; + labelFor:{dateField}; +} + +#dateField { + date:{model.getDate()}; + formats:{"dd/MM/yyyy"}; +} + +#strataLabel { + text:"tutti.label.trait.strata"; + labelFor:{strataComboBox}; +} + +#strataComboBox { + property:"strata"; + selectedItem:{model.getStrata()}; +} + +#beaufortScaleLabel { + text:"tutti.label.trait.beaufortScale"; + labelFor:{beaufortScaleComboBox}; +} + +#beaufortScaleComboBox { + property:"beaufortScale"; + selectedItem:{model.getBeaufortScale()}; +} + +#windDirectionLabel { + text:"tutti.label.trait.windDirection"; + labelFor:{windDirectionField}; +} + +#windDirectionField { + property:"windDirection"; + model:{model.getWindDirection()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#seaStateLabel { + text:"tutti.label.trait.seaState"; + labelFor:{seaStateComboBox}; +} + +#seaStateComboBox { + property:"seaState"; + selectedItem:{model.getSeaState()}; +} + +#ouvertureHorizontaleLabel { + text:"tutti.label.trait.ouvertureHorizontale"; + labelFor:{ouvertureHorizontaleField}; +} + +#ouvertureHorizontaleVerticaleLabel { + text:"tutti.label.trait.ouvertureHorizontaleVerticale"; +} + +#ouvertureHorizontaleField { + property:"ouvertureHorizontale"; + model:{model.getOuvertureHorizontale()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#ouvertureVerticaleLabel { + text:"tutti.label.trait.ouvertureVerticale"; + labelFor:{ouvertureVerticaleField}; +} + +#ouvertureVerticaleField { + property:"ouvertureVerticale"; + model:{model.getOuvertureVerticale()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#geometrieMesureeCheckBox { + text:"tutti.label.trait.geometrieMesuree"; + selected:{model.isGeometrieMesuree()}; +} + +#longueurFunesLabel { + text:"tutti.label.trait.longueurFunes"; + labelFor:{longueurFunesField}; +} + +#longueurFunesBrasLabel { + text:"tutti.label.trait.longueurFunesBras"; +} + +#longueurFunesField { + property:"longueurFunes"; + model:{model.getLongueurFunes()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#longueurBrasLabel { + text:"tutti.label.trait.longueurBras"; + labelFor:{longueurBrasField}; +} + +#longueurBrasField { + property:"longueurBras"; + model:{model.getLongueurBras()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#systemeFermetureCulCheckBox { + text:"tutti.label.trait.systemeFermetureCul"; + selected:{model.isSystemeFermetureCul()}; +} + +#traitRectiligneCheckBox { + text:"tutti.label.trait.traitRectiligne"; + selected:{model.isTraitRectiligne()}; +} + +#distanceChaluteeLabel { + text:"tutti.label.trait.distanceChalutee"; + labelFor:{distanceChaluteeField}; +} + +#distanceChaluteeDureeLabel { + text:"tutti.label.trait.distanceChaluteeDuree"; +} + +#distanceChaluteeField { + property:"distanceChalutee"; + model:{model.getDistanceChalutee()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#dureeLabel { + text:"tutti.label.trait.duree"; + labelFor:{dureeField}; +} + +#dureeField { + property:"duree"; + model:{model.getDuree()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#traitValidCheckBox { + text:"tutti.label.trait.traitValid"; + selected:{model.isTraitValid()}; +} + +#localiteLabel { + text:"tutti.label.trait.localite"; + labelFor:{localiteField}; +} + +#localiteField { + text:{model.getLocalite()}; +} + +#saisisseurPane { + horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; + verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}; +} + +#saisisseurHeader { + labelText:{_("tutti.label.list.saisisseur")}; + list:{saisisseurList}; + beanType:{UserBean.class}; +} + +#commentPane { + columnHeaderView:{new JLabel(_("tutti.label.comment"))}; + minimumSize:{new Dimension(10,50)}; +} + +#commentField { + text:{model.getComment()}; +} + +#gearShootingStartLongitudeLabel { + text:"tutti.label.trait.gearShootingStartLongitude"; + labelFor:{gearShootingStartLongitudeField}; +} + +#gearShootingStartLongitudeField { + text:{getStringValue(model.getGearShootingStartLongitude())}; +} + +#gearShootingStartLatitudeLabel { + text:"tutti.label.trait.gearShootingStartLatitude"; + labelFor:{gearShootingStartLatitudeField}; +} + +#gearShootingStartLatitudeField { + text:{getStringValue(model.getGearShootingStartLatitude())}; +} + +#gearShootingStartTimeLabel { + text:"tutti.label.trait.gearShootingStartTime"; + labelFor:{gearShootingStartTimeField}; +} + +#gearShootingStartTimeField { + text:{getStringValue(model.getGearShootingStartTime())}; +} + +#gearShootingStartDepthLabel { + text:"tutti.label.trait.gearShootingStartDepth"; + labelFor:{gearShootingStartDepthField}; +} + +#gearShootingStartDepthField { + property:"gearShootingStartDepth"; + model:{model.getGearShootingStartDepth()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndLongitudeLabel { + text:"tutti.label.trait.gearShootingEndLongitude"; + labelFor:{gearShootingEndLongitudeField}; +} + +#gearShootingEndLongitudeField { + text:{getStringValue(model.getGearShootingEndLongitude())}; +} + +#gearShootingEndLatitudeLabel { + text:"tutti.label.trait.gearShootingEndLatitude"; + labelFor:{gearShootingEndLatitudeField}; +} + +#gearShootingEndLatitudeField { + text:{getStringValue(model.getGearShootingEndLatitude())}; +} + +#gearShootingEndTimeLabel { + text:"tutti.label.trait.gearShootingEndTime"; + labelFor:{gearShootingEndTimeField}; +} + +#gearShootingEndTimeField { + text:{getStringValue(model.getGearShootingEndTime())}; +} + +#gearShootingEndDepthLabel { + text:"tutti.label.trait.gearShootingEndDepth"; + labelFor:{gearShootingEndDepthField}; +} + +#gearShootingEndDepthField { + property:"gearShootingEndDepth"; + model:{model.getGearShootingEndDepth()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartSurfaceTemperatureLabel { + text:"tutti.label.trait.gearShootingStartSurfaceTemperature"; + labelFor:{gearShootingStartSurfaceTemperatureField}; +} + +#gearShootingStartSurfaceTemperatureField { + property:"gearShootingStartSurfaceTemperature"; + model:{model.getGearShootingStartSurfaceTemperature()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndSurfaceTemperatureLabel { + text:"tutti.label.trait.gearShootingEndSurfaceTemperature"; + labelFor:{gearShootingEndSurfaceTemperatureField}; +} + +#gearShootingEndSurfaceTemperatureField { + property:"gearShootingEndSurfaceTemperature"; + model:{model.getGearShootingEndSurfaceTemperature()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartBottomTemperatureLabel { + text:"tutti.label.trait.gearShootingStartBottomTemperature"; + labelFor:{gearShootingStartBottomTemperatureField}; +} + +#gearShootingStartBottomTemperatureField { + property:"gearShootingStartBottomTemperature"; + model:{model.getGearShootingStartBottomTemperature()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndBottomTemperatureLabel { + text:"tutti.label.trait.gearShootingEndBottomTemperature"; + labelFor:{gearShootingEndBottomTemperatureField}; +} + +#gearShootingEndBottomTemperatureField { + property:"gearShootingEndBottomTemperature"; + model:{model.getGearShootingEndBottomTemperature()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#averageBottomTemperatureLabel { + text:"tutti.label.trait.averageBottomTemperature"; + labelFor:{averageBottomTemperatureField}; +} + +#averageBottomTemperatureField { + property:"averageBottomTemperature"; + model:{model.getAverageBottomTemperature()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartSurfaceSalinityLabel { + text:"tutti.label.trait.gearShootingStartSurfaceSalinity"; + labelFor:{gearShootingStartSurfaceSalinityField}; +} + +#gearShootingStartSurfaceSalinityField { + property:"gearShootingStartSurfaceSalinity"; + model:{model.getGearShootingStartSurfaceSalinity()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndSurfaceSalinityLabel { + text:"tutti.label.trait.gearShootingEndSurfaceSalinity"; + labelFor:{gearShootingEndSurfaceSalinityField}; +} + +#gearShootingEndSurfaceSalinityField { + property:"gearShootingEndSurfaceSalinity"; + model:{model.getGearShootingEndSurfaceSalinity()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingStartBottomSalinityLabel { + text:"tutti.label.trait.gearShootingStartBottomSalinity"; + labelFor:{gearShootingStartBottomSalinityField}; +} + +#gearShootingStartBottomSalinityField { + property:"gearShootingStartBottomSalinity"; + model:{model.getGearShootingStartBottomSalinity()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#gearShootingEndBottomSalinityLabel { + text:"tutti.label.trait.gearShootingEndBottomSalinity"; + labelFor:{gearShootingEndBottomSalinityField}; +} + +#gearShootingEndBottomSalinityField { + property:"gearShootingEndBottomSalinity"; + model:{model.getGearShootingEndBottomSalinity()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#averageBottomSalinityLabel { + text:"tutti.label.trait.averageBottomSalinity"; + labelFor:{averageBottomSalinityField}; +} + +#averageBottomSalinityField { + property:"averageBottomSalinity"; + model:{model.getAverageBottomSalinity()}; + useFloat:false; + numberPattern:{INT_6_DIGITS_PATTERN}; +} + +#noTraitPane { + text:"tutti.label.no.trait.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()}; +} + +#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/catches/TraitTabUI.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/catches/TraitTabUI.jaxx (from rev 12, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,537 @@ +<!-- + #%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<TraitTabUIModel, TraitTabUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.BeaufortScaleBean + fr.ifremer.tutti.persistence.entities.SeaStateBean + fr.ifremer.tutti.persistence.entities.StrataBean + fr.ifremer.tutti.persistence.entities.TraitBean + fr.ifremer.tutti.persistence.entities.UserBean + fr.ifremer.tutti.ui.swing.TuttiUIContext + + jaxx.runtime.swing.editor.bean.BeanComboBox + jaxx.runtime.swing.editor.bean.BeanListHeader + jaxx.runtime.swing.editor.NumberEditor + + 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 TraitTabUI(CatchesUI parentUI) { + TraitTabUIHandler handler = new TraitTabUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); +} + +public void selectTrait(TraitBean trait) { handler.selectTrait(trait); } + +protected void $afterCompleteSetup() { handler.afterInitUI(); } + ]]></script> + + <TraitTabUIHandler id='handler' + initializer='getContextValue(TraitTabUIHandler.class)'/> + + <TraitTabUIModel id='model' + initializer='getContextValue(TraitTabUIModel.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='traitNumber' component='traitNumberField'/> + <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.trait.general'> + <Table fill='both' id='generalForm'> + + <!-- Numero station --> + <row> + <cell anchor='west'> + <!--JLabel id='stationNumberLabel'/--> + <JLabel id='stationNumberTraitNumberLabel'/> + </cell> + <cell weightx='1.0'> + <JPanel layout='{new GridLayout(1,0)}'> + <NumberEditor id='stationNumberField' constructorParams='this'/> + <NumberEditor id='traitNumberField' constructorParams='this'/> + </JPanel> + </cell> + </row> + + <!-- Numero trait / chalut --> + <!--row> + <cell> + <JLabel id='traitNumberLabel'/> + </cell> + <cell> + <NumberEditor id='traitNumberField' constructorParams='this'/> + </cell> + </row--> + + <!-- Date --> + <row> + <cell> + <JLabel id='dateLabel'/> + </cell> + <cell> + <JXDatePicker id='dateField' + onActionPerformed='model.setDate(((JXDatePicker)event.getSource()).getDate())'/> + </cell> + </row> + + <!-- Strate d'association --> + <row> + <cell> + <JLabel id='strataLabel'/> + </cell> + <cell fill='horizontal'> + <BeanComboBox id='strataComboBox' constructorParams='this' + genericType='StrataBean'/> + </cell> + </row> + + <!-- Beaufort scale --> + <row> + <cell anchor='west'> + <JLabel id='beaufortScaleLabel'/> + </cell> + <cell fill='horizontal'> + <BeanComboBox id='beaufortScaleComboBox' constructorParams='this' + genericType='BeaufortScaleBean'/> + </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='SeaStateBean'/> + </cell> + </row> + + <!-- Ouverture horizontale --> + <row> + <cell anchor='west'> + <JLabel id='ouvertureHorizontaleVerticaleLabel'/> + </cell> + <cell fill='horizontal'> + <JPanel layout='{new GridLayout(1,0)}'> + <NumberEditor id='ouvertureHorizontaleField' + constructorParams='this'/> + <NumberEditor id='ouvertureVerticaleField' + constructorParams='this'/> + </JPanel> + </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='longueurFunesBrasLabel'/> + </cell> + <cell fill='horizontal'> + <JPanel layout='{new GridLayout(1,0)}'> + <NumberEditor id='longueurFunesField' constructorParams='this'/> + <NumberEditor id='longueurBrasField' constructorParams='this'/> + </JPanel> + </cell> + </row> + + <!-- Longueur bras --> + <!--row> + <cell anchor='west'> + <JLabel id='longueurBrasLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='longueurBrasField' constructorParams='this'/> + </cell> + </row--> + + <!-- Distance chalutée --> + <row> + <cell anchor='west'> + <JLabel id='distanceChaluteeDureeLabel'/> + </cell> + <cell fill='horizontal'> + <JPanel layout='{new GridLayout(1,0)}'> + <NumberEditor id='distanceChaluteeField' constructorParams='this'/> + <NumberEditor id='dureeField' constructorParams='this'/> + </JPanel> + </cell> + </row> + + <!-- Durée --> + <!--row> + <cell anchor='west'> + <JLabel id='dureeLabel'/> + </cell> + <cell fill='horizontal'> + <NumberEditor id='dureeField' constructorParams='this'/> + </cell> + </row--> + + <!-- Localité --> + <row> + <cell> + <JLabel id='localiteLabel'/> + </cell> + <cell> + <JTextField id='localiteField' + onKeyReleased='handler.setText(event, "localite")'/> + </cell> + </row> + + <!-- Trait valide / Rectiligne --> + <row> + <cell columns='2'> + <JPanel layout='{new GridLayout(1,0)}'> + <JCheckBox id='traitValidCheckBox' + onItemStateChanged='handler.setBoolean(event, "traitValid")'/> + <JCheckBox id='traitRectiligneCheckBox' + onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/> + </JPanel> + </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> + + <!-- Trait rectiligne --> + <!--row> + <cell columns='2'> + <JCheckBox id='traitRectiligneCheckBox' + onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/> + </cell> + </row--> + + <!-- Geometrie mesuree --> + <!--row> + <cell columns='2'> + <JCheckBox id='geometrieMesureeCheckBox' + onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/> + </cell> + </row--> + + <!-- Saisisseur --> + <row weighty='0.3'> + <cell columns='2'> + <JScrollPane id='saisisseurPane' + columnHeaderView="{saisisseurHeader}" + onFocusGained='saisisseurList.requestFocus()'> + <JList id='saisisseurList' genericType='UserBean' + onValueChanged='handler.selectListData(event, "saisisseur")'/> + <BeanListHeader id='saisisseurHeader' genericType='UserBean'/> + </JScrollPane> + </cell> + </row> + + <!-- Commentaire --> + <row weighty='0.3'> + <cell columns='2'> + <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.trait.gearShooting'> + + <Table fill='both' id='gearShootingForm'> + + <!-- GearShootingStart Longitude --> + <row> + <cell> + <JLabel id='gearShootingStartLongitudeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingStartLongitudeField' + onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingStart Latitude --> + <row> + <cell> + <JLabel id='gearShootingStartLatitudeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingStartLatitudeField' + onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingStart Time --> + <row> + <cell> + <JLabel id='gearShootingStartTimeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingStartTimeField' + onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingStart Depth --> + <row> + <cell> + <JLabel id='gearShootingStartDepthLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingStartDepthField' + constructorParams='this'/> + </cell> + </row> + + <!-- GearShootingEnd Longitude --> + <row> + <cell> + <JLabel id='gearShootingEndLongitudeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingEndLongitudeField' + onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingEnd Latitude --> + <row> + <cell> + <JLabel id='gearShootingEndLatitudeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingEndLatitudeField' + onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingEnd Time --> + <row> + <cell> + <JLabel id='gearShootingEndTimeLabel'/> + </cell> + <cell weightx='1.0'> + <JTextField id='gearShootingEndTimeField' + onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/> + </cell> + </row> + + <!-- GearShootingEnd Depth --> + <row> + <cell> + <JLabel id='gearShootingEndDepthLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='gearShootingEndDepthField' + constructorParams='this'/> + </cell> + </row> + </Table> + </tab> + + <tab id='traitHydrologyTabContent' title='tutti.label.tab.trait.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 GridLayout(1,2,0,0)}' constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='saveButton' onActionPerformed='handler.save()'/> + </JPanel> + </JPanel> + + <JLabel id='noTraitPane'/> +</JPanel> Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.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/catches/TraitTabUIHandler.java (from rev 12, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,233 @@ +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 com.google.common.collect.Lists; +import fr.ifremer.tutti.persistence.entities.TraitBean; +import fr.ifremer.tutti.persistence.entities.UserBean; +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 org.nuiton.validator.bean.simple.SimpleBeanValidator; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.ListSelectionModel; +import java.awt.BorderLayout; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.sql.Date; +import java.util.List; + +/** + * Handler for UI {@link TraitTabUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class TraitTabUIHandler extends AbstractTuttiUIHandler<TraitTabUIModel> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(TraitTabUIHandler.class); + + private final TraitTabUI ui; + + private final CatchesUI parentUi; + + private final PersistenceService persistenceService; + + public TraitTabUIHandler(CatchesUI parentUi, TraitTabUI ui) { + super(parentUi.getHandler().getContext()); + this.ui = ui; + this.parentUi = parentUi; + this.persistenceService = context.getService(PersistenceService.class); + } + + @Override + public void beforeInitUI() { + + TraitTabUIModel model = new TraitTabUIModel(); + model.addPropertyChangeListener(TraitTabUIModel.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() { + + TraitTabUIModel model = ui.getModel(); + + initUI(ui); + + initBeanList(ui.getSaisisseurHeader(), + persistenceService.getAllUsers(), + model.getSaisisseur()); + + initBeanComboBox(ui.getBeaufortScaleComboBox(), + persistenceService.getAllBeaufortScales(), + model.getBeaufortScale()); + + initBeanComboBox(ui.getStrataComboBox(), + persistenceService.getAllStratas(), + model.getStrata()); + + initBeanComboBox(ui.getSeaStateComboBox(), + persistenceService.getAllSeaStates(), + model.getSeaState()); + + model.setEmpty(true); + + listenValidatorValid(ui.getValidator(),getModel() ); + } + + @Override + public void onCloseUI() { + } + + @Override + protected TraitTabUIModel getModel() { + return ui.getModel(); + } + + public void selectTrait(TraitBean bean) { + + boolean empty = bean == null; + + TraitTabUIModel model = ui.getModel(); + + // clean previous selection + ui.getSaisisseurHeader().getList().clearSelection(); + + if (empty) { + + model.fromBean(new TraitBean()); + } else { + + model.fromBean(bean); + } + + // update saisissuer selection + List<UserBean> 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 trait can already cancel his creation + model.setModify(!empty && model.isCreate()); + } + + public void cancel() { + + String id = ui.getModel().getId(); + + if (log.isInfoEnabled()) { + log.info("Cancel edition for trait: " + id); + } + boolean newBean = StringUtils.isBlank(id); + + if (newBean) { + + // cancel to create a new trait + parentUi.getHandler().selectTrait(null); + + } else { + + // reselect in ui the trait + TraitBean selectedTrait = parentUi.getModel().getSelectedTrait(); + parentUi.getHandler().selectTrait(selectedTrait); + } + } + + public void save() { + + // get trait to save + TraitBean toSave = ui.getModel().toBean(); + + if (log.isInfoEnabled()) { + log.info("Save edition for trait: " + toSave.getId()); + } + + // keep selected tab (to resotre it after save) + int selectedIndex = ui.getTraitTabPane().getSelectedIndex(); + + // persist current trait + parentUi.getHandler().saveTrait(toSave); + + // reselect current tab + ui.getTraitTabPane().setSelectedIndex(selectedIndex); + } + + public void setGearShootingStartLatitude(String text) { + ui.getModel().setGearShootingStartLatitude(Float.valueOf(text)); + } + + public void setGearShootingStartLongitude(String text) { + ui.getModel().setGearShootingStartLongitude(Float.valueOf(text)); + } + + public void setGearShootingStartTime(String text) { + ui.getModel().setGearShootingStartTime(Date.valueOf(text)); + } + + public void setGearShootingEndLatitude(String text) { + ui.getModel().setGearShootingEndLatitude(Float.valueOf(text)); + } + + public void setGearShootingEndLongitude(String text) { + ui.getModel().setGearShootingEndLongitude(Float.valueOf(text)); + } + + public void setGearShootingEndTime(String text) { + ui.getModel().setGearShootingEndTime(Date.valueOf(text)); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java (from rev 12, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitConfigTabUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-11-24 13:10:24 UTC (rev 15) @@ -0,0 +1,615 @@ +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.BeaufortScaleBean; +import fr.ifremer.tutti.persistence.entities.CampaignBean; +import fr.ifremer.tutti.persistence.entities.SeaStateBean; +import fr.ifremer.tutti.persistence.entities.StrataBean; +import fr.ifremer.tutti.persistence.entities.TraitBean; +import fr.ifremer.tutti.persistence.entities.UserBean; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; +import org.nuiton.util.beans.BinderFactory; + +import java.util.Date; +import java.util.List; + +/** + * Model for UI {@link TraitTabUI}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class TraitTabUIModel extends AbstractTuttiBeanUIModel { + + 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_TRAIT_NUMBER = "traitNumber"; + + public static final String PROPERTY_DATE = "date"; + + public static final String PROPERTY_STRATA = "strata"; + + 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_TIME = "gearShootingStartTime"; + + 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_TIME = "gearShootingEndTime"; + + 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_TRAIT_RECTILIGNE = "traitRectiligne"; + + public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee"; + + public static final String PROPERTY_DUREE = "duree"; + + public static final String PROPERTY_TRAIT_VALID = "traitValid"; + + 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 CampaignBean campaign; + + protected Integer stationNumber; + + protected Integer traitNumber; + + protected Date date; + + protected StrataBean strata; + + protected Float gearShootingStartLatitude; + + protected Float gearShootingStartLongitude; + + protected Date gearShootingStartTime; + + protected Float gearShootingStartDepth; + + protected Float gearShootingEndLatitude; + + protected Float gearShootingEndLongitude; + + protected Date gearShootingEndTime; + + protected Float gearShootingEndDepth; + + protected BeaufortScaleBean beaufortScale; + + protected Integer windDirection; + + protected SeaStateBean seaState; + + protected Float ouvertureHorizontale; + + protected Float ouvertureVerticale; + + protected boolean geometrieMesuree; + + protected Float longueurFunes; + + protected Float longueurBras; + + protected boolean systemeFermetureCul; + + protected boolean traitRectiligne; + + protected Float distanceChalutee; + + protected Float duree; + + protected boolean traitValid; + + protected String localite; + + protected String comment; + + protected List<UserBean> saisisseur; + + protected Float gearShootingStartSurfaceTemperature; + + protected Float gearShootingEndSurfaceTemperature; + + protected Float gearShootingStartBottomTemperature; + + protected Float gearShootingEndBottomTemperature; + + protected Float averageBottomTemperature; + + protected Float gearShootingStartSurfaceSalinity; + + protected Float gearShootingEndSurfaceSalinity; + + protected Float gearShootingStartBottomSalinity; + + protected Float gearShootingEndBottomSalinity; + + protected Float averageBottomSalinity; + + public boolean isEmpty() { + return empty; + } + + public void setEmpty(boolean empty) { + Object oldValue = isEmpty(); + this.empty = empty; + firePropertyChange(PROPERTY_EMPTY, oldValue, empty); + } + + public CampaignBean getCampaign() { + return campaign; + } + + public void setCampaign(CampaignBean campaign) { + this.campaign = campaign; + } + + public Integer getStationNumber() { + return stationNumber; + } + + public void setStationNumber(Integer stationNumber) { + Object oldValue = getStationNumber(); + this.stationNumber = stationNumber; + firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber); + } + + public Integer getTraitNumber() { + return traitNumber; + } + + public void setTraitNumber(Integer traitNumber) { + Object oldValue = getTraitNumber(); + this.traitNumber = traitNumber; + firePropertyChange(PROPERTY_TRAIT_NUMBER, oldValue, traitNumber); + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + Object oldValue = getDate(); + this.date = date; + firePropertyChange(PROPERTY_DATE, oldValue, date); + } + + public StrataBean getStrata() { + return strata; + } + + public void setStrata(StrataBean strata) { + Object oldValue = getStrata(); + this.strata = strata; + firePropertyChange(PROPERTY_STRATA, oldValue, strata); + } + + 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 getGearShootingStartTime() { + return gearShootingStartTime; + } + + public void setGearShootingStartTime(Date gearShootingStartTime) { + Object oldValue = getGearShootingStartTime(); + this.gearShootingStartTime = gearShootingStartTime; + firePropertyChange(PROPERTY_GEAR_SHOOTING_START_TIME, oldValue, gearShootingStartTime); + } + + 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 getGearShootingEndTime() { + return gearShootingEndTime; + } + + public void setGearShootingEndTime(Date gearShootingEndTime) { + Object oldValue = getGearShootingEndTime(); + this.gearShootingEndTime = gearShootingEndTime; + firePropertyChange(PROPERTY_GEAR_SHOOTING_END_TIME, oldValue, gearShootingEndTime); + } + + 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 BeaufortScaleBean getBeaufortScale() { + return beaufortScale; + } + + public void setBeaufortScale(BeaufortScaleBean 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 SeaStateBean getSeaState() { + return seaState; + } + + public void setSeaState(SeaStateBean 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 isTraitRectiligne() { + return traitRectiligne; + } + + public void setTraitRectiligne(boolean traitRectiligne) { + Object oldValue = isTraitRectiligne(); + this.traitRectiligne = traitRectiligne; + firePropertyChange(PROPERTY_TRAIT_RECTILIGNE, oldValue, traitRectiligne); + } + + 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 isTraitValid() { + return traitValid; + } + + public void setTraitValid(boolean traitValid) { + Object oldValue = isTraitValid(); + this.traitValid = traitValid; + firePropertyChange(PROPERTY_TRAIT_VALID, oldValue, traitValid); + } + + 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<UserBean> getSaisisseur() { + return saisisseur; + } + + public void setSaisisseur(List<UserBean> 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); + } + + public void fromBean(TraitBean bean) { + BinderFactory.newBinder(TraitBean.class, + TraitTabUIModel.class).copy(bean, this); + } + + public TraitBean toBean() { + TraitBean result = new TraitBean(); + BinderFactory.newBinder(TraitTabUIModel.class, + TraitBean.class).copy(this, result); + return result; + } +} \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,8 +22,6 @@ <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"> Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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 @@ -22,8 +22,6 @@ <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"> Added: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml (rev 0) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -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.trait.stationNumber.required</message> + </field-validator> + + </field> + + <field name="date"> + + <field-validator type="required" short-circuit="true"> + <message>tutti.validator.error.trait.date.required</message> + </field-validator> + + </field> +</validators> Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-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-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-11-24 13:10:24 UTC (rev 15) @@ -1,5 +1,8 @@ tutti.about.bottomText=Copyright %s - %s - version %s -tutti.about.message=TODO +tutti.about.message=<h3>Tutti</h3><p><strong>Outil de saisie de données d'opérations et de captures au cours des campagnes halieutiques.</strong></p><br/><p>Ce logiciel permettra la saisie en mer des données d'opération de pêche (positions, environnement, engin, etc) et des captures associées (composition de la capture en espèces scientifiques avec poids, nombres, tailles etc) pour l'ensemble des campagnes halieutiques réalisées par l'Ifremer.</p>\ + <p>Ce projet a été initiée en 2012 par l'<a href\="http\://www.ifremer.fr">Ifremer</a> et réalisé par la société <a href\="http\://codelutin.com">Codelutin</a>.</p><hr/><br/>\ + <p>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.forge.codelutin.com/tutti">site du projet</a>.</p>\ + <p>Projet hébergé sur la forge <a href\="http\://forge.codelutin.com/projects/tutti">Forge.codelutin.com</a>.</p> tutti.action.about=A propos tutti.action.about.tip=A Propos tutti.action.cancel=Annuler @@ -37,9 +40,9 @@ tutti.config.license.organizationName=Nom de l'organisation dans la licence tutti.config.surveyId=Identifiant de la dernière série de campagne utilisée tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application) -tutti.config.ui.autoPopupNumberEditor= +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= +tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie tutti.label.campaign=Campagne tutti.label.campaign.country=Pays tutti.label.campaign.name=Nom @@ -51,6 +54,7 @@ tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri tutti.label.list.saisisseur=Nom des saisisseurs tutti.label.list.vessel=Navire(s) +tutti.label.no.trait.selected=< Aucun trait sélectionné > tutti.label.survey=Série de campagne tutti.label.survey.name=Nom tutti.label.survey.zone=Zone @@ -61,9 +65,45 @@ tutti.label.tab.observationIndividuelles=Observations individuelles tutti.label.tab.plancton=Plancton tutti.label.tab.trait=Trait +tutti.label.tab.trait.gearShooting=Données de traine +tutti.label.tab.trait.general=Caractéristiques +tutti.label.tab.trait.hydrology=Paramètres hydrologiques +tutti.label.trait.averageBottomSalinity=Salinité de fond moyenne +tutti.label.trait.averageBottomTemperature=Température de fond moyenne +tutti.label.trait.beaufortScale=Force du vent tutti.label.trait.date=Date -tutti.label.trait.stationNumber=Numéro de la station +tutti.label.trait.distanceChaluteeDuree=Distance chalutée / Durée +tutti.label.trait.duree=Durée +tutti.label.trait.gearShootingEndBottomSalinity=Salinité de fond fin de traine +tutti.label.trait.gearShootingEndBottomTemperature=Température de fond fin de traine +tutti.label.trait.gearShootingEndDepth=Profondeur fin de traine +tutti.label.trait.gearShootingEndLatitude=Latitude fin de traine +tutti.label.trait.gearShootingEndLongitude=Longitude fin de traine +tutti.label.trait.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine +tutti.label.trait.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine +tutti.label.trait.gearShootingEndTime=Fin de traine +tutti.label.trait.gearShootingStartBottomSalinity=Salinité de fond début de traine +tutti.label.trait.gearShootingStartBottomTemperature=Température de fond début de traine +tutti.label.trait.gearShootingStartDepth=Profondeur début de traine +tutti.label.trait.gearShootingStartLatitude=Latitude début de traine +tutti.label.trait.gearShootingStartLongitude=Longitude début de traine +tutti.label.trait.gearShootingStartSurfaceSalinity=Salinité de surface début de traine +tutti.label.trait.gearShootingStartSurfaceTemperature=Temperature de surface début de traine +tutti.label.trait.gearShootingStartTime=Début de traine +tutti.label.trait.geometrieMesuree=Géométrie mesurée +tutti.label.trait.localite=Localité +tutti.label.trait.longueurFunes=Longueur des funes +tutti.label.trait.longueurFunesBras=Longueur des funes / bras +tutti.label.trait.ouvertureHorizontaleVerticale=Ouverture horizontale / verticale +tutti.label.trait.ouvertureVerticale=Ouverture verticale +tutti.label.trait.seaState=Etat de la mer +tutti.label.trait.stationNumberTraitNumber=Numéro de la station / Trait +tutti.label.trait.strata=Strate d'association +tutti.label.trait.systemeFermetureCul=Système de fermeture de cul tutti.label.trait.traitNumber=Numéro du trait +tutti.label.trait.traitRectiligne=Trait rectiligne +tutti.label.trait.traitValid=Trait valide +tutti.label.trait.windDirection=Direction du vent tutti.menu.actions=Actions tutti.menu.actions.tip=Actions tutti.menu.file=Fichier @@ -90,7 +130,7 @@ tutti.title.noSelectedSurvey=Pas de série de campagne sélectionné tutti.title.selectedCampaign=Campagne %s tutti.title.selectedSurvey=Série de campagne %s -tutti.to.be.done=A FAIRE +tutti.to.be.done=< A FAIRE > tutti.validator.error.campaign.country.required=Le pays est obligatoire tutti.validator.error.campaign.gear.required=Au moins un engin doit être sélectionné tutti.validator.error.campaign.headOfMission.required=Au moins un chef de mission doit être sélectionné @@ -99,4 +139,6 @@ tutti.validator.error.campaign.survey.required=La série est obligatoire tutti.validator.error.campaign.vessel.required=Au moins un bateau doit être sélectionné tutti.validator.error.survey.name.required=Le nom de la série est obligatoire -tutti.validator.error.survey.zone.required=La zone de a série est obligatoire +tutti.validator.error.survey.zone.required=La zone de la série est obligatoire +tutti.validator.error.trait.date.required=La date du trait est obligatoire +tutti.validator.error.trait.stationNumber.required=Le numéro de station est obligatoire Modified: trunk/tutti-ui-swing/src/main/resources/log4j.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/log4j.properties 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/resources/log4j.properties 2012-11-24 13:10:24 UTC (rev 15) @@ -4,7 +4,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 2012 Ifremer, Code Lutin +# 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 Modified: trunk/tutti-ui-swing/src/main/resources/validators.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/validators.xml 2012-11-23 22:18:17 UTC (rev 14) +++ trunk/tutti-ui-swing/src/main/resources/validators.xml 2012-11-24 13:10:24 UTC (rev 15) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2012 Ifremer, Code Lutin + 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