r3158 - in isis-fish/branches/3.3.1: . src/main/java/fr/ifremer/isisfish/ui src/main/java/fr/ifremer/isisfish/ui/input src/main/java/fr/ifremer/isisfish/ui/input/tree src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors src/main/java/fr/ifremer/isisfish/ui/util
Author: chatellier Date: 2011-03-15 15:50:27 +0000 (Tue, 15 Mar 2011) New Revision: 3158 Log: Udpate jaxx tree api Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryDataProvider.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeNode.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/CellsNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/GearsNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/MetiersNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PopulationsNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PortsNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SetOfVesselsNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/StrategiesNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/TripTypesNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/VesselTypesNodeLoador.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ZonesNodeLoador.java Removed: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Help.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx Modified: isis-fish/branches/3.3.1/changelog.txt isis-fish/branches/3.3.1/pom.xml isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java Modified: isis-fish/branches/3.3.1/changelog.txt =================================================================== --- isis-fish/branches/3.3.1/changelog.txt 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/changelog.txt 2011-03-15 15:50:27 UTC (rev 3158) @@ -7,6 +7,12 @@ * Add group screening features * Modify parameters interface to prepare factorizable values (population/rule) * Factor, DesignPlan, Scenario and Domain are no longer generics + * Use new Jaxx tree api + * Update i18n to 2.3.1 + * Update to topia 2.5.3 + * Update to Jaxx 2.3 + * Update to rSyntaxTextArea 1.5.0 + * Update to svnkit 1.3.5 -- jeu. févr. 4 11:48:12 CET 2010 Modified: isis-fish/branches/3.3.1/pom.xml =================================================================== --- isis-fish/branches/3.3.1/pom.xml 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/pom.xml 2011-03-15 15:50:27 UTC (rev 3158) @@ -26,8 +26,8 @@ <dependency> <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n-api</artifactId> - <version>1.0.1</version> + <artifactId>nuiton-i18n</artifactId> + <version>${nuitonI18nVersion}</version> <scope>compile</scope> </dependency> @@ -46,16 +46,16 @@ </dependency> <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>3.3.2.GA</version> + <groupId>org.nuiton.matrix</groupId> + <artifactId>nuiton-matrix</artifactId> + <version>2.1</version> <scope>compile</scope> </dependency> - + <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-matrix</artifactId> - <version>2.0.1</version> + <groupId>org.nuiton.matrix</groupId> + <artifactId>nuiton-matrix-gui</artifactId> + <version>2.1</version> <scope>compile</scope> </dependency> @@ -83,21 +83,21 @@ <!-- Jaxx --> <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-validator</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> @@ -112,7 +112,7 @@ <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-j2r</artifactId> - <version>1.0.1</version> + <version>1.0.2</version> <scope>compile</scope> </dependency> @@ -139,11 +139,17 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math</artifactId> - <version>2.1</version> + <version>2.2</version> <scope>runtime</scope> <!--script --> </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.2</version> + </dependency> + + <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> @@ -199,23 +205,23 @@ </dependency> <dependency> - <groupId>org.nuiton.thirdparty</groupId> + <groupId>com.fifesoft</groupId> <artifactId>rsyntaxtextarea</artifactId> - <version>1.4.1</version> + <version>1.5.0</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> - <version>0.1.42</version> + <version>0.1.44-1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.swinglabs</groupId> - <artifactId>swingx</artifactId> - <version>1.6.1</version> + <artifactId>swingx-core</artifactId> + <version>1.6.2-2</version> <scope>compile</scope> </dependency> @@ -226,13 +232,6 @@ <scope>compile</scope> </dependency> - <dependency> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - <version>1.0.b2</version> - <scope>compile</scope> - </dependency> - <!-- Utilisé lors de l'import xml v2 (entre autre) --> <dependency> <groupId>jaxen</groupId> @@ -324,7 +323,7 @@ <dependency> <groupId>org.tmatesoft.svnkit</groupId> <artifactId>svnkit</artifactId> - <version>1.3.4</version> + <version>1.3.5</version> <scope>compile</scope> </dependency> <!-- fin svnkit pour communication subversion --> @@ -476,21 +475,19 @@ <!-- Super pom properties --> <projectId>isis-fish</projectId> <labs.id>8</labs.id> - <javadocPluginVersion>2.7</javadocPluginVersion> <siteLocales>fr,en</siteLocales> <maven.jar.main.class>fr.ifremer.isisfish.IsisFish</maven.jar.main.class> <license.licenseName>gpl_v2</license.licenseName> <!-- Dependencies version --> - <jaxxVersion>1.7.1</jaxxVersion> - <eugeneVersion>2.0.2</eugeneVersion> - <topiaVersion>2.3.4</topiaVersion> - <nuitonUtilsVersion>1.1.4</nuitonUtilsVersion> - <nuitonI18nVersion>1.2.2</nuitonI18nVersion> - <nuitonWidgetsVersion>1.0.1</nuitonWidgetsVersion> - <jrstPluginVersion>1.1.1</jrstPluginVersion> + <jaxxVersion>2.3</jaxxVersion> + <eugeneVersion>2.3.2</eugeneVersion> + <topiaVersion>2.5.3-SNAPSHOT</topiaVersion> + <nuitonUtilsVersion>2.0</nuitonUtilsVersion> + <nuitonI18nVersion>2.3.1</nuitonI18nVersion> + <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion> + <jrstPluginVersion>1.2</jrstPluginVersion> <aspectwerkzVersion>2.0</aspectwerkzVersion> - <xmlrpcVersion>3.1.2</xmlrpcVersion> <!-- jnlp (disabled until retested) <keystorepath>${codelutin.keystorepath}</keystorepath> @@ -522,13 +519,13 @@ <artifactId>maven-i18n-plugin</artifactId> <version>${nuitonI18nVersion}</version> </plugin> - <!-- <plugin> + <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> </configuration> - </plugin> --> + </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> @@ -601,7 +598,7 @@ <goal>smart-generate</goal> </goals> </execution> - <execution> + <!-- <execution> <id>copyVersionFiles</id> <phase>generate-sources</phase> <configuration> @@ -613,7 +610,7 @@ <goals> <goal>copyVersionFiles</goal> </goals> - </execution> + </execution> --> </executions> <dependencies> <dependency> @@ -635,9 +632,8 @@ </goals> <configuration> <src>${basedir}/src/main/java</src> - <extraImportList>jaxx.runtime.SwingUtil</extraImportList> <addSourcesToClassPath>true</addSourcesToClassPath> - <addProjectClassPath>true</addProjectClassPath> + <addProjectClassPath>true</addProjectClassPath> </configuration> </execution> </executions> Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,69 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXUtil; +import fr.ifremer.isisfish.ui.WelcomePanelUI; + +/** + * Common action for all handler. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class CommonHandler { + + /** + * Set main application status bar context. + * + * @param context context + * @param s string to set + */ + protected void setStatusMessage(JAXXContext context, String s) { + WelcomePanelUI root = context.getContextValue(WelcomePanelUI.class, JAXXUtil.PARENT); + if (root != null) { + root.setStatusMessage(s); + } + } + + /** + * Set main application status bar context. + * + * @param context context + * @param s string to set + * @param running enable progress bar running state + */ + protected void setStatusMessage(JAXXContext context, String s, boolean running) { + WelcomePanelUI root = context.getContextValue(WelcomePanelUI.class, JAXXUtil.PARENT); + if (root != null) { + root.setStatusMessage(s, running); + } + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Help.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Help.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Help.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -1,101 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin - * %% - * 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 2 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-2.0.html>. - * #L% - */ -/* *##% - * Copyright (C) 2006 - 2009 - * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin - * - * 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 2 - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ - -package fr.ifremer.isisfish.ui; - -import java.awt.Desktop; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Help. - * - * Created: 2 août 2006 10:53:43 - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class Help { - - /** Class logger. */ - private static Log log = LogFactory.getLog(Help.class); - - // URL alias - public static Map<String, String> URLSALIAS = new HashMap<String, String>(); - - static { - URLSALIAS.put("ISISFISH", "http://isis-fish.labs.libre-entreprise.org/"); - URLSALIAS.put("JAVA_API", "http://java.sun.com/javase/6/docs/api/index.html"); - URLSALIAS.put("ISIS_API", "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/index.html"); - URLSALIAS.put("MATRIX_API", "http://maven-site.nuiton.org/nuiton-matrix/apidocs/index.html"); - URLSALIAS.put("TOPIA_API", "http://maven-site.nuiton.org/topia/topia-persistence/apidocs/index.html"); - } - - /** - * Open url using default system browser. - * - * @param urlOrAlias url alias, or full url - */ - public static void showURL(String urlOrAlias) { - try { - String url = URLSALIAS.get(urlOrAlias); - - if (url == null) { - url = urlOrAlias; - } - - Desktop.getDesktop().browse(new URL(url).toURI()); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't show help", e); - } - } - } -} Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,3 @@ +<JPanel layout='{new BorderLayout()}'> + +</JPanel> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,314 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.ToolTipManager; + +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.swing.editor.config.ConfigUI; +import jaxx.runtime.swing.editor.config.ConfigUIHelper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.widget.AboutFrame; + +import fr.ifremer.isisfish.IsisConfig; +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.ui.config.SSHLauncherConfigUI; +import fr.ifremer.isisfish.ui.input.InputAction; +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; +import fr.ifremer.isisfish.ui.input.InputUI; +import fr.ifremer.isisfish.ui.queue.QueueUI; +import fr.ifremer.isisfish.ui.result.ResultView; +import fr.ifremer.isisfish.ui.script.ScriptUI; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; +import fr.ifremer.isisfish.ui.simulator.SimulAction; +import fr.ifremer.isisfish.ui.simulator.SimulUI; +import fr.ifremer.isisfish.ui.vcs.VCSConfigUI; + +/** + * Welcome related ui handler. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class WelcomeHandler extends CommonHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(WelcomeHandler.class); + + protected Map<JFrame, WelcomePanelUI> allFrameOpened; + protected WelcomeSaveVerifier verifier = new WelcomeSaveVerifier(); + + // URL alias + protected static final Map<String, String> URLSALIAS = new HashMap<String, String>(); + + static { + URLSALIAS.put("ISISFISH", "http://isis-fish.labs.libre-entreprise.org/"); + URLSALIAS.put("JAVA_API", "http://java.sun.com/javase/6/docs/api/index.html"); + URLSALIAS.put("ISIS_API", "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/index.html"); + URLSALIAS.put("MATRIX_API", "http://maven-site.nuiton.org/nuiton-matrix/apidocs/index.html"); + URLSALIAS.put("TOPIA_API", "http://maven-site.nuiton.org/topia/topia-persistence/apidocs/index.html"); + } + + public void postInit(WelcomeUI welcomeUI) { + welcomeUI.setContextValue(verifier); + allFrameOpened = new java.util.HashMap<JFrame, WelcomePanelUI>(); + welcomeUI.getWelcomePanelUI().setContent(new WelcomeTabUI(new JAXXInitialContext().add(verifier))); + + // increase tooltip display time + ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); + toolTipManager.setInitialDelay(0); + toolTipManager.setDismissDelay(60000); + } + + protected void openFrame(WelcomeUI welcomeUI, Component c, String title) { + + JAXXInitialContext childContext = new JAXXInitialContext().add(verifier).add(this); + WelcomePanelUI welcome = new WelcomePanelUI(childContext); + welcome.setContent(c); + + JFrame frame = new JFrame(title); + frame.setLayout(new BorderLayout()); + frame.add(welcome, BorderLayout.CENTER); + frame.setSize(new Dimension(800, 600)); + frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + + allFrameOpened.put(frame, welcome); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + JFrame f = (JFrame) e.getSource(); + allFrameOpened.get(f).close(f); + } + }); + frame.setLocationRelativeTo(welcomeUI); + frame.setVisible(true); + } + + /** + * + * @param welcomeUI + */ + public void newSimulationFrame(WelcomeUI welcomeUI) { + JAXXInitialContext context = new JAXXInitialContext(); + context.add(new SimulAction()); + context.add(this); + SimulUI simulUI = new SimulUI(context); + openFrame(welcomeUI, simulUI, _("isisfish.simulation.title")); + } + + /** + * + * @param welcomeUI + */ + public void newResultFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new ResultView(), _("isisfish.result.title")); + } + + /** + * + * @param welcomeUI + */ + public void newInputFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new InputUI(new JAXXInitialContext().add(verifier).add(new InputAction()).add(new InputSaveVerifier()).add(this)), _("isisfish.input.title")); + } + + /** + * + * @param welcomeUI + */ + public void newScriptFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new ScriptUI(), _("isisfish.script.title")); + } + + /** + * + * @param welcomeUI + */ + public void newSensitivityFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new SensitivityUI(new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(new SimulAction()).add(this)), _("isisfish.sensitivity.title")); + } + + /** + * + * @param welcomeUI + */ + public void newQueueFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new QueueUI(), _("isisfish.queue.title")); + } + + /** + * + * @param welcomeUI parent ui + */ + public void close(WelcomeUI welcomeUI) { + if (verifier.allIsSaved()) { + exit(welcomeUI); + } + } + + /** + * + * @param welcomeUI parent ui + */ + public void exit(WelcomeUI welcomeUI) { + welcomeUI.dispose(); + IsisFish.quit(); + } + + /** + * + * @param welcomeUI parent ui + */ + public void updateVCS(WelcomeUI welcomeUI) { + // FIXME a reimplanter + // thread:Welcome.updateVCS() + } + + /** + * Show config frame (Jaxx based). + * + * @param welcomeUI parent ui + */ + public void config(WelcomeUI welcomeUI) { + ConfigUIHelper modelBuilder = new ConfigUIHelper(IsisFish.config); + + // category main + modelBuilder.addCategory(_("isisfish.config.category.main"), _("isisfish.config.category.main.description")); + modelBuilder.addOption(IsisConfig.Option.CONFIG_FILE); + modelBuilder.addOption(IsisConfig.Option.DATABASE_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.COMPILATION_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.MONITORING_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.JAVADOC_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.BACKUP_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.LOCALE); + modelBuilder.addOption(IsisConfig.Option.SIMULATION_SHOW_ONLY_ERROR); + + // category control + modelBuilder.addCategory(_("isisfish.config.category.versioning"), _("isisfish.config.category.versioning.description")); + modelBuilder.addOption(IsisConfig.Option.VCS_TYPE); + modelBuilder.addOption(IsisConfig.Option.VCS_PROTOCOL); + modelBuilder.addOption(IsisConfig.Option.VCS_USER_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_USER_PASSWORD); + modelBuilder.addOption(IsisConfig.Option.VCS_HOST_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_PATH); + + // category misc + modelBuilder.addCategory(_("isisfish.config.category.misc"), _("isisfish.config.category.misc.description")); + modelBuilder.addOption(IsisConfig.Option.SSH_KEY_FILE); + modelBuilder.addOption(IsisConfig.Option.USER_NAME); + modelBuilder.addOption(IsisConfig.Option.SMTP_SERVER); + modelBuilder.addOption(IsisConfig.Option.USER_MAIL); + + ConfigUI configUI = modelBuilder.buildUI(welcomeUI, _("coser.config.category.path")); + JDialog dialogUI = new JDialog(welcomeUI, _("coser.ui.config.title")); + dialogUI.add(configUI); + dialogUI.pack(); + dialogUI.setLocationRelativeTo(welcomeUI); + dialogUI.setVisible(true); + } + + /** + * + * @param welcomeUI parent ui + */ + public void configVCS(WelcomeUI welcomeUI) { + VCSConfigUI vcsConfig = new VCSConfigUI(); + vcsConfig.pack(); + org.nuiton.widget.SwingUtil.center(vcsConfig); + vcsConfig.setVisible(true); + } + + /** + * + * @param welcomeUI parent ui + */ + public void configurationSSHLauncher(WelcomeUI welcomeUI) { + SSHLauncherConfigUI configUI = new SSHLauncherConfigUI(); + configUI.pack(); + configUI.setSize(600, configUI.getHeight()); + org.nuiton.widget.SwingUtil.center(configUI); + configUI.setVisible(true); + } + + /** + * Open url using default system browser. + * + * @param welcomeUI parent ui + * @param urlOrAlias url alias, or full url + */ + public void help(WelcomeUI welcomeUI, String urlOrAlias) { + try { + String url = URLSALIAS.get(urlOrAlias); + + if (url == null) { + url = urlOrAlias; + } + + Desktop.getDesktop().browse(new URL(url).toURI()); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't show help", e); + } + } + } + + /** + * Show about frame from nuiton-widgets. + * + * @param welcomeUI parent ui + */ + public void about(WelcomeUI welcomeUI) { + AboutFrame about = new AboutFrame(); + about.setTitle(_("isisfish.about.title")); + about.setIconPath("images/strategy.jpg"); + about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion())); + about.setLicenseText(_("isisfish.about.licensetext")); + about.setBackgroundColor(Color.WHITE); + about.setSize(640, 520); + about.setLocationRelativeTo(welcomeUI); + about.setVisible(true); + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -26,7 +26,7 @@ <script><![CDATA[ import fr.ifremer.isisfish.ui.simulator.SimulAction; import fr.ifremer.isisfish.ui.result.ResultAction; - import jaxx.runtime.JAXXInitialContext; + import jaxx.runtime.context.JAXXInitialContext; import fr.ifremer.isisfish.ui.input.InputAction; import fr.ifremer.isisfish.ui.input.InputSaveVerifier; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2006 - 2010 Ifremer, Code Lutin + Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,197 +23,45 @@ #L% --> <JFrame title="isisfish.welcome.title" width='874' height='736' resizable="true" layout='{new BorderLayout()}'> - <script><![CDATA[ - import static org.nuiton.i18n.I18n._; - import javax.swing.JFrame; - import java.util.Map; - import fr.ifremer.isisfish.IsisFish; - import fr.ifremer.isisfish.IsisConfig; - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.ui.input.InputUI; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; - import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; - import fr.ifremer.isisfish.ui.result.ResultAction; - import fr.ifremer.isisfish.ui.result.ResultView; - import fr.ifremer.isisfish.ui.script.ScriptUI; - import fr.ifremer.isisfish.ui.simulator.SimulUI; - import fr.ifremer.isisfish.ui.queue.QueueUI; - import fr.ifremer.isisfish.ui.config.SSHLauncherConfigUI; - import fr.ifremer.isisfish.ui.vcs.VCSConfigUI; - import org.nuiton.widget.AboutFrame; - import jaxx.runtime.DefaultJAXXContext; - import jaxx.runtime.JAXXInitialContext; - import jaxx.runtime.swing.editor.config.ConfigUI; - import jaxx.runtime.swing.editor.config.ConfigUIBuilder; - import jaxx.runtime.swing.editor.config.model.ConfigUIModel; + <WelcomeHandler id="handler" /> - Map<JFrame, WelcomePanelUI> allFrameOpened; - WelcomeSaveVerifier verifier = new WelcomeSaveVerifier(); - - setContextValue(verifier); - allFrameOpened = new java.util.HashMap<JFrame, WelcomePanelUI>(); - welcomePanelUI.setContent(new WelcomeTabUI(new JAXXInitialContext().add(getVerifier()))); - - // increase tooltip display time - ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); - toolTipManager.setInitialDelay(0); - toolTipManager.setDismissDelay(60000); - - protected void openFrame(Component c, String title) { - JFrame f = new JFrame(); - f.setLayout(new BorderLayout()); - - JAXXInitialContext childContext = new JAXXInitialContext().add(verifier).add(this); - WelcomePanelUI welcome = new WelcomePanelUI(childContext); - - welcome.setContent(c); - f.add(welcome, BorderLayout.CENTER); - f.setTitle(title); - f.setSize(new Dimension(800, 600)); - f.setDefaultCloseOperation(f.DO_NOTHING_ON_CLOSE); - - allFrameOpened.put(f, welcome); - f.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - JFrame f = (JFrame) e.getSource(); - allFrameOpened.get(f).close(f); - } - }); - org.nuiton.widget.SwingUtil.center(f); - f.setVisible(true); + <script><![CDATA[ + protected void $afterCompleteSetup() { + getHandler().postInit(this); } - public void close() { - if (verifier.allIsSaved()) { - exit(); - } - } - protected void exit() { - this.dispose(); - IsisFish.quit(); - } - protected WelcomeSaveVerifier getVerifier() { - return getContextValue(WelcomeSaveVerifier.class); - } - protected void updateVCS() { -// FIXME a reimplanter -// thread:Welcome.updateVCS() - } - - /** - * Show config frame (Jaxx based). - */ - protected void config() { - ConfigUIModel model = new ConfigUIModel(IsisFish.config); - - // categorie main - model.addCategory( - _("isisfish.config.category.main"), - _("isisfish.config.category.main.description"), - IsisConfig.Option.CONFIG_FILE, - IsisConfig.Option.DATABASE_DIRECTORY, - IsisConfig.Option.COMPILATION_DIRECTORY, - IsisConfig.Option.MONITORING_DIRECTORY, - IsisConfig.Option.JAVADOC_DIRECTORY, - IsisConfig.Option.BACKUP_DIRECTORY, - IsisConfig.Option.LOCALE, - IsisConfig.Option.SIMULATION_SHOW_ONLY_ERROR - ); - - // categorie versionning - model.addCategory( - _("isisfish.config.category.versioning"), - _("isisfish.config.category.versioning.description"), - IsisConfig.Option.VCS_TYPE, - IsisConfig.Option.VCS_PROTOCOL, - IsisConfig.Option.VCS_USER_NAME, - IsisConfig.Option.VCS_USER_PASSWORD, - IsisConfig.Option.VCS_HOST_NAME, - IsisConfig.Option.VCS_PATH - ); - - // categorie misc - model.addCategory( - _("isisfish.config.category.misc"), - _("isisfish.config.category.misc.description"), - IsisConfig.Option.SSH_KEY_FILE, - IsisConfig.Option.USER_NAME, - IsisConfig.Option.SMTP_SERVER, - IsisConfig.Option.USER_MAIL - ); - - ConfigUI configUI = ConfigUIBuilder.newConfigUI(new DefaultJAXXContext(this), model, _("isisfish.config.category.main")); - ConfigUIBuilder.showConfigUI(configUI, this, false); - } - - protected void configVCS() { - VCSConfigUI vcsConfig = new VCSConfigUI(); - vcsConfig.pack(); - org.nuiton.widget.SwingUtil.center(vcsConfig); - vcsConfig.setVisible(true); - } - - protected void configurationSSHLauncher() { - SSHLauncherConfigUI configUI = new SSHLauncherConfigUI(); - configUI.pack(); - configUI.setSize(600, configUI.getHeight()); - org.nuiton.widget.SwingUtil.center(configUI); - configUI.setVisible(true); - } - - protected void help(String urlAlias) { - Help.showURL(urlAlias); - } - - /** - * Show about frame from nuiton-widgets. - */ - protected void about() { - AboutFrame about = new AboutFrame(); - about.setTitle(_("isisfish.about.title")); - about.setIconPath("images/strategy.jpg"); - about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion())); - about.setLicenseText(_("isisfish.about.licensetext")); - about.setBackgroundColor(Color.WHITE); - about.setSize(640, 520); - org.nuiton.widget.SwingUtil.center(about); - about.setVisible(true); - } - ]]> - </script> + ]]></script> <JMenuBar> <JMenu text='isisfish.welcome.menu.file'> - <JMenuItem text="isisfish.welcome.menu.synchro" enabled='false' onActionPerformed='updateVCS()'/> + <JMenuItem text="isisfish.welcome.menu.synchro" enabled='false' onActionPerformed='getHandler().updateVCS(this)'/> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.close" onActionPerformed='close()'/> + <JMenuItem text="isisfish.welcome.menu.close" onActionPerformed='getHandler().close(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.frame"> - <JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='openFrame(new SimulUI(new JAXXInitialContext().add(new SimulAction()).add(this)), _("isisfish.simulation.title"))'/> - <JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='openFrame(new ResultView(), _("isisfish.result.title"))'/> - <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new JAXXInitialContext().add(verifier).add(new InputAction()).add(new InputSaveVerifier()).add(this)), _("isisfish.input.title"))'/> - <JMenuItem text="isisfish.welcome.menu.script" onActionPerformed='openFrame(new ScriptUI(), _("isisfish.script.title"))'/> - <JMenuItem text="isisfish.sensitivity.title" onActionPerformed='openFrame(new SensitivityUI(new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(new SimulAction()).add(this)), _("isisfish.sensitivity.title"))'/> + <JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='getHandler().newSimulationFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='getHandler().newResultFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='getHandler().newInputFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.script" onActionPerformed='getHandler().newScriptFrame(this)'/> + <JMenuItem text="isisfish.sensitivity.title" onActionPerformed='getHandler().newSensitivityFrame(this)'/> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='openFrame(new QueueUI(), _("isisfish.queue.title"))'/> + <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='getHandler().newQueueFrame(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.configuration"> - <JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='config()'/> - <JMenuItem text="isisfish.welcome.menu.configuration.vcs" onActionPerformed='configVCS()' enabled="false"/> - <JMenuItem text="isisfish.welcome.menu.configuration.sshlauncher" onActionPerformed='configurationSSHLauncher()'/> + <JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='getHandler().config(this)'/> + <JMenuItem text="isisfish.welcome.menu.configuration.vcs" onActionPerformed='getHandler().configVCS(this)' enabled="false"/> + <JMenuItem text="isisfish.welcome.menu.configuration.sshlauncher" onActionPerformed='getHandler().configurationSSHLauncher(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.help"> - <JMenuItem text="isisfish.welcome.menu.help.isisfish" onActionPerformed='help("ISISFISH")'/> + <JMenuItem text="isisfish.welcome.menu.help.isisfish" onActionPerformed='getHandler().help(this, "ISISFISH")'/> <JMenu text="isisfish.welcome.menu.api"> - <JMenuItem text="isisfish.welcome.menu.help.javaapi" onActionPerformed='help("JAVA_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.isisfishapi" onActionPerformed='help("ISIS_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.matrixapi" onActionPerformed='help("MATRIX_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.topiaapi" onActionPerformed='help("TOPIA_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.javaapi" onActionPerformed='getHandler().help(this, "JAVA_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.isisfishapi" onActionPerformed='getHandler().help(this, "ISIS_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.matrixapi" onActionPerformed='getHandler().help(this, "MATRIX_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.topiaapi" onActionPerformed='getHandler().help(this, "TOPIA_API")'/> </JMenu> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.about" onActionPerformed='about()'/> + <JMenuItem text="isisfish.welcome.menu.about" onActionPerformed='getHandler().about(this)'/> </JMenu> </JMenuBar> - <WelcomePanelUI id="welcomePanelUI" constructorParams='new DefaultJAXXContext(this)'/> + <WelcomePanelUI id="welcomePanelUI" constructorParams='this'/> </JFrame> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,64 +22,84 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Cell'> <!-- bean property --> - <fr.ifremer.isisfish.entities.CellImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Cell id='bean' javaBean='null'/> <script><![CDATA[ import java.awt.event.MouseEvent; import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.CellImpl; import com.bbn.openmap.gui.Tool; import com.bbn.openmap.gui.OMToolSet; import com.bbn.openmap.event.SelectMouseMode; import fr.ifremer.isisfish.map.CellSelectionLayer; import fr.ifremer.isisfish.map.CopyMapToClipboardListener; import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; protected OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; + boolean cellChanged = true; -setButtonTitle(_("isisfish.input.continueZones")); -setNextPath("$root/$zones"); -cellMap.addMapMouseListener(getMapListener()); -// add copy to clipboard support -cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); -toolSet.setupListeners(cellMap); -toolMap.add((Tool)toolSet); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldCellName.setText(""); - fieldCellLatitude.setText(""); - fieldCellLongitude.setText(""); - fieldCellComment.setText(""); - fieldCellLand.setSelected(false); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueZones")); + setNextPath("$root/$zones"); + new OpenMapEvents(cellMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + boolean result = false; + // TODO a fixer, le clic droit du menu contextuel + // passe aussi par ici et change la selection + //if (e.getButton() == MouseEvent.BUTTON1) { + for (Cell c : cellMap.getSelectedCells()) { + if (getBean() != null) { + if (!c.getTopiaId().equals(getBean().getTopiaId())) { + jaxx.runtime.SwingUtil.fillComboBox(fieldCell,getRegion().getCell(), c); + result = true; + } + } + } + //} + return result; } - if (evt.getNewValue() != null) { + }; + // add copy to clipboard support + cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); + toolSet.setupListeners(cellMap); + toolMap.add((Tool)toolSet); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldCellName.setText(""); + fieldCellLatitude.setText(""); + fieldCellLongitude.setText(""); + fieldCellComment.setText(""); + fieldCellLand.setSelected(false); + } + if (evt.getNewValue() != null) { + cellChanged = false; + jaxx.runtime.SwingUtil.fillComboBox(fieldCell, getRegion().getCell(), getBean()); + cellChanged = true; + } } - } -}); + }); +} @Override public void refresh() { Cell cell = getVerifier().getEntity(Cell.class); - + // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((CellImpl) cell); + setBean(cell); // reload region in map refreshRegionInMap(cellMap); - - cellChanged = false; - jaxx.runtime.SwingUtil.fillComboBox(fieldCell, getRegion().getCell(), getBean()); - cellChanged = true; } @Override @@ -88,33 +108,8 @@ getVerifier().setCancelButton(cancel); } -protected OpenMapEvents getMapListener() { - if (mapListener == null){ - mapListener = new OpenMapEvents(cellMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - boolean result = false; - // TODO a fixer, le clic droit du menu contextuel - // passe aussi par ici et change la selection - //if (e.getButton() == MouseEvent.BUTTON1) { - for (Cell c : cellMap.getSelectedCells()) { - if (getBean() != null) { - if (!c.getTopiaId().equals(getBean().getTopiaId())) { - jaxx.runtime.SwingUtil.fillComboBox(fieldCell,getRegion().getCell(), c); - result = true; - } - } - } - //} - return result; - } - }; - } - return mapListener; -} - -protected void fieldCellChanged() { - if (cellChanged) { +protected void fieldCellChanged(ItemEvent event) { + if (cellChanged && event.getStateChange() == ItemEvent.SELECTED) { Cell c = (Cell)fieldCell.getSelectedItem(); if (c==null) { return; @@ -129,7 +124,8 @@ // on ne sais jamais de quel type est le parent InputUI inputUI = getParentContainer(InputUI.class); if (inputUI != null) { - inputUI.setTreeSelection("$root/$cells/" + c.getTopiaId()); + // FIXME echatellier 20110306 : use new tree api + inputUI.getHandler().setTreeSelection(this, c.getTopiaId()); } else { SensitivityTabUI sensitivityTabUI = getParentContainer(SensitivityTabUI.class); @@ -138,57 +134,57 @@ } } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JSplitPane constraints='BorderLayout.CENTER' - oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> + <JPanel id="body"> + <JSplitPane constraints='BorderLayout.CENTER' oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> <Table> <row> <cell fill='horizontal' columns='2' weightx='1.0'> - <JComboBox id="fieldCell" onActionPerformed='fieldCellChanged()' model='{new DefaultComboBoxModel()}'/> + <JComboBox id="fieldCell" onItemStateChanged='fieldCellChanged(event)' + model='{new DefaultComboBoxModel()}' enabled='{getBean() != null}'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.name" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.name" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> <JTextField id="fieldCellName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' decorator='boxed' - onKeyReleased='getBean().setName(fieldCellName.getText())' enabled='{isActif()}'/> + onKeyReleased='getBean().setName(fieldCellName.getText())' enabled='{isActive()}'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.latitude" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.latitude" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLatitude" text='{getBean().getLatitude()}' editable="false" enabled='{isActif()}' decorator='boxed'/> + <JTextField id="fieldCellLatitude" text='{String.valueOf(getBean().getLatitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.longitude" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.longitude" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLongitude" text='{getBean().getLongitude()}' editable="false" enabled='{isActif()}' decorator='boxed'/> + <JTextField id="fieldCellLongitude" text='{String.valueOf(getBean().getLongitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.land" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.land" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActif()}' selected='{getBean().getLand()}' decorator='boxed'/> + <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActive()}' selected='{getBean().getLand()}' decorator='boxed'/> </cell> </row> <row> <cell columns='2' fill='horizontal'> - <JLabel text="isisfish.cell.comments" enabled='{isActif()}' horizontalAlignment="center"/> + <JLabel text="isisfish.cell.comments" enabled='{isActive()}' horizontalAlignment="center"/> </cell> </row> <row> <cell columns='2' fill='both' weighty='1.0' weightx='1.0'> <JScrollPane> - <JTextArea id="fieldCellComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldCellComment.getText())' enabled='{isActif()}' decorator='boxed'/> + <JTextArea id="fieldCellComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldCellComment.getText())' enabled='{isActive()}' decorator='boxed'/> </JScrollPane> </cell> </row> @@ -202,8 +198,12 @@ </row> </Table> <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' selectionMode="1" selectedCells='{getBean()}' fisheryRegion='{getRegion()}' constraints='BorderLayout.CENTER' decorator='boxed'/> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + constraints='BorderLayout.NORTH' decorator='boxed' enabled='{getBean() != null}' /> + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" + fisheryRegion='{getRegion()}' selectedCells='{getBean()}' + constraints='BorderLayout.CENTER' decorator='boxed' enabled='{getBean() != null}'/> </JPanel> </JSplitPane> </JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,58 +22,58 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.EffortDescriptionImpl id='effortDescription' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.EffortDescription id='effortDescription' javaBean='null'/> <script><![CDATA[ import java.util.ArrayList; import fr.ifremer.isisfish.entities.EffortDescription; -import fr.ifremer.isisfish.entities.EffortDescriptionImpl; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; import fr.ifremer.isisfish.entities.SetOfVessels; import fr.ifremer.isisfish.types.TimeUnit; import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListModel; import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListRenderer; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -addPropertyChangeListener("effortDescription", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldEffortDescriptionFishingOperation.setText(""); - fieldEffortDescriptionFishingOperationDuration.setText(""); - fieldEffortDescriptionGearsNumberPerOperation.setText(""); - fieldEffortDescriptionCrewSize.setText(""); - fieldEffortDescriptionUnitCostOfFishing.setText(""); - fieldEffortDescriptionFixedCrewSalary.setText(""); - fieldEffortDescriptionCrewFoodCost.setText(""); - fieldEffortDescriptionCrewShareRate.setText(""); - fieldEffortDescriptionRepairAndMaintenanceGearCost.setText(""); - fieldEffortDescriptionLandingCosts.setText(""); - fieldEffortDescriptionOtherRunningCost.setText(""); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_EFFORT_DESCRIPTION, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + fieldEffortDescriptionFishingOperation.setText(""); + fieldEffortDescriptionFishingOperationDuration.setText(""); + fieldEffortDescriptionGearsNumberPerOperation.setText(""); + fieldEffortDescriptionCrewSize.setText(""); + fieldEffortDescriptionUnitCostOfFishing.setText(""); + fieldEffortDescriptionFixedCrewSalary.setText(""); + fieldEffortDescriptionCrewFoodCost.setText(""); + fieldEffortDescriptionCrewShareRate.setText(""); + fieldEffortDescriptionRepairAndMaintenanceGearCost.setText(""); + fieldEffortDescriptionLandingCosts.setText(""); + fieldEffortDescriptionOtherRunningCost.setText(""); + } + if (evt.getNewValue() != null) { + EffortDescriptionListModel model = new EffortDescriptionListModel(); + // getBean().getPossibleMetiers() can be null at region creation + if (getBean() != null && getBean().getPossibleMetiers() != null) { + java.util.List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); + model.setEffortDescriptions(effortDescriptions); + } + fieldEffortDescriptionEffortDescriptionList.setModel(model); + } } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - @Override public void refresh() { SetOfVessels setOfVessels = getVerifier().getEntity(SetOfVessels.class); // twice event for jaxx bindings detection setBean(null); - setBean((SetOfVesselsImpl) setOfVessels); - - EffortDescriptionListModel model = new EffortDescriptionListModel(); - // getBean().getPossibleMetiers() can be null at region creation - if (getBean() != null && getBean().getPossibleMetiers() != null) { - java.util.List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); - model.setEffortDescriptions(effortDescriptions); - } - fieldEffortDescriptionEffortDescriptionList.setModel(model); + setBean(setOfVessels); } @Override @@ -83,7 +83,7 @@ } protected void effortDescriptionSelectionChanged() { - EffortDescriptionImpl selectedEffort = (EffortDescriptionImpl)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); + EffortDescription selectedEffort = (EffortDescription)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); setEffortDescription(selectedEffort); if (getEffortDescription() != null) { @@ -104,185 +104,187 @@ } ]]> </script> - <Table> - <row> - <cell rows='3' fill='both' weightx='0.4' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" - onValueChanged='effortDescriptionSelectionChanged()' - cellRenderer='{new EffortDescriptionListRenderer()}' - enabled='{isActif()}' /> - </JScrollPane> - </cell> - <cell columns='2' fill='both' weightx='1.0'> - <Table border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.effortTitle"))}'> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionFishingOperation' constructorParams='this' - bean='{getEffortDescription()}' property='fishingOperation' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"FishingOperation"'/--> - <JFormattedTextField id="fieldEffortDescriptionFishingOperation" text='{getEffortDescription().getFishingOperation()}' - onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FishingOperation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldEffortDescriptionFishingOperationDuration" - text='{getEffortDescription().getFishingOperationDuration() == null ? "" : getEffortDescription().getFishingOperationDuration().getHour()}' - toolTipText="isisfish.effortDescription.fishingOperationDuration.tooltip" onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(3600 * Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FishingOperationDuration"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionGearsNumberPerOperation' constructorParams='this' - bean='{getEffortDescription()}' property='gearsNumberPerOperation' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"GearsNumberPerOperation"'/--> - <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{getEffortDescription().getGearsNumberPerOperation()}' - onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"GearsNumberPerOperation"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='1.0'> - <Table anchor='north' fill='both' weighty='1.0' border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.economicTitle"))}'> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewSize" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewSize' constructorParams='this' - bean='{getEffortDescription()}' property='crewSize' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewSize"'/--> - <JTextField id="fieldEffortDescriptionCrewSize" text='{getEffortDescription().getCrewSize()}' - onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewSize"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionUnitCostOfFishing' constructorParams='this' - bean='{getEffortDescription()}' property='unitCostOfFishing' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"UnitCostOfFishing"'/--> - <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{getEffortDescription().getUnitCostOfFishing()}' - onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"UnitCostOfFishing"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionFixedCrewSalary' constructorParams='this' - bean='{getEffortDescription()}' property='fixedCrewSalary' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"FixedCrewSalary"'/--> - <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{getEffortDescription().getFixedCrewSalary()}' - onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FixedCrewSalary"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewFoodCost' constructorParams='this' - bean='{getEffortDescription()}' property='crewFoodCost' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewFoodCost"'/--> - <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{getEffortDescription().getCrewFoodCost()}' - onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewFoodCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewShareRate' constructorParams='this' - bean='{getEffortDescription()}' property='crewShareRate' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewShareRate"'/--> - <JTextField id="fieldEffortDescriptionCrewShareRate" text='{getEffortDescription().getCrewShareRate()}' - onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewShareRate"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionRepairAndMaintenanceGearCost' constructorParams='this' - bean='{getEffortDescription()}' property='repairAndMaintenanceGearCost' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' - _method='"RepairAndMaintenanceGearCost"' useSign='true'/--> - <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{getEffortDescription().getRepairAndMaintenanceGearCost()}' - onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"RepairAndMaintenanceGearCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionLandingCosts' constructorParams='this' - bean='{getEffortDescription()}' property='landingCosts' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"LandingCosts"'/--> - <JTextField id="fieldEffortDescriptionLandingCosts" text='{getEffortDescription().getLandingCosts()}' - onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"LandingCosts"'/> - </cell> - </row> - <row> - <cell anchor='northeast' fill='none' weighty='1.0'> - <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActif()}'/> - </cell> - <cell anchor='north' fill='horizontal' weightx='1.0' weighty='1.0'> - <!--NumberEditor id='fieldEffortDescriptionOtherRunningCost' constructorParams='this' - bean='{getEffortDescription()}' property='otherRunningCost' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"OtherRunningCost"'/--> - <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{getEffortDescription().getOtherRunningCost()}' - onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"OtherRunningCost"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.3'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell rows='3' fill='both' weightx='0.4' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" + onValueChanged='effortDescriptionSelectionChanged()' + cellRenderer='{new EffortDescriptionListRenderer()}' + enabled='{isActive()}' /> + </JScrollPane> + </cell> + <cell columns='2' fill='both' weightx='1.0'> + <Table border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.effortTitle"))}'> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldEffortDescriptionFishingOperation' constructorParams='this' + bean='{getEffortDescription()}' property='fishingOperation' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"FishingOperation"'/--> + <JFormattedTextField id="fieldEffortDescriptionFishingOperation" text='{String.valueOf(getEffortDescription().getFishingOperation())}' + onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"FishingOperation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldEffortDescriptionFishingOperationDuration" + text='{String.valueOf(getEffortDescription().getFishingOperationDuration() == null ? "" : getEffortDescription().getFishingOperationDuration().getHour())}' + toolTipText="isisfish.effortDescription.fishingOperationDuration.tooltip" onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(3600 * Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"FishingOperationDuration"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldEffortDescriptionGearsNumberPerOperation' constructorParams='this' + bean='{getEffortDescription()}' property='gearsNumberPerOperation' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"GearsNumberPerOperation"'/--> + <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{String.valueOf(getEffortDescription().getGearsNumberPerOperation())}' + onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"GearsNumberPerOperation"'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='1.0'> + <Table anchor='north' fill='both' weighty='1.0' border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.economicTitle"))}'> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewSize" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionCrewSize' constructorParams='this' + bean='{getEffortDescription()}' property='crewSize' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"CrewSize"'/--> + <JTextField id="fieldEffortDescriptionCrewSize" text='{String.valueOf(getEffortDescription().getCrewSize())}' + onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"CrewSize"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionUnitCostOfFishing' constructorParams='this' + bean='{getEffortDescription()}' property='unitCostOfFishing' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"UnitCostOfFishing"'/--> + <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{String.valueOf(getEffortDescription().getUnitCostOfFishing())}' + onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"UnitCostOfFishing"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionFixedCrewSalary' constructorParams='this' + bean='{getEffortDescription()}' property='fixedCrewSalary' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"FixedCrewSalary"'/--> + <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{String.valueOf(getEffortDescription().getFixedCrewSalary())}' + onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"FixedCrewSalary"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionCrewFoodCost' constructorParams='this' + bean='{getEffortDescription()}' property='crewFoodCost' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"CrewFoodCost"'/--> + <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{String.valueOf(getEffortDescription().getCrewFoodCost())}' + onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"CrewFoodCost"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionCrewShareRate' constructorParams='this' + bean='{getEffortDescription()}' property='crewShareRate' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"CrewShareRate"'/--> + <JTextField id="fieldEffortDescriptionCrewShareRate" text='{String.valueOf(getEffortDescription().getCrewShareRate())}' + onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"CrewShareRate"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionRepairAndMaintenanceGearCost' constructorParams='this' + bean='{getEffortDescription()}' property='repairAndMaintenanceGearCost' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' + _method='"RepairAndMaintenanceGearCost"' useSign='true'/--> + <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{String.valueOf(getEffortDescription().getRepairAndMaintenanceGearCost())}' + onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"RepairAndMaintenanceGearCost"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionLandingCosts' constructorParams='this' + bean='{getEffortDescription()}' property='landingCosts' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"LandingCosts"'/--> + <JTextField id="fieldEffortDescriptionLandingCosts" text='{String.valueOf(getEffortDescription().getLandingCosts())}' + onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"LandingCosts"'/> + </cell> + </row> + <row> + <cell anchor='northeast' fill='none' weighty='1.0'> + <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActive()}'/> + </cell> + <cell anchor='north' fill='horizontal' weightx='1.0' weighty='1.0'> + <!--NumberEditor id='fieldEffortDescriptionOtherRunningCost' constructorParams='this' + bean='{getEffortDescription()}' property='otherRunningCost' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{EffortDescription.class}' _method='"OtherRunningCost"'/--> + <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{String.valueOf(getEffortDescription().getOtherRunningCost())}' + onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{EffortDescription.class}' _method='"OtherRunningCost"'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.3'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,21 +22,22 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> <script><![CDATA[ import java.util.ArrayList; import fr.ifremer.isisfish.entities.EffortDescription; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; import fr.ifremer.isisfish.entities.SetOfVessels; import fr.ifremer.isisfish.entities.Metier; import fr.ifremer.isisfish.ui.input.setofvessels.MetierListModel; import fr.ifremer.isisfish.ui.input.setofvessels.MetierListRenderer; import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListModel; import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListRenderer; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; /** * Get input action from context. @@ -45,23 +46,28 @@ return getContextValue(InputAction.class); } +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + MetierListModel metierModel = (MetierListModel)fieldEffortDescriptionMetierList.getModel(); + if (evt.getOldValue() != null || evt.getNewValue() == null) { + metierModel.setMetiers(null); + } + if (evt.getNewValue() != null) { + metierModel.setMetiers(getRegion().getMetier()); + setEffortDescriptionEffortDescriptionList(); + } + } + }); +} + @Override public void refresh() { SetOfVessels setOfVessels = getVerifier().getEntity(SetOfVessels.class); // twice event for jaxx bindings detection setBean(null); - setBean((SetOfVesselsImpl) setOfVessels); - - // fill available metier list - MetierListModel metierModel = (MetierListModel)fieldEffortDescriptionMetierList.getModel(); - if (getBean() != null) { - metierModel.setMetiers(getRegion().getMetier()); - } - else { - metierModel.setMetiers(null); - } - setEffortDescriptionEffortDescriptionList(); + setBean(setOfVessels); } @Override @@ -73,7 +79,7 @@ protected void onFieldEffortDescriptionMetierListValueChanged() { // active le bouton seulement si l'interface est active // dans le cas de sensitivity par exemple - if (isActif()) { + if (isActive()) { buttonEffortDescriptionAdd.setEnabled(fieldEffortDescriptionMetierList.getSelectedIndex() != -1); } } @@ -81,7 +87,7 @@ protected void onFieldEffortDescriptionEffortDescriptionListValueChanged() { // active le bouton seulement si l'interface est active // dans le cas de sensitivity par exemple - if (isActif()) { + if (isActive()) { removeEffortDescriptionButton.setEnabled(fieldEffortDescriptionEffortDescriptionList.getSelectedIndex() != -1); } } @@ -113,42 +119,44 @@ } ]]> </script> - <Table> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionMetierList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - model='{new MetierListModel()}' cellRenderer='{new MetierListRenderer()}' - onValueChanged='onFieldEffortDescriptionMetierListValueChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='addEffortDescriptions()' enabled='false' - decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='removeEffortDescriptionButton' text="isisfish.common.remove" onActionPerformed='removeEffortDescriptions()' - enabled='false' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - cellRenderer='{new EffortDescriptionListRenderer()}' - onValueChanged='onFieldEffortDescriptionEffortDescriptionListValueChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionMetierList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + model='{new MetierListModel()}' cellRenderer='{new MetierListRenderer()}' + onValueChanged='onFieldEffortDescriptionMetierListValueChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='addEffortDescriptions()' enabled='false' + decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='removeEffortDescriptionButton' text="isisfish.common.remove" onActionPerformed='removeEffortDescriptions()' + enabled='false' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + cellRenderer='{new EffortDescriptionListRenderer()}' + onValueChanged='onFieldEffortDescriptionEffortDescriptionListValueChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,9 +22,10 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JDialog id="EquationEditorPane" modal="true" title="isisfish.equation.editor.title" width="400" height="400"> +<JDialog id="EquationEditorPane" modal="true" title="isisfish.equation.editor.title" + width="400" height="400" layout="{new BorderLayout()}"> - <script><![CDATA[ + <script><![CDATA[ import fr.ifremer.isisfish.util.CompileHelper; import fr.ifremer.isisfish.util.EvaluatorHelper; import org.nuiton.util.FileUtil; @@ -39,16 +40,18 @@ boolean ok = false; Class javaInterface = null; -setModalityType(Dialog.ModalityType.APPLICATION_MODAL); -doc.setEditable(false); -doc.setEditorKit(new HTMLEditorKit()); -doc.addHyperlinkListener(createHyperLinkListener()); +protected void $afterCompleteSetup() { + setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + doc.setEditable(false); + doc.setEditorKit(new HTMLEditorKit()); + doc.addHyperlinkListener(createHyperLinkListener()); -editor.setAskIfNotSaved(false); + editor.setAskIfNotSaved(false); -checkWindow.setEditable(false); + checkWindow.setEditable(false); -split.setDividerLocation(0.8) + split.setDividerLocation(0.8); +} public boolean isOk() { return ok; @@ -60,93 +63,89 @@ getEditor().open(FileUtil.getTempFile(content, ".java")); } - public HyperlinkListener createHyperLinkListener() { - return new HyperlinkListener() { - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - if (e instanceof HTMLFrameHyperlinkEvent) { - ((HTMLDocument)doc.getDocument()).processHTMLFrameHyperlinkEvent( - (HTMLFrameHyperlinkEvent)e); - } else { - try { - if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { - Desktop.getDesktop().browse(e.getURL().toURI()); - } else { - doc.setPage(e.getURL()); - } - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Error for : " + e.getURL(), ex); - } +public HyperlinkListener createHyperLinkListener() { + return new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if (e instanceof HTMLFrameHyperlinkEvent) { + ((HTMLDocument)doc.getDocument()).processHTMLFrameHyperlinkEvent( + (HTMLFrameHyperlinkEvent)e); + } else { + try { + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + Desktop.getDesktop().browse(e.getURL().toURI()); + } else { + doc.setPage(e.getURL()); } + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Error for : " + e.getURL(), ex); + } } } } - }; - } + } + }; +} - public void check() { +public void check() { + try { + String content = editor.getText(); + + StringWriter result = new StringWriter(); + PrintWriter out = new PrintWriter(result); + int compileResult = 0; try { - String content = editor.getText(); - - StringWriter result = new StringWriter(); - PrintWriter out = new PrintWriter(result); - int compileResult = 0; - try { - compileResult = EvaluatorHelper.check(javaInterface, content, out); - } catch (Exception eee) { - compileResult = -1; - } - - out.flush(); - if (compileResult != 0) { - checkWindow.setText(result.toString()); - checkWindow.setBackground(Color.red); - } else { - checkWindow.setText("Compilation Ok"); - checkWindow.setBackground(Color.white); - } - - } catch(Exception e){ - log.error("Can't check script", e); + compileResult = EvaluatorHelper.check(javaInterface, content, out); + } catch (Exception eee) { + compileResult = -1; } + + out.flush(); + if (compileResult != 0) { + checkWindow.setText(result.toString()); + checkWindow.setBackground(Color.red); + } else { + checkWindow.setText("Compilation Ok"); + checkWindow.setBackground(Color.white); + } + + } catch(Exception e){ + log.error("Can't check script", e); } +} ]]></script> - <Table weightx="1"> - <row> - <cell columns='4' weighty="1" fill='both'> - <JScrollPane> - <JEditorPane id="doc"/> - </JScrollPane> - </cell> - </row> - - <row columns='4' weighty="5" fill='both'> - <cell> - <JSplitPane id='split' orientation='vertical' oneTouchExpandable='true' resizeWeight='0.8'> - <org.nuiton.widget.editor.Editor id="editor"/> - <JScrollPane> - <JEditorPane id="checkWindow"/> - </JScrollPane> - </JSplitPane> - </cell> - </row> - - <row fill='horizontal'> - <cell> - <JButton text='isisfish.common.check' onActionPerformed='check()'/> - </cell> - <cell> - <JButton id='okButton' text='isisfish.common.ok' onActionPerformed='ok=true; setVisible(false)'/> - </cell> - <cell> - <JButton id='cancelButton' text='isisfish.common.cancel' onActionPerformed='setVisible(false)'/> - </cell> - <cell> - </cell> - </row> - - </Table> + <Table constraints="BorderLayout.CENTER"> + <row> + <cell columns='4' weighty="1" fill='both'> + <JScrollPane> + <JEditorPane id="doc" /> + </JScrollPane> + </cell> + </row> + <row columns='4' weighty="5" fill='both'> + <cell> + <JSplitPane id='split' orientation='vertical' + oneTouchExpandable='true' resizeWeight='0.8'> + <org.nuiton.widget.editor.Editor id="editor" /> + <JScrollPane> + <JEditorPane id="checkWindow" /> + </JScrollPane> + </JSplitPane> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JButton text='isisfish.common.check' onActionPerformed='check()' /> + </cell> + <cell> + <JButton id='okButton' text='isisfish.common.ok' onActionPerformed='ok=true; setVisible(false)' /> + </cell> + <cell> + <JButton id='cancelButton' text='isisfish.common.cancel' onActionPerformed='setVisible(false)' /> + </cell> + </row> + </Table> </JDialog> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,40 +22,52 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='FisheryRegion'> <!-- bean property --> - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.FisheryRegion id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; import fr.ifremer.isisfish.map.CopyMapToClipboardListener; import com.bbn.openmap.gui.Tool; import com.bbn.openmap.gui.OMToolSet; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; protected OMToolSet toolSet = new OMToolSet(); -toolSet.setupListeners(cellMap); -toolMap.add((Tool)toolSet); -// add copy to clipboard support -cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); - -setButtonTitle(_("isisfish.input.continueCells")); -setNextPath("$root/$cells"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - jaxx.runtime.SwingUtil.removeDataBinding($InputContentUI0, "cellMap.fisheryRegion"); +protected void $afterCompleteSetup() { + toolSet.setupListeners(cellMap); + toolMap.add((Tool)toolSet); + + // add copy to clipboard support + cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); + + setButtonTitle(_("isisfish.input.continueCells")); + setNextPath("$root/$cells"); + + addPropertyChangeListener("bean", new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + // remove previous binding on getBean() + //jaxx.runtime.SwingUtil.removeDataBinding($InputContentUI0, "cellMap.fisheryRegion"); + setFieldMapfilesModel(getBean()); + /* numberEditor is not working + fieldLatMin.init(); + fieldLatMax.init(); + fieldLongMin.init(); + fieldLongMax.init(); + fieldCellLengthLatitude.init(); + fieldCellLengthLongitude.init();*/ + } + if (evt.getNewValue() != null) { + // add binding on getBean() + //jaxx.runtime.SwingUtil.applyDataBinding($InputContentUI0, "cellMap.fisheryRegion"); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - jaxx.runtime.SwingUtil.applyDataBinding($InputContentUI0, "cellMap.fisheryRegion"); - } - } -}); + }); +} @Override public void refresh() { @@ -64,18 +76,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((FisheryRegionImpl)region); - - if (getBean() != null) { - setFieldMapfilesModel(getBean()); - /* numberEditor is not working - fieldLatMin.init(); - fieldLatMax.init(); - fieldLongMin.init(); - fieldLongMax.init(); - fieldCellLengthLatitude.init(); - fieldCellLengthLongitude.init();*/ - } + setBean(region); } @Override @@ -129,186 +130,188 @@ getInputAction().saveFisheryRegion(getBean()); getVerifier().setEditable(false); // TODO remove getParentContainer reference - getParentContainer(InputUI.class).setTreeModel(); - getParentContainer(InputUI.class).setFieldCurrentRegionModel(); + // FIXME echatellier 20110306 : use new tree cell api + //getParentContainer(InputUI.class).setTreeModel(); + //getParentContainer(InputUI.class).setFieldCurrentRegionModel(); setInfoText(_("isisfish.message.save.finished")); refresh(); } ]]></script> - <JPanel id='body' layout='{new BorderLayout()}'> - <JSplitPane id="FisheryRegionTab" name="FisheryRegion" constraints='BorderLayout.CENTER' - oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL"> - <Table> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.name"/> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <JTextField id="fieldRegion" decorator='boxed' - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' - onKeyReleased='getBean().setName(fieldRegion.getText())'/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.area"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude.min"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLatMin' constructorParams='this' - bean='{getBean()}' property='minLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLatMin" text='{getBean().getMinLatitude()}' decorator='boxed' - onKeyReleased='getBean().setMinLatitude(Float.parseFloat(fieldLatMin.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude.max"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLatMax' constructorParams='this' - bean='{getBean()}' property='maxLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLatMax" text='{getBean().getMaxLatitude()}' decorator='boxed' - onKeyReleased='getBean().setMaxLatitude(Float.parseFloat(fieldLatMax.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude.min"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLongMin' constructorParams='this' - bean='{getBean()}' property='minLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLongMin" text='{getBean().getMinLongitude()}' decorator='boxed' - onKeyReleased='getBean().setMinLongitude(Float.parseFloat(fieldLongMin.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude.max"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLongMax' constructorParams='this' - bean='{getBean()}' property='maxLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLongMax" text='{getBean().getMaxLongitude()}' decorator='boxed' - onKeyReleased='getBean().setMaxLongitude(Float.parseFloat(fieldLongMax.getText()))'/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.spatial"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldCellLengthLatitude' constructorParams='this' - bean='{getBean()}' property='cellLengthLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldCellLengthLatitude" text='{getBean().getCellLengthLatitude()}' decorator='boxed' - onKeyReleased='getBean().setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldCellLengthLongitude' constructorParams='this' - bean='{getBean()}' property='cellLengthLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldCellLengthLongitude" text='{getBean().getCellLengthLongitude()}' decorator='boxed' - onKeyReleased='getBean().setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()))'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.6'> - <JScrollPane> - <JList id="fieldMapfiles" decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonAddMap" text="isisfish.fisheryRegion.addMap" onActionPerformed='addMap()' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonRemoveMap" text="isisfish.fisheryRegion.delMap" onActionPerformed='delMap()' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.comments"/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.4'> - <JScrollPane> - <JTextArea id="fieldComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' decorator='boxed' - onKeyReleased='getBean().setComment(fieldComment.getText())'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.selectFile"/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.ofCells"/> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellFile" onKeyReleased='cellFillChanged()' decorator='boxed'/> - </cell> - <cell> - <JButton id="buttonCellFile" text="isisfish.common.ellipsis" onActionPerformed='cellFile()' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.3'> - <JButton id='save' enabled='false' onActionPerformed='save()' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='check' text="isisfish.common.check" onActionPerformed='check()' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + <JPanel id="body"> + <JSplitPane constraints='BorderLayout.CENTER' oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL"> + <Table> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.name"/> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <JTextField id="fieldRegion" decorator='boxed' + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' + onKeyReleased='getBean().setName(fieldRegion.getText())'/> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.area"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude.min"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLatMin' constructorParams='this' + bean='{getBean()}' property='minLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLatMin" text='{String.valueOf(getBean().getMinLatitude())}' decorator='boxed' + onKeyReleased='getBean().setMinLatitude(Float.parseFloat(fieldLatMin.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude.max"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLatMax' constructorParams='this' + bean='{getBean()}' property='maxLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLatMax" text='{String.valueOf(getBean().getMaxLatitude())}' decorator='boxed' + onKeyReleased='getBean().setMaxLatitude(Float.parseFloat(fieldLatMax.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude.min"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLongMin' constructorParams='this' + bean='{getBean()}' property='minLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLongMin" text='{String.valueOf(getBean().getMinLongitude())}' decorator='boxed' + onKeyReleased='getBean().setMinLongitude(Float.parseFloat(fieldLongMin.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude.max"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLongMax' constructorParams='this' + bean='{getBean()}' property='maxLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLongMax" text='{String.valueOf(getBean().getMaxLongitude())}' decorator='boxed' + onKeyReleased='getBean().setMaxLongitude(Float.parseFloat(fieldLongMax.getText()))'/> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.spatial"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldCellLengthLatitude' constructorParams='this' + bean='{getBean()}' property='cellLengthLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldCellLengthLatitude" text='{String.valueOf(getBean().getCellLengthLatitude())}' decorator='boxed' + onKeyReleased='getBean().setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldCellLengthLongitude' constructorParams='this' + bean='{getBean()}' property='cellLengthLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldCellLengthLongitude" text='{String.valueOf(getBean().getCellLengthLongitude())}' decorator='boxed' + onKeyReleased='getBean().setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()))'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='0.6'> + <JScrollPane> + <JList id="fieldMapfiles" decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonAddMap" text="isisfish.fisheryRegion.addMap" onActionPerformed='addMap()' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonRemoveMap" text="isisfish.fisheryRegion.delMap" onActionPerformed='delMap()' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.comments"/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='0.4'> + <JScrollPane> + <JTextArea id="fieldComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' decorator='boxed' + onKeyReleased='getBean().setComment(fieldComment.getText())'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.selectFile"/> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.ofCells"/> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell columns='4' fill='horizontal' weightx='1.0'> + <JTextField id="fieldCellFile" onKeyReleased='cellFillChanged()' decorator='boxed'/> + </cell> + <cell> + <JButton id="buttonCellFile" text="isisfish.common.ellipsis" onActionPerformed='cellFile()' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.3'> + <JButton id='save' enabled='false' onActionPerformed='save()' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='cancel' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='check' text="isisfish.common.check" onActionPerformed='check()' decorator='boxed'/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' selectionMode="0" javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.NO_SELECTION}" + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' fisheryRegion='{getBean()}' constraints='BorderLayout.CENTER' decorator='boxed'/> - </JPanel> - </JSplitPane> - </JPanel> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,31 +22,34 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; import jaxx.runtime.swing.editor.NumberEditor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldGearName.setText(""); - fieldGearEffortUnit.setText(""); - fieldGearStandardisationFactor.setText(""); - fieldGearParamName.setText(""); - fieldGearComment.setText(""); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldGearName.setText(""); + fieldGearEffortUnit.setText(""); + fieldGearStandardisationFactor.setText(""); + fieldGearParamName.setText(""); + fieldGearComment.setText(""); + } + if (evt.getNewValue() != null) { + + } } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - @Override public void refresh() { Gear gear = getVerifier().getEntity(Gear.class); @@ -54,7 +57,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((GearImpl) gear); + setBean(gear); getVerifier().addCurrentPanel(rangeOfValues); @@ -68,98 +71,100 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Gear"); + getVerifier().setNewButton(create, Gear.class); getVerifier().setDeleteButton(remove); } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.name" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldGearName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.effortUnit" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearEffortUnit" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getEffortUnit())}' - onKeyReleased='getBean().setEffortUnit(fieldGearEffortUnit.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldGearStandardisationFactor' constructorParams='this' - bean='{getBean()}' property='standardisationFactor' - enabled='{isActif()}' decorator='boxed' _bean='{GearImpl.class}' - _method='"StandardisationFactor"' useSign='true'/--> - <JTextField id="fieldGearStandardisationFactor" text='{getBean().getStandardisationFactor()}' - onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{GearImpl.class}' _method='"StandardisationFactor"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearParamName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getParameterName())}' - onKeyReleased='getBean().setParameterName(fieldGearParamName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <RangeOfValuesUI id="rangeOfValues" actif='{isActif()}' constructorParams='this' - decorator='boxed' _bean='{GearImpl.class}' _method='"PossibleValue"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.comments" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldGearComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldGearComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.name" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <JTextField id="fieldGearName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldGearName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.effortUnit" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <JTextField id="fieldGearEffortUnit" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getEffortUnit())}' + onKeyReleased='getBean().setEffortUnit(fieldGearEffortUnit.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldGearStandardisationFactor' constructorParams='this' + bean='{getBean()}' property='standardisationFactor' + enabled='{isActive()}' decorator='boxed' _bean='{Gear.class}' + _method='"StandardisationFactor"' useSign='true'/--> + <JTextField id="fieldGearStandardisationFactor" text='{String.valueOf(getBean().getStandardisationFactor())}' + onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{Gear.class}' _method='"StandardisationFactor"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.technicalParameter" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <JTextField id="fieldGearParamName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getParameterName())}' + onKeyReleased='getBean().setParameterName(fieldGearParamName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.rangeValues" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <RangeOfValuesUI id="rangeOfValues" active='{isActive()}' constructorParams='this' + decorator='boxed' _bean='{Gear.class}' _method='"PossibleValue"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.comments" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTextArea id="fieldGearComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldGearComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,21 +22,40 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Gear'> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + <script><![CDATA[ -// constructor code -setButtonTitle(_("isisfish.input.continueMetiers")); -setNextPath("$root/$metiers"); +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; - at Override -public void refresh() { +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueMetiers")); + setNextPath("$root/$metiers"); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + } + if (evt.getNewValue() != null) { + //getVerifier().addCurrentPanel(gearTabUI, selectivityUI); + } + } + }); + // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(gearTab); +} - getVerifier().addCurrentPanel(gearTabUI, selectivityUI); + at Override +public void refresh() { + + + + //getVerifier().addCurrentPanel(gearTabUI, selectivityUI); } @Override @@ -45,13 +64,13 @@ setCurrentTabActionButtons(gearTab); } ]]></script> - <JPanel layout='{new BorderLayout()}'> + <JPanel id="body"> <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab"> <tab title='{_("isisfish.gear.title")}'> - <GearTabUI id="gearTabUI" constructorParams='this'/> + <GearTabUI id="gearTabUI" bean="{getBean()}" active="{isActive()}" constructorParams='this' /> </tab> <tab title='{_("isisfish.selectivity.title")}'> - <SelectivityUI id="selectivityUI" constructorParams='this'/> + <SelectivityUI id="selectivityUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -34,10 +34,7 @@ import java.util.List; import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixFactory; @@ -51,41 +48,42 @@ import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.datastore.FormuleStorage; import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.StorageException; -import fr.ifremer.isisfish.datastore.update.ImportFromV2; import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.CellDAO; import fr.ifremer.isisfish.entities.EffortDescription; import fr.ifremer.isisfish.entities.EffortDescriptionDAO; +import fr.ifremer.isisfish.entities.EffortDescriptionImpl; import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.FisheryRegionDAO; +import fr.ifremer.isisfish.entities.FisheryRegionImpl; import fr.ifremer.isisfish.entities.Formule; import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.GearDAO; import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.MetierDAO; +import fr.ifremer.isisfish.entities.MetierImpl; import fr.ifremer.isisfish.entities.MetierSeasonInfo; import fr.ifremer.isisfish.entities.MetierSeasonInfoDAO; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationDAO; import fr.ifremer.isisfish.entities.PopulationGroup; +import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.PopulationSeasonInfo; import fr.ifremer.isisfish.entities.PopulationSeasonInfoDAO; import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Selectivity; import fr.ifremer.isisfish.entities.SelectivityDAO; import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.SetOfVesselsDAO; import fr.ifremer.isisfish.entities.Species; import fr.ifremer.isisfish.entities.SpeciesDAO; import fr.ifremer.isisfish.entities.TargetSpecies; import fr.ifremer.isisfish.entities.TargetSpeciesDAO; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.mexico.export.RegionExplorer; -import fr.ifremer.isisfish.mexico.export.RegionExport; -import fr.ifremer.isisfish.mexico.export.RegionExportFactorXML; import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.ui.input.check.CheckRegion; import fr.ifremer.isisfish.ui.input.check.CheckResult; import fr.ifremer.isisfish.ui.input.check.CheckResultFrame; -import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; import fr.ifremer.isisfish.ui.util.ErrorHelper; import fr.ifremer.isisfish.util.CellPointcomparator; @@ -105,320 +103,6 @@ /** Class logger. */ private static Log log = LogFactory.getLog(InputAction.class); - /** - * Exporter la region dans un zip. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importRegion() { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - if (file != null) { - RegionStorage.importZip(file); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Exporter la region dans un zip. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importRegionAndRename() { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - if (file != null) { - - String newName = JOptionPane - .showInputDialog(_("isisfish.message.name.imported.region")); - RegionStorage.importAndRenameZip(file, newName); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Importer la region depuis un fichier XML de la version 2. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importV2Region() { - File file = null; - try { - file = FileUtil.getFile(".*.xml$", - _("isisfish.message.import.region.xml")); - if (file != null) { - new ImportFromV2(true).importXML(file); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Extract from a simulation the region, and rename it with name given - * by user. - * - * @return le nom de la region entré par l'utilsateur - */ - public String importRegionFromSimulation() { - - // first step select a simulation and new region name - String simulationName; - try { - //TODO Should use a shared model ? - simulationName = SimulationFilterUtil - .selectSimulation(SimulationStorage.getSimulationNames()); - if (simulationName == null) { - return null; - } - - } catch (Exception eee) { - String msg = _("isisfish.error.no.select.simulation"); - if (log.isWarnEnabled()) { - log.warn(msg, eee); - } - ErrorHelper.showErrorDialog( - _("isisfish.error.no.select.simulation"), eee); - return null; - } - - if (log.isInfoEnabled()) { - log.info("simulation used " + simulationName); - } - - // ask new region name - String regionName = JOptionPane.showInputDialog( - _("isisfish.message.import.region.name"), "region from " - + simulationName); - if (regionName == null || "".equals(regionName)) { - return null; - } - if (RegionStorage.getRegionNames().contains(regionName)) { - return null; - } - - if (log.isInfoEnabled()) { - log.info("new region name " + regionName); - } - - try { - SimulationStorage.getSimulation(simulationName).extractRegion( - regionName); - } catch (StorageException eee) { - if (log.isErrorEnabled()) { - log.error("Can't extract region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return regionName; - } - - /** - * Exporter la region dans un zip - * - * @param regionStorage storage to export - * @return file were region were exported - */ - public File exportRegion(RegionStorage regionStorage) { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - - // add .zip extension is not set - if (!file.getAbsolutePath().endsWith(".zip")) { - file = new File(file.getAbsolutePath() + ".zip"); - } - - if (file != null) { - int resp = JOptionPane.YES_OPTION; - if (file.exists()) { - resp = JOptionPane.showConfirmDialog(null, - _("isisfish.message.file.overwrite")); - } - if (resp == JOptionPane.YES_OPTION) { - regionStorage.createZip(file); - } - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't export region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.export"), eee); - } - return file; - } - - /** - * Copy la region avec un autre nom. - * - * @param regionStorage region to copy - * @return le nom de la nouvelle region - */ - public String copyRegion(RegionStorage regionStorage) { - String newName = null; - try { - newName = JOptionPane - .showInputDialog(_("isisfish.message.new.region.name")); - - if (!StringUtils.isEmpty(newName)) { - File zip = regionStorage.createZip(); - RegionStorage.importAndRenameZip(zip, newName); - } - - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't copy region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.copy"), eee); - } - return newName; - } - - /** - * Remove region. - * - * @param regionStorage region storage - * @param cvsDelete if true delete region in CVS too - * @return removed region - */ - public boolean removeRegion(RegionStorage regionStorage, boolean cvsDelete) { - boolean result = false; - try { - int resp = JOptionPane.showConfirmDialog(null, _( - "isisfish.message.confirm.remove.region", regionStorage - .getName())); - if (resp == JOptionPane.YES_OPTION) { - regionStorage.delete(cvsDelete); - result = true; - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't remove region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.remove"), eee); - } - return result; - } - - /** - * Commit region. - * - * @param regionStorage region storage - * @return status message - */ - public String commitRegionInCVS(RegionStorage regionStorage) { - String result = null; - try { - String msg = regionStorage.getCommentForNextCommit(); - JTextArea text = new JTextArea(msg); - int resp = JOptionPane.showOptionDialog(null, - new JScrollPane(text), _("isisfish.commit.message"), - JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, - null, // icon - null, null); - if (resp == JOptionPane.OK_OPTION) { - regionStorage.commit(text.getText()); - regionStorage.clearCommentForNextCommit(); - result = _("isisfish.message.region.commited"); - } else { - result = _("isisfish.message.commit.region.canceled"); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't export region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.commit"), eee); - } - return result; - } - - /** - * Load region. - * <p/> - * RegionStorage, TopiaContext, FisheryRegion are put in uiContext data. - * <p/> - * tree ans - * - * @param ui TODO - * @param name name of region - * @return loaded region - */ - public FisheryRegion loadRegion(InputUI ui, String name) { - if (log.isDebugEnabled()) { - log.debug("loadRegion : " + name); - } - - FisheryRegion region = null; - try { - RegionStorage regionStorage = null; - TopiaContext isisContext = null; - if (name != null && !" ".equals(name)) { - regionStorage = RegionStorage.getRegion(name); - isisContext = regionStorage.getStorage().beginTransaction(); - region = RegionStorage.getFisheryRegion(isisContext); - ui.setContextValue(regionStorage); - ui.setContextValue(isisContext); - // FIXME session shoul be closed - // but make lazy init later - //isisContext.rollbackTransaction(); - //isisContext.closeContext(); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't load region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.load"), eee); - } - return region; - } - - /** - * Create new region, and select it in combo, and show input pane region in - * input area. - * - * @param name name of the new region - */ - public void newRegion(String name) { - if (log.isTraceEnabled()) { - log.trace("newRegion called"); - } - try { - if ("".equals(name)) { - // showMsgBox("error " + _("isisfish.error.region.name.empty")); - } - if (RegionStorage.getRegionNames().contains(name)) { - // showMsgBox("Error " + _("isisfish.error.region.already.exists")); - } - RegionStorage.create(name); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.create"), eee); - } - } - /* * Permet de creer simplement un nouvelle objet portant un nom par defaut. * Le nouvel element est automatiquement selectionné dans l'arbre @@ -628,7 +312,7 @@ return null; } - public Object openEditor(String category, String name, Class javaInterface, + public Object openEditor(InputOneEquationUI ui, String category, String name, Class javaInterface, String content, Editor editor) { if (log.isTraceEnabled()) { log.trace("openEditor"); @@ -636,6 +320,7 @@ try { EquationEditorPaneUI pane = new EquationEditorPaneUI(); pane.setEquation(category, name, javaInterface, content); + pane.setLocationRelativeTo(ui); pane.setVisible(true); if (pane.isOk() && editor != null) { editor.setText(pane.getEditor().getText()); @@ -1316,42 +1001,4 @@ ErrorHelper.showErrorDialog(_("isisfish.error.region.check"), eee); } } - - /** - * Explore region and exporte any enabled sensitivity factor name with value. - * - * @param parentComponent parent component - * @param fisheryRegion fishery region to export - */ - public void exportRegionSensitivityFactors(InputUI parentComponent, FisheryRegion fisheryRegion) { - - try { - File exportFile = FileUtil.getFile(_("isisfish.input.sensitivity.export.title"), - _("isisfish.common.ok"), parentComponent, ".*\\.xml", "XML Files"); - - // make sur that filename ends with ".xml" - if (!exportFile.getAbsolutePath().endsWith(".xml")) { - exportFile = new File(exportFile.getAbsolutePath() + ".xml"); - } - - if (exportFile != null) { - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.running"), true); - RegionExplorer explorer = new RegionExplorer(); - RegionExport exportXML = new RegionExportFactorXML(exportFile); - explorer.explore(fisheryRegion, exportXML); - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.complete")); - } - else { - if (log.isDebugEnabled()) { - log.debug("Export action canceled"); - } - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.cancel")); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error(_("isisfish.error.sensitivity.export"), eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.sensitivity.export"), eee); - } - } } Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,10 +22,10 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}' abstract="true"> +<JPanel layout='{new BorderLayout()}' genericType='B extends TopiaEntityContextable' abstract="true"> - <!-- UI state when editing. If no entity selected, actif = false --> - <Boolean id='actif' javaBean='false'/> + <!-- UI state when editing. If no entity selected, active = false --> + <Boolean id='active' javaBean='false'/> <!-- True only for sensitivity simulation --> <Boolean id='sensitivity' javaBean='false'/> @@ -63,19 +63,25 @@ import fr.ifremer.isisfish.ui.sensitivity.EditorHelper; import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabbedPaneListener; import fr.ifremer.isisfish.ui.WelcomePanelUI; -import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityContextable; +import org.nuiton.topia.TopiaContext; import org.apache.commons.lang.StringUtils; protected ChangeListener tabbedPaneChangeListener; /** + * Overriden with generic type + */ +public abstract void setBean(B entity); + +public abstract B getBean(); + +/** * This method is UI entry point. * * It's called : * - by input tree to first display UI * - by input verifier on cancel action - * - * 20090602 chatellier : make abstract, must be implemented ! */ public abstract void refresh(); @@ -91,12 +97,23 @@ public InputAction getAction() { return getContextValue(InputAction.class); } + at Deprecated public InputSaveVerifier getVerifier() { + return getInputSaveVerifier(); +} +public InputSaveVerifier getInputSaveVerifier() { return getContextValue(InputSaveVerifier.class); } + at Deprecated public FisheryRegion getRegion() { + return getFisheryRegion(); +} +public FisheryRegion getFisheryRegion() { return getContextValue(FisheryRegion.class); } +public TopiaContext getTopiaContext() { + return getContextValue(TopiaContext.class); +} public void setInfoText(String msg) { WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); if (root != null){ @@ -104,7 +121,8 @@ } } protected void goTo() { - getParentContainer(InputUI.class).setTreeSelection(getNextPath()); + // FIXME echatellier 20110306 use new tree api + //getParentContainer(InputUI.class).setTreeSelection(getNextPath()); } /** @@ -165,7 +183,7 @@ else { jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); ui.setBlock(true); - ui.setUseIcon(isActif()); + ui.setUseIcon(isActive()); SwingUtil.getLayer(boxed).setUI(ui); } } @@ -184,7 +202,7 @@ } JComponent source = (JComponent) e.getSource(); - Class<? extends TopiaEntity> classBean = (Class<? extends TopiaEntity>)source.getClientProperty("bean"); + Class<? extends TopiaEntityContextable> classBean = (Class<? extends TopiaEntityContextable>)source.getClientProperty("bean"); String beanID = (String)source.getClientProperty("beanID"); /*TopiaEntity bean = null; if (beanID == null) { @@ -207,7 +225,7 @@ /** * Display factor wizard for bean/property in registred in verifier. */ -public void displayFactorWizard(JComponent source, Class<? extends TopiaEntity> classBean, String beanID, String property) { +public void displayFactorWizard(JComponent source, Class<? extends TopiaEntityContextable> classBean, String beanID, String property) { if (log.isDebugEnabled()) { log.debug("Event intercepted " + source); @@ -216,7 +234,7 @@ log.debug(" client property (method) : " + property); } - TopiaEntity bean = null; + TopiaEntityContextable bean = null; if (beanID == null) { bean = getVerifier().getEntity(classBean); } @@ -286,7 +304,7 @@ } ]]></script> - <JPanel id='body' constraints='BorderLayout.CENTER'/> + <JPanel id='body' constraints='BorderLayout.CENTER' layout='{new BorderLayout()}' /> <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' visible='{getNextPath() != null}' onActionPerformed='goTo()' decorator='boxed'/> </JPanel> Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,654 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.event.ItemEvent; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXUtil; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityContextable; +import org.nuiton.util.FileUtil; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageException; +import fr.ifremer.isisfish.datastore.update.ImportFromV2; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.FisheryRegionImpl; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.Port; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.entities.Strategy; +import fr.ifremer.isisfish.entities.TripType; +import fr.ifremer.isisfish.entities.VesselType; +import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.mexico.export.RegionExplorer; +import fr.ifremer.isisfish.mexico.export.RegionExport; +import fr.ifremer.isisfish.mexico.export.RegionExportFactorXML; +import fr.ifremer.isisfish.ui.CommonHandler; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeRenderer; +import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; +import fr.ifremer.isisfish.vcs.VCSException; + +/** + * Main handler for fishery edition action. + * Next, each ui as his own handler. + * + * In context : + * <ul> + * <li>FisheryRegion + * <li>RegionStorage + * </ul> + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class InputHandler extends CommonHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(InputHandler.class); + + /** + * Cache pour n'instancier les ui qu'une seule fois + * et eviter que l'affichage saute pour l'utilsateur. + */ + protected Map<Class<?>, InputContentUI<?>> uiInstanceCache = new HashMap<Class<?>, InputContentUI<?>>(); + + /** + * Load region by region name, set it into jaxx context and refresh ui. + * + * Before loading region, try to close old one. + * + * @param inputUI input ui + * @param name region name to load + */ + protected void loadRegion(InputUI inputUI, String name) { + if (log.isDebugEnabled()) { + log.debug("Load region " + name); + } + + FisheryRegion fisheryRegion = null; + RegionStorage regionStorage = null; + TopiaContext topiaContext = null; + + // load region + try { + regionStorage = RegionStorage.getRegion(name); + topiaContext = regionStorage.getStorage().beginTransaction(); + fisheryRegion = RegionStorage.getFisheryRegion(topiaContext); + } catch (TopiaException ex) { + throw new IsisFishRuntimeException("Can't load region", ex); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't load region", ex); + } + + if (fisheryRegion == null) { + // show empty region ui + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(),"none"); + TreeModel model = new DefaultTreeModel(null); + inputUI.getFisheryRegionTree().setModel(model); + } + else { + // init tree model loader with fishery region + FisheryTreeHelper treeHelper = new FisheryTreeHelper(); + FisheryDataProvider dataProvider = new FisheryDataProvider(fisheryRegion); + treeHelper.setDataProvider(dataProvider); + TreeModel model = treeHelper.createTreeModel(fisheryRegion); + inputUI.getFisheryRegionTree().setModel(model); + inputUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider)); + treeHelper.setUI(inputUI.getFisheryRegionTree(), true, false, null); + //setContextValue(model); + //setTreeSelection("$root"); + + // global context value : fisheryRegion, regionStorage, treeHelper + inputUI.setContextValue(fisheryRegion); + inputUI.setContextValue(regionStorage); + inputUI.setContextValue(treeHelper); + inputUI.setContextValue(model); + inputUI.setContextValue(topiaContext); + + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(),"normale"); + } + } + + /** + * Main ui fishery region selection changed. + * + * @param inputUI inputUI + * @param e event + */ + public void regionChange(final InputUI inputUI, ItemEvent e) { + // event launched twice with itemchange listener + if (e.getStateChange() == ItemEvent.SELECTED) { + final String name = (String)inputUI.getFieldCurrentRegion().getSelectedItem(); + if (log.isDebugEnabled()) { + log.debug("New region selected " + name); + } + + // long operation, run status bar + setStatusMessage(inputUI, _("isisfish.message.loading.region", name), true); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + loadRegion(inputUI, name); + // FIXME getVerifier().setIsisContext(getContextValue(TopiaContext.class)); + setStatusMessage(inputUI, _("isisfish.message.load.finished")); + // FIXME setTreeModel(); + } + }); + } + } + + /** + * Create new region (called if region name is not empty). + */ + public void createNewRegion(InputUI inputUI) { + String name = inputUI.getFieldNewRegion().getText(); + setStatusMessage(inputUI, _("isisfish.message.creating.region", name), true); + + if (RegionStorage.getRegionNames().contains(name)) { + JOptionPane.showMessageDialog(inputUI, _("isisfish.error.region.already.exists")); + } + else { + try { + RegionStorage.create(name); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't create region", ex); + } + inputUI.getFieldNewRegion().setText(""); + // event is fired by setSelectedItem to call #regionChange + inputUI.getFieldCurrentRegion().setSelectedItem(name); + } + + setStatusMessage(inputUI, _("isisfish.message.creation.finished")); + } + + /** + * Exporter la region dans un zip. + * + * @return le nom du ficher selectionné par l'utilisateur + */ + public void importRegion(InputUI inputUI) { + setStatusMessage(inputUI, _("isisfish.message.import.zip"), true); + + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + if (file != null) { + RegionStorage.importZip(file); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Exporter la region dans un zip. + * + * @return le nom du ficher selectionné par l'utilisateur + */ + public void importRegionAndRename(InputUI inputUI) { + setStatusMessage(inputUI, _("isisfish.message.import.zip"), true); + + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + if (file != null) { + + String newName = JOptionPane + .showInputDialog(_("isisfish.message.name.imported.region")); + RegionStorage.importAndRenameZip(file, newName); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Importer la region depuis un fichier XML de la version 2. + */ + public void importV2Region(InputUI inputUI) { + + setStatusMessage(inputUI, _("isisfish.message.import.xml.v2.file"), true); + + try { + File file = FileUtil.getFile(".*.xml$", _("isisfish.message.import.region.xml")); + if (file != null) { + new ImportFromV2(true).importXML(file); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Extract from a simulation the region, and rename it with name given + * by user. + * + * @return le nom de la region entré par l'utilsateur + */ + public void importRegionFromSimulation(InputUI inputUI) { + + setStatusMessage(inputUI, _("isisfish.message.import"), true); + + // first step select a simulation and new region name + try { + //TODO Should use a shared model ? + List<String> simulationNames = SimulationStorage.getSimulationNames(); + String simulationName = SimulationFilterUtil.selectSimulation(simulationNames); + if (simulationName != null) { + + if (log.isInfoEnabled()) { + log.info("simulation used " + simulationName); + } + + // ask new region name + String regionName = JOptionPane.showInputDialog( + _("isisfish.message.import.region.name"), "region from " + + simulationName); + + if (StringUtils.isNotBlank(regionName)) { + if (RegionStorage.getRegionNames().contains(regionName)) { + JOptionPane.showMessageDialog(inputUI, _("isisfish.error.region.already.exists")); + } + else { + SimulationStorage.getSimulation(simulationName).extractRegion(regionName); + } + } + } + + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.no.select.simulation"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.export.done")); + } + + /** + * Exporter la region dans un zip + * + * Call only if region is loaded. + * + * @return file were region were exported + */ + public void exportRegion(InputUI inputUI) { + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + + if (file != null) { + // add .zip extension is not set + if (!file.getAbsolutePath().endsWith(".zip")) { + file = new File(file.getAbsolutePath() + ".zip"); + } + + int resp = JOptionPane.YES_OPTION; + if (file.exists()) { + resp = JOptionPane.showConfirmDialog(inputUI, + _("isisfish.message.file.overwrite")); + } + if (resp == JOptionPane.YES_OPTION) { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + regionStorage.createZip(file); + } + } + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't export region", eee); + } + } + + /** + * Remove region. + * + * @param inputUI input ui + * @param vcsDelete if true delete region in CVS too + */ + public void removeRegion(InputUI inputUI, boolean vcsDelete) { + try { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + int resp = JOptionPane.showConfirmDialog(inputUI, + _("isisfish.message.confirm.remove.region", regionStorage.getName())); + if (resp == JOptionPane.YES_OPTION) { + regionStorage.delete(vcsDelete); + } + } catch (StorageException eee) { + throw new IsisFishRuntimeException("Can't delete region", eee); + } + } + + /** + * Copy la region avec un autre nom. + * + * @param inputUI input ui + */ + public void copyRegion(InputUI inputUI) { + try { + String newName = JOptionPane + .showInputDialog(_("isisfish.message.new.region.name")); + + if (StringUtils.isNotEmpty(newName)) { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + File zip = regionStorage.createZip(); + RegionStorage.importAndRenameZip(zip, newName); + } + + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't copy region", eee); + } catch (StorageException eee) { + throw new IsisFishRuntimeException("Can't copy region", eee); + } + } + + /** + * Commit region. + * + * @param inputUI input ui + */ + public void commitRegionInCVS(InputUI inputUI) { + try { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + setStatusMessage(inputUI, _("isisfish.message.commiting.region", regionStorage.getName()), true); + String msg = regionStorage.getCommentForNextCommit(); + JTextArea text = new JTextArea(msg); + int resp = JOptionPane.showOptionDialog(null, + new JScrollPane(text), _("isisfish.commit.message"), + JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, + null, // icon + null, null); + if (resp == JOptionPane.OK_OPTION) { + regionStorage.commit(text.getText()); + regionStorage.clearCommentForNextCommit(); + setStatusMessage(inputUI, _("isisfish.message.region.commited")); + } else { + setStatusMessage(inputUI, _("isisfish.message.commit.region.canceled")); + } + } catch (VCSException eee) { + throw new IsisFishRuntimeException("Can't commit region", eee); + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't commit region", eee); + } + setStatusMessage(inputUI, _("isisfish.message.export.done")); + } + + /** + * Explore region and export any enabled sensitivity factor name with value. + * + * @param inputUI input ui + */ + public void exportRegionSensitivityFactors(InputUI inputUI) { + + try { + File exportFile = FileUtil.getFile(_("isisfish.input.sensitivity.export.title"), + _("isisfish.common.ok"), inputUI, ".*\\.xml", "XML Files"); + + if (exportFile != null) { + // make sur that filename ends with ".xml" + if (!exportFile.getAbsolutePath().endsWith(".xml")) { + exportFile = new File(exportFile.getAbsolutePath() + ".xml"); + } + + FisheryRegion fisheryRegion = inputUI.getContextValue(FisheryRegion.class); + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.running"), true); + RegionExplorer explorer = new RegionExplorer(); + RegionExport exportXML = new RegionExportFactorXML(exportFile); + explorer.explore(fisheryRegion, exportXML); + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.complete"), true); + } + else { + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.cancel"), true); + } + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't export sensitivity factors", eee); + } + } + + /** + * Changement de selection dans l'arbre de la pecherie. + * + * @param inputUI + * @param event + */ + public void nodeSelectionChanged(InputUI inputUI, TreeSelectionEvent event) { + + //TreePath oldTreePath = event.getOldLeadSelectionPath(); + TreePath newTreePath = event.getNewLeadSelectionPath(); + + //FisheryRegionTreeHelper treeHelper = inputUI.getContextValue(FisheryRegionTreeHelper.class); + if (newTreePath != null) { + Object lastTreePath = newTreePath.getLastPathComponent(); + if (lastTreePath instanceof FisheryTreeNode) { + FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath; + + Class<?> internalClass = isisTreeNode.getInternalClass(); + + // noeud qui n'en charge pas d'autres (= un bean) + TopiaEntityContextable topiaEntity = null; + String topiaId = isisTreeNode.getId(); + + try { + if (isisTreeNode.isStaticNode()) { + FisheryRegion fisheryRegion = inputUI.getContextValue(FisheryRegion.class); + TopiaContext topiaContext = fisheryRegion.getTopiaContext(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + } + + InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, inputUI); + + // mandatory set + inputContentUI.getVerifier().reset(); // before set bean !!! + if (topiaEntity != null) { + inputContentUI.getVerifier().addCurrentEntity(topiaEntity); + inputContentUI.getVerifier().setInputContentUI(inputContentUI); + } + + inputContentUI.setBean((TopiaEntityContextable)topiaEntity); + inputContentUI.setActive(topiaEntity != null); + inputContentUI.setActionButtons(); + + // add initialized ui to panel + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(), "normale"); + inputUI.getInputPane().removeAll(); + inputUI.getInputPane().add(inputContentUI, BorderLayout.CENTER); + inputUI.getInputPane().repaint(); + inputUI.getInputPane().validate(); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display bean " + topiaId, ex); + } + } + } + } + + /** + * Get ui that can display internalClass. + * + * @param internalClass internal class to get ui + * @param topiaEntity topia entity to set into ui + * @return ui for class + * @throws Exception + */ + protected InputContentUI<?> getUIInstanceForBeanClass(Class<?> internalClass, InputUI inputUI) throws Exception { + + Class<? extends InputContentUI<?>> uiClass = null; + if (FisheryRegion.class.isAssignableFrom(internalClass)) { + uiClass = FisheryRegionUI.class; + } + else if (Cell.class.isAssignableFrom(internalClass)) { + uiClass = CellUI.class; + } + else if (Gear.class.isAssignableFrom(internalClass)) { + uiClass = GearUI.class; + } + else if (Metier.class.isAssignableFrom(internalClass)) { + uiClass = MetierUI.class; + } + else if (Population.class.isAssignableFrom(internalClass)) { + uiClass = PopulationUI.class; + } + else if (Port.class.isAssignableFrom(internalClass)) { + uiClass = PortUI.class; + } + else if (SetOfVessels.class.isAssignableFrom(internalClass)) { + uiClass = SetOfVesselsUI.class; + } + else if (Species.class.isAssignableFrom(internalClass)) { + uiClass = SpeciesUI.class; + } + else if (Strategy.class.isAssignableFrom(internalClass)) { + uiClass = StrategyUI.class; + } + else if (TripType.class.isAssignableFrom(internalClass)) { + uiClass = TripTypeUI.class; + } + else if (VesselType.class.isAssignableFrom(internalClass)) { + uiClass = VesselTypeUI.class; + } + else if (Zone.class.isAssignableFrom(internalClass)) { + uiClass = ZoneUI.class; + } + + // use map to implement UI cache + InputContentUI<?> result = uiInstanceCache.get(uiClass); + if (result == null) { + Constructor<?> constructor = uiClass.getConstructor(JAXXContext.class); + result = (InputContentUI<?>)constructor.newInstance(inputUI); + + // fix parent container, doesn't work:( + result.setContextValue(inputUI, JAXXUtil.PARENT); + + uiInstanceCache.put(uiClass, result); + } + + return result; + } + + /** + * Change tree selection with new node id. + * + * Called by specific UI (CellUI to change node). + * + * @param inputUI context ui (to get context value tree helper...) + * @param topiaId node id to select + */ + public void setTreeSelection(InputContentUI<?> inputUI, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); + fisheryTreeHelper.selectNode(newSelectNode); + } + + /** + * Delete tree node referenced by parent, and auto select parent node. + * + * @param inputUI ui containing tree + * @param topiaId node id to delete + */ + public void deleteTreeNode(InputUI inputUI, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); + FisheryTreeNode parentNode = newSelectNode.getParent(); + fisheryTreeHelper.selectNode(parentNode); + fisheryTreeHelper.removeNode(newSelectNode); + } + + /** + * Insert new tree node and select it. + * + * @param inputUI ui containing tree + * @param nodeClass node type to create + * @param topiaId node id to insert + */ + public void insertTreeNode(InputUI inputUI, Class<?> nodeClass, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + + // on par du principe que pour ne pas compliquer les ui est les lier + // à l'arbre, on ajoute un nouveau noeud en fils de celui selectionné + // (ou son parent si la creation à lieu à partir d'un noeud bean) + FisheryTreeNode selectedNode = fisheryTreeHelper.getSelectedNode(); + if (selectedNode.isStaticNode()) { + selectedNode = selectedNode.getParent(); + } + + FisheryTreeNode newNode = new FisheryTreeNode(nodeClass, topiaId, null, null); + fisheryTreeHelper.insertNode(selectedNode, newNode); + fisheryTreeHelper.selectNode(newNode); + } + + /** + * Update tree node for topiaId. + * + * @param inputUI ui containing tree + * @param topiaId node id to update + */ + public void updateTreeNode(InputUI inputUI, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); + fisheryTreeHelper.refreshNode(newSelectNode, false); + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -1,75 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 2 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-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.input; - -import java.awt.Component; -import java.awt.Dimension; - -import javax.swing.JTree; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer; - -/** - * Extention du NavigationTreeCellRenderer qui regle le probleme - * des noeuds tronqués par des ... - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class InputNavigationTreeCellRenderer extends NavigationTreeCellRenderer { - - /** - * Constructor with context. - * - * @param context jaxx context - */ - public InputNavigationTreeCellRenderer(JAXXContext context) { - super(context); - } - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean sel, boolean expanded, boolean leaf, int row, - boolean hasFocus) { - - Component c = super.getTreeCellRendererComponent(tree, value, sel, - expanded, leaf, row, hasFocus); - - // bugfix from http://forums.sun.com/thread.jspa?forumID=256&threadID=277338 - // hack from : http://forums.sun.com/thread.jspa?threadID=542069&tstart=824 - - if (delegate.getPreferredSize().getWidth() < 300) { - delegate.setPreferredSize(new Dimension(300, (int) delegate - .getPreferredSize().getHeight())); - } - - return c; - } -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -1,262 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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 2 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-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.input; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; - -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; - -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder.ChildBuilder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntity; - -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.Zone; - -/** - * InputNavigationTreeSelectionAdapter. - * - * @author letellier - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ -public class InputNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout { - - /** Class logger. */ - private static final Log log = LogFactory.getLog(InputNavigationTreeSelectionAdapter.class); - - protected NavigationTreeNode currentNode = null; - protected InputContentUI currentUI = null; - - public InputNavigationTreeSelectionAdapter(InputUI context) { - super(InputUI.class, null, context, Strategy.PER_UI_TYPE); - - if (context.getNavigation() == null) { - throw new IllegalArgumentException("could not have a null 'navigation' in ui " + context); - } - - // register in tree this listener - context.getNavigation().addTreeSelectionListener(this); - } - - @Override - protected JPanel getContentContainer() { - return ((InputUI) context).getInputPane(); - } - - @Override - protected CardLayout2 getContentLayout() { - return ((InputUI) context).getCardlayout(); - } - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return (NavigationTreeModel) ((InputUI) context).getNavigation().getModel(); - } - - @Override - protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) { - if (e != null) { - if (log.isErrorEnabled()) { - log.error("Error happen, go back to previous node" ,e); - } - } - // go back to previous node - returnToPreviousNode(getNavigationTree(), event); - if (log.isInfoEnabled()) { - log.info("goBackToPreviousNode"); - } - } - - - protected JAXXTree getNavigationTree() { - return ((InputUI) context).getNavigation(); - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - super.openUI(newUI, node); - // apply refresh method (should a contract for all this ui with a method refresh...) - try { - currentUI = (InputContentUI) newUI; - currentUI.setSensitivity(false); - InputSaveVerifier verifier = context.getContextValue(InputSaveVerifier.class); - verifier.removeAllPanels(); - verifier.addCurrentPanel(currentUI); - currentUI.refresh(); - // tabbed ui hack - currentUI.setActionButtons(); - currentNode = node; - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't open ui", e); - } - } - } - - @Override - protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception { - boolean exit = true; - // by default, we says that component was succesfull closed - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - int responce = verif.checkEdit(); - //boolean exit = checkEdit(event, component); - if (responce == JOptionPane.OK_OPTION) { - JTree tree = (JTree) event.getSource(); - NavigationTreeModel model = (NavigationTreeModel) tree.getModel(); - if (currentNode != null) { - model.nodeChanged(currentNode); - } - } - else if (responce == JOptionPane.CANCEL_OPTION) { - exit = false; - } - if (exit) { - verif.reset(); - } - return exit; - } - - @Override - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - verif.setRootPanel((InputUI)context); - verif.removeAllEntity(); - if (TopiaEntity.class.isInstance(data)){ - verif.addCurrentEntity((TopiaEntity) data); - } - verif.setCurrentNode(node); - } - - public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - if (regionName == null) { - return null; - } - - ChildBuilder<TopiaEntity> childBuilder = new ChildBuilder<TopiaEntity>(builder) { - - Decorator<? extends TopiaEntity> decorator; - - @Override - public void init(Class<? extends TopiaEntity> klass) { - decorator = jaxx.runtime.PropertyDecorator.newDecorator(klass, "name"); - } - - @Override - public Decorator<? extends TopiaEntity> getDecorator(TopiaEntity child) { - return decorator; - } - - @Override - public String getJXPath(TopiaEntity child) { - return "..[@topiaId=\"" + child.getTopiaId() + "\"]"; - } - - @Override - public String getNavigationPath(TopiaEntity child) { - return child.getTopiaId(); - } - }; - - try { - - NavigationTreeNode root = builder.build(null, regionName, JAXXContextEntryDef.newDef(FisheryRegion.class), "$root", FisheryRegionUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.cells"), "../cell", "$cells", CellUI.class, null), - true, Cell.class, fisheryRegion.getCell(), CellUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.zones"), "../zone", "$zones", ZoneUI.class, null), - true, Zone.class, fisheryRegion.getZone(), ZoneUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.ports"), "../port", "$ports", PortUI.class, null), - true, Port.class, fisheryRegion.getPort(), PortUI.class, null); - - NavigationTreeNode species = builder.build(root, _("isisfish.input.tree.species"), "../species", "$species", SpeciesUI.class, null); - - for (Species specie : fisheryRegion.getSpecies()) { - NavigationTreeNode speciesChild = builder.build(species,jaxx.runtime.PropertyDecorator.newDecorator(Species.class, "name"), "..[@topiaId=\"" + specie.getTopiaId() + "\"]", specie.getTopiaId(), SpeciesUI.class, null); - NavigationTreeNode populations = builder.build(speciesChild, _("isisfish.input.tree.populations"), "../population", "$populations", PopulationUI.class, null); - childBuilder.build(populations, true, Population.class, specie.getPopulation(), PopulationUI.class, null); - } - - childBuilder.build(builder.build(root, _("isisfish.input.tree.gears"), "../gear", "$gears", GearUI.class, null), - true, Gear.class, fisheryRegion.getGear(), GearUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.metiers"), "../metier", "$metiers", MetierUI.class, null), - true, Metier.class, fisheryRegion.getMetier(), MetierUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.triptypes"), "../tripType", "$tripTypes", TripTypeUI.class, null), - true, TripType.class, fisheryRegion.getTripType(), TripTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.vesseltypes"), "../vesselType", "$vesselTypes", VesselTypeUI.class, null), - true, VesselType.class, fisheryRegion.getVesselType(), VesselTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.setofvessels"), "../setOfVessels", "$setOfVessels", SetOfVesselsUI.class, null), - true, SetOfVessels.class, fisheryRegion.getSetOfVessels(), SetOfVesselsUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.strategies"), "../strategy", "$strategies", StrategyUI.class, null), - true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null); - - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error(ex.getMessage(), ex); - } - } - return builder.getModel(); - } -} Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,12 +22,12 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='org.nuiton.topia.persistence.TopiaEntityContextable'> <!-- Equation name (just for display purpose, not mandatory) --> <String id='text' javaBean='null'/> <!-- Bean containing equation --> - <org.nuiton.topia.persistence.TopiaEntity id='bean' javaBean='null'/> + <org.nuiton.topia.persistence.TopiaEntityContextable id='bean' javaBean='null'/> <!-- Bean property used to access equation --> <String id='beanProperty' javaBean='null'/> <!-- Used to get documentation in opened editor (not mandatory) --> @@ -49,49 +49,49 @@ import org.apache.commons.lang.StringUtils; import org.nuiton.topia.TopiaContext; import javax.swing.event.DocumentListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; protected DocumentListener listener = null; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - formuleComboBox.setModel(new DefaultComboBoxModel()); - try { - editor.open(org.nuiton.util.FileUtil.getTempFile("", ".java")); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Error on property change", e); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + formuleComboBox.setModel(new DefaultComboBoxModel()); + try { + File nullFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); + editor.open(nullFile); + editor.setEnabled(false); // editor is replaced at each launch + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Error on property change", e); + } } } + if (evt.getNewValue() != null) { + // chatellier 20090526 : force refresh in bean change ? + refresh(); + } } - if (evt.getNewValue() != null) { - // chatellier 20090526 : force refresh in bean change ? - refresh(); - } - } -}); -start(); -protected void start() { - if (listener == null) { + }); + + if (listener == null) { listener = new DocumentListener() { - @Override public void insertUpdate(DocumentEvent e) { setEquation(); } - @Override public void removeUpdate(DocumentEvent e) { setEquation(); } - @Override public void changedUpdate(DocumentEvent e) { } }; } setComboModel(); - editor.getCurrentEditor().addDocumentListener(listener); } /** @@ -155,6 +155,7 @@ try { File equationContentFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); editor.open(equationContentFile); + editor.setEnabled(isActive()); } catch (IOException ex) { if (log.isErrorEnabled()) { log.error("Can't refresh editor", ex); @@ -177,7 +178,7 @@ protected void setComboModel() { if (getBean() != null){ - TopiaContext isisContext = getBean().getTopiaContext(); + TopiaContext isisContext = ((org.nuiton.topia.persistence.TopiaEntityAbstract)getBean()).getTopiaContext(); java.util.List<Formule> formules = null; if (formuleCategory != null) { formules = getAction().getFormules(isisContext, formuleCategory); @@ -200,10 +201,10 @@ protected void openEditor() { Formule e = (Formule)formuleComboBox.getSelectedItem(); if (e != null) { - getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor); + getContextValue(InputAction.class).openEditor(this, e.getCategory(), e.getName(), clazz, e.getContent(), editor); } else { - getContextValue(InputAction.class).openEditor(formuleCategory, "new", clazz, editor.getText(), editor); + getContextValue(InputAction.class).openEditor(this, formuleCategory, "new", clazz, editor.getText(), editor); } } protected void setEditorText() { @@ -212,7 +213,8 @@ } else { try { - editor.open(org.nuiton.util.FileUtil.getTempFile("", ".java")); + File nullFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); + editor.open(nullFile); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Open editor", e); @@ -231,39 +233,41 @@ } ]]> </script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text='{getText()}' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="formuleComboBox" onActionPerformed='formuleChanged()' enabled='{isActif()}' - renderer="{new fr.ifremer.isisfish.ui.input.formule.FormuleComboRenderer()}" /> - </cell> - </row> - <row> - <cell fill='both' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal'> - <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif() && formuleCategory != null}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif() && clazz != null && formuleCategory != null}'/> - </cell> - </row> - <row> - <cell fill='horizontal' weighty='1.0'> - <JPanel/> - </cell> - </row> - </Table> - </cell> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text='{getText()}' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="formuleComboBox" onActionPerformed='formuleChanged()' enabled='{isActive()}' + renderer="{new fr.ifremer.isisfish.ui.input.formule.FormuleComboRenderer()}" /> + </cell> + </row> + <row> + <cell fill='both' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal'> + <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActive() && formuleCategory != null}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActive() && clazz != null && formuleCategory != null}'/> + </cell> + </row> + <row> + <cell fill='horizontal' weighty='1.0'> + <JPanel/> + </cell> + </row> + </Table> + </cell> + <cell fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -39,8 +39,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import javax.swing.JButton; import javax.swing.JLabel; @@ -48,7 +48,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; +import jaxx.runtime.JAXXUtil; import org.apache.commons.beanutils.MethodUtils; import org.apache.commons.lang.ClassUtils; @@ -58,9 +58,14 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityAbstract; +import org.nuiton.topia.persistence.TopiaEntityContextable; import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.ui.NavigationUI; import fr.ifremer.isisfish.ui.SaveVerifier; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; import fr.ifremer.isisfish.ui.util.ErrorHelper; @@ -87,6 +92,7 @@ /** Cancel button. */ protected JButton currentCancelButton = null; + /** Save listener. */ protected ActionListener saveListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -94,6 +100,7 @@ } }; + /** Cancel listener. */ protected ActionListener cancelListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -101,6 +108,7 @@ } }; + /** New listener. */ protected ActionListener newListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -108,6 +116,7 @@ } }; + /** Delete listener. */ protected ActionListener deleteListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -116,25 +125,47 @@ }; /** Entity type for new creation. */ - protected String type = null; + protected Class<?> type; - protected boolean editable = false; + /** Current entity modification state (modifier by PCL). */ protected boolean changed = false; - protected NavigationTreeNode currentNode = null; - protected String currentOnglet = null; + /** Editable is true when entity can be modified (in sensitity, cannot). */ + protected boolean editable = false; - protected TopiaContext isisContext = null; - - /** - * Map entity key to {@link TopiaEntity}. - */ - protected HashMap<String, TopiaEntity> currentEntities = new HashMap<String, TopiaEntity>(); - protected HashSet<InputContentUI> currentPanels = new HashSet<InputContentUI>(); + protected InputContentUI<?> inputContentUI; - protected InputUI rootUI; - protected SensitivityTabUI sensUI; + //protected FisheryTreeNode currentNode = null; + //protected String currentOnglet = null; + //protected TopiaContext isisContext = null; + + /** Map entity key to {@link TopiaEntity}. */ + protected HashMap<String, TopiaEntityContextable> currentEntities = new HashMap<String, TopiaEntityContextable>(); + /** Les panels a rafraichir. */ + protected HashSet<InputContentUI<?>> currentPanels = new HashSet<InputContentUI<?>>(); + + //protected InputUI rootUI; + //protected SensitivityTabUI sensUI; + + public InputContentUI<?> getInputContentUI() { + return inputContentUI; + } + + public void setInputContentUI(InputContentUI<?> inputContentUI) { + this.inputContentUI = inputContentUI; + } + + /** + * Tell verifier to check for unsaved modification. + * + * Then return user choice ({@link javax.swing.JOptionPane} type). + * + * @return user JOptionPane response + * @see javax.swing.JOptionPane#YES_OPTION + * @see javax.swing.JOptionPane#NO_OPTION + * @see javax.swing.JOptionPane#CANCEL_OPTION + */ @Override public int checkEdit() { int response = JOptionPane.NO_OPTION; @@ -142,7 +173,9 @@ if (changed) { // ask user to close edition // still in edit mode, must warn user - response = askUser(_("isisfish.message.page.modified")); + response = JOptionPane.showConfirmDialog(null, _("isisfish.message.page.modified"), + _("isisfish.input.menu.commit"), JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.NO_OPTION) { topiaCancel(); } else if (response == JOptionPane.YES_OPTION) { @@ -153,19 +186,7 @@ return response; } - /** - * Ask user option to save non saved datas. - * - * @param message message to display - * @return user option - */ - protected int askUser(String message) { - int response = JOptionPane.showConfirmDialog(rootUI, message, - _("isisfish.input.menu.commit"), - JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); - return response; - } - + /** Called by entity property change listener on data change. */ protected void topiaChanged() { changed = true; setPanelsActifs(); @@ -175,6 +196,10 @@ setEnabled(currentDeleteButton, false); } + /** + * Called by this class when entity modification state has been reset. + * (cancel, save...) + */ protected void noModif() { changed = false; setPanelsActifs(); @@ -204,18 +229,13 @@ * package >.*" */ protected void topiaRemove() { - if (log.isTraceEnabled()) { - log.trace("remove called"); - } String msg = ""; try { boolean doDelete; - TopiaEntity topiaEntity = (TopiaEntity) currentNode - .getJAXXContextValue(rootUI); + TopiaEntityContextable topiaEntity = inputContentUI.getBean(); List<TopiaEntity> allWillBeRemoved = topiaEntity.getComposite(); if (allWillBeRemoved.size() > 0) { - String label = _("isisfish.message.delete.object", topiaEntity - .toString()); + String label = _("isisfish.message.delete.object", topiaEntity.toString()); String text = ""; for (TopiaEntity e : allWillBeRemoved) { text += ClassUtils.getShortClassName(e.getClass()) + " - " @@ -226,8 +246,7 @@ JOptionPane.YES_NO_OPTION); doDelete = resp == JOptionPane.YES_OPTION; } else { - String text = _("isisfish.message.confirm.delete.object", - topiaEntity.toString()); + String text = _("isisfish.message.confirm.delete.object", topiaEntity.toString()); int resp = JOptionPane.showConfirmDialog(null, text, _("isisfish.message.delete.entity"), JOptionPane.YES_NO_OPTION); @@ -236,50 +255,24 @@ if (doDelete) { topiaEntity.delete(); - isisContext.commitTransaction(); + topiaEntity.getTopiaContext().commitTransaction(); + + noModif(); + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().deleteTreeNode(inputUI, topiaEntity.getTopiaId()); + msg = _("isisfish.message.remove.finished"); } else { msg = _("isisfish.message.remove.canceled"); } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't remove entity: " - + currentEntities.get(0), eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.removeentity"), eee); + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't remove entity: " + currentEntities.get(0), eee); } - rootUI.setStatusMessage(msg); - // set noModif BEFORE path changed - noModif(); - String path = currentNode.getParent().getContextPath(); - rootUI.setTreeModel(); - rootUI.setTreeSelection(path); } /** - * Display a JOptionPane with a JTextArea as main component. - * - * @param parent parent - * @param labelMessage label message - * @param textMessage text message into area - * @param title - * @param option - * @return user response + * Create new {@link type} entity. */ - protected int showTextAreaConfirmationMessage(Component parent, - String labelMessage, String textMessage, String title, int option) { - JLabel labelForMessage = new JLabel(labelMessage); - JTextArea areaForMessage = new JTextArea(textMessage); - areaForMessage.setEditable(false); - areaForMessage.setAutoscrolls(true); - JScrollPane spMessage = new JScrollPane(areaForMessage); - spMessage.setPreferredSize(new Dimension(500, 100)); // don't remove popup is huge - - int response = JOptionPane.showConfirmDialog(parent, new Object[] { - labelForMessage, spMessage }, title, option); - return response; - } - protected void topiaCreate() { if (log.isDebugEnabled()) { @@ -287,34 +280,26 @@ } try { - String name = type + "_new"; + String typeSimpleName = type.getSimpleName(); + String name = typeSimpleName + "_new"; - Method method = MethodUtils.getAccessibleMethod( - IsisFishDAOHelper.class, "get" + type + "DAO", - TopiaContext.class); - TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke( - null, isisContext); + // use introspection to call IsisFishDAOHelper.getXXXDAO() + TopiaContext topiaContext = inputContentUI.getTopiaContext(); + Method method = MethodUtils.getAccessibleMethod(IsisFishDAOHelper.class, + "get" + typeSimpleName + "DAO", TopiaContext.class); + TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke(null, topiaContext); - TopiaEntity entity = dao.create("name", name); - entity.update(); - isisContext.commitTransaction(); + // create new entity + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)dao.create("name", name); + // entity.update(); FIXME mandatory ??? + topiaContext.commitTransaction(); - String path = currentNode.getParent().getContextPath() + "/" - + entity.getTopiaId(); - if (!editable) { - path = currentNode.getContextPath() + "/" + entity.getTopiaId(); - } + InputUI inputUI = inputContentUI.getContextValue(InputUI.class, JAXXUtil.PARENT); + inputUI.getHandler().insertTreeNode(inputUI, type, topiaEntity.getTopiaId()); - rootUI.setTreeModel(); - rootUI.setTreeSelection(path); - - rootUI.setStatusMessage(_("isisfish.message.creation.finished")); - + //rootUI.setStatusMessage(_("isisfish.message.creation.finished")); } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create entity", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.createentity"), eee); + throw new IsisFishRuntimeException(_("isisfish.error.input.createentity"), eee); } } @@ -325,32 +310,32 @@ * Commit opened topia context. */ protected void topiaSave() { + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); + TopiaContext topiaContext = inputContentUI.getTopiaContext(); try { - noModif(); - for (TopiaEntity t : currentEntities.values()) { - t.update(); + for (TopiaEntityContextable entity : currentEntities.values()) { + entity.update(); if (log.isDebugEnabled()) { - log.debug("updating : " + t); + log.debug("Updating verifier entity : " + entity); } } - isisContext.commitTransaction(); - rootUI.repaintNode(currentNode.getContextPath()); - rootUI.setStatusMessage(_("isisfish.message.save.finished")); - } catch (TopiaException eee) { + topiaContext.commitTransaction(); + + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().updateTreeNode(inputUI, topiaEntity.getTopiaId()); + + noModif(); + //rootUI.setStatusMessage(_("isisfish.message.save.finished")); + } catch (TopiaException eee) { // EC-20100401 : ajouté pour avoir un context // correct apres un erreur, sinon, on ne peut plus rien faire // rien sauver d'autre... try { - isisContext.rollbackTransaction(); - if (log.isErrorEnabled()) { - log.error("Can't save entity", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.saveentity"), eee); + topiaContext.rollbackTransaction(); + throw new IsisFishRuntimeException(_("isisfish.error.input.saveentity"), eee); } catch (TopiaException eee2) { - if (log.isErrorEnabled()) { - log.error("Can't save or rollback entity", eee2); - } + throw new IsisFishRuntimeException(_("isisfish.error.input.saveentity"), eee2); } } } @@ -359,14 +344,16 @@ * Cancel all modification on entity (rollback), and force reload it. */ protected void topiaCancel() { + TopiaContext topiaContext = inputContentUI.getTopiaContext(); + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); try { + topiaContext.rollbackTransaction(); noModif(); - isisContext.rollbackTransaction(); - Map<String, TopiaEntity> canceledEntity = (Map<String, TopiaEntity>)currentEntities.clone(); - + Map<String, TopiaEntityContextable> canceledEntity = (Map<String, TopiaEntityContextable>)currentEntities.clone(); + currentEntities.clear(); - for (Entry<String, TopiaEntity> currentEntity : canceledEntity.entrySet()) { - TopiaEntity t = isisContext.findByTopiaId(currentEntity.getValue().getTopiaId()); + for (Entry<String, TopiaEntityContextable> currentEntity : canceledEntity.entrySet()) { + TopiaEntityContextable t = (TopiaEntityContextable)topiaContext.findByTopiaId(currentEntity.getValue().getTopiaId()); // TODO a quoi ca sert de recharger les entités ? // desynchronise la précédente @@ -375,28 +362,53 @@ //((TopiaContextImpl)isisContext).getHibernate().evict(t2); //t.setTopiaId(null); - rootUI.repaintNode(currentNode.getContextPath()); - rootUI.setTreeSelection(currentNode.getContextPath()); - String key = currentEntity.getKey(); addCurrentEntity(t, key); } - // refresh all registred panel + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().updateTreeNode(inputUI, topiaEntity.getTopiaId()); + + // refresh all registered panel // to discard modification in UI - refreshAll(); - rootUI.setStatusMessage(_("isisfish.message.cancel.finished")); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't cancel modification in region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.cancelentity"), eee); + //refreshAll(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaEntity.getTopiaId()); + InputContentUI inputContentUI2 = inputContentUI; + inputContentUI2.setBean(null); + inputContentUI2.setBean(topiaEntity); + //rootUI.setStatusMessage(_("isisfish.message.cancel.finished")); + } catch (TopiaException eee) { + throw new IsisFishRuntimeException(_("isisfish.error.input.cancelentity"), eee); } } + /** + * Display a JOptionPane with a JTextArea as main component. + * + * @param parent parent + * @param labelMessage label message + * @param textMessage text message into area + * @param title + * @param option + * @return user response + */ + protected int showTextAreaConfirmationMessage(Component parent, + String labelMessage, String textMessage, String title, int option) { + JLabel labelForMessage = new JLabel(labelMessage); + JTextArea areaForMessage = new JTextArea(textMessage); + areaForMessage.setEditable(false); + areaForMessage.setAutoscrolls(true); + JScrollPane spMessage = new JScrollPane(areaForMessage); + spMessage.setPreferredSize(new Dimension(500, 100)); // don't remove popup is huge + + int response = JOptionPane.showConfirmDialog(parent, new Object[] { + labelForMessage, spMessage }, title, option); + return response; + } + protected void setPanelsActifs() { for (InputContentUI panel : currentPanels) { - panel.setActif(editable); + panel.setActive(editable); } } @@ -416,7 +428,7 @@ } panel.refresh(); // do not call refresh action buttons here - panel.setActif(editable); + panel.setActive(editable); } } @@ -431,12 +443,11 @@ * Remove all entity with key * * @param currentEntity entity to check - * @param key specific key (defaut to topiaId) + * @param key specific key (defauft to topiaId) */ - public void addCurrentEntity(TopiaEntity currentEntity, String key) { + public void addCurrentEntity(TopiaEntityContextable currentEntity, String key) { if (currentEntity != null) { editable = true; - isisContext = currentEntity.getTopiaContext(); currentEntity .addPropertyChangeListener(new PropertyChangeListener() { @Override @@ -474,7 +485,7 @@ * * @param currentEntity entity to check */ - public void addCurrentEntity(TopiaEntity currentEntity) { + public void addCurrentEntity(TopiaEntityContextable currentEntity) { if (currentEntity != null) { addCurrentEntity(currentEntity, currentEntity.getTopiaId()); } @@ -487,8 +498,8 @@ this.currentDeleteButton = null; this.currentNewButton = null; this.currentSaveButton = null; - this.currentOnglet = null; - this.currentNode = null; + //this.currentOnglet = null; + //this.currentNode = null; } public void removeAllEntity() { @@ -498,17 +509,17 @@ setPanelsActifs(); } - public void addCurrentPanel(InputContentUI... panels) { - for (InputContentUI ui : panels) { + public void addCurrentPanel(InputContentUI<?>... panels) { + for (InputContentUI<?> ui : panels) { editable = !currentEntities.isEmpty(); this.currentPanels.add(ui); - if (rootUI == null) { + /*if (rootUI == null) { ui.setSensitivity(true); ui.setLayer(true); - } + }*/ ui.refresh(); // do not call refresh action buttons here - ui.setActif(editable); + ui.setActive(editable); } } @@ -524,7 +535,7 @@ setSaveButton(saveButton, true); } - public void setSaveButton(JButton saveButton, Boolean listener) { + public void setSaveButton(JButton saveButton, boolean listener) { if (listener) { // TODO what is it for (remove/readd) ? saveButton.removeActionListener(saveListener); @@ -535,11 +546,11 @@ this.currentSaveButton = saveButton; } - public void setNewButton(JButton saveButton, String name) { - setNewButton(saveButton, name, true); + public void setNewButton(JButton saveButton, Class<? extends TopiaEntityContextable> type) { + setNewButton(saveButton, type, true); } - public void setNewButton(JButton newButton, String t, Boolean listener) { + public void setNewButton(JButton newButton, Class<? extends TopiaEntityContextable> type, boolean listener) { if (listener) { // TODO what is it for (remove/readd) ? newButton.removeActionListener(newListener); @@ -547,7 +558,7 @@ } newButton.setText(_("isisfish.common.new")); newButton.setEnabled(!changed); - this.type = t; + this.type = type; this.currentNewButton = newButton; } @@ -573,19 +584,15 @@ this.currentDeleteButton = deleteButton; } - public TopiaContext getIsisContext() { - return isisContext; - } - - public Collection<TopiaEntity> getCurrentEntities() { + public Collection<TopiaEntityContextable> getCurrentEntities() { return currentEntities.values(); } - public <E extends TopiaEntity> E getEntity(Class<E> clazz, String key) { + public <E extends TopiaEntityContextable> E getEntity(Class<E> clazz, String key) { return (E) currentEntities.get(key); } - public <E extends TopiaEntity> E getEntity(Class<E> clazz) { + public <E extends TopiaEntityContextable> E getEntity(Class<E> clazz) { for (TopiaEntity te : currentEntities.values()) { if (clazz.isInstance(te)) { return (E) te; @@ -594,39 +601,23 @@ return null; } - public String getCurrentOnglet() { + /*public String getCurrentOnglet() { return currentOnglet; - } + }*/ - public NavigationTreeNode getCurrentNode() { - return currentNode; - } - - public void setIsisContext(TopiaContext isisContext) { - this.isisContext = isisContext; - } - public void setEditable(boolean editable) { this.editable = editable; } - public void setCurrentOnglet(String currentOnglet) { + /*public void setCurrentOnglet(String currentOnglet) { this.currentOnglet = currentOnglet; - } + }*/ - public void setCurrentNode(NavigationTreeNode currentNode) { - this.currentNode = currentNode; - } - - protected void setRootPanel(InputUI inputUI) { - this.rootUI = inputUI; - } - public SensitivityTabUI getSensPanel() { - return sensUI; + return null; //sensUI; } public void setSensPanel(SensitivityTabUI sensUI) { - this.sensUI = sensUI; + //this.sensUI = sensUI; } } Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -32,11 +32,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.persistence.TopiaEntityContextable; /** * Listener used to control InputUI tab panel switching. - * - * Ask for * * @author letellier * @version $Revision: 1312 $ @@ -54,28 +53,31 @@ @Override public void stateChanged(ChangeEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); + + // to not fire additional event during tab index management pane.removeChangeListener(this); + + // reselect previous tab (and ask user to change) int selectedIndex = pane.getSelectedIndex(); if (cacheSelectedIndex != -1) { pane.setSelectedIndex(cacheSelectedIndex); } InputContentUI ui = (InputContentUI) pane.getSelectedComponent(); - if (closeUI(ui)) { + if (canChangeTab(ui)) { pane.setSelectedIndex(selectedIndex); } ui = (InputContentUI) pane.getSelectedComponent(); - if (log.isDebugEnabled()) { - log.debug("Final refresh " + ui); - } - + // refresh can be broken // especially during new region creation // don't break refresh cycle try { - ui.refresh(); + TopiaEntityContextable entity = ui.getBean(); + ui.setBean(null); + ui.setBean(entity); } catch (Exception eee) { - if(log.isErrorEnabled()) { + if (log.isErrorEnabled()) { log.error("Error during UI refresh", eee); } } @@ -102,15 +104,14 @@ * @param currentUI current displayed UI * @return true to change tab */ - protected boolean closeUI(InputContentUI currentUI) { + protected boolean canChangeTab(InputContentUI<?> currentUI) { // by default, we says that component was successfully closed boolean exit = true; - InputSaveVerifier verif = currentUI - .getContextValue(InputSaveVerifier.class); - int responce = verif.checkEdit(); + InputSaveVerifier verif = currentUI.getContextValue(InputSaveVerifier.class); + int response = verif.checkEdit(); - if (responce == JOptionPane.CANCEL_OPTION) { + if (response == JOptionPane.CANCEL_OPTION) { exit = false; } return exit; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,224 +22,31 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<fr.ifremer.isisfish.ui.NavigationUI> - <javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <InputHandler id="handler" /> - <InputNavigationTreeCellRenderer id='navigationTreeCellRenderer' constructorParams='this'/> + <Boolean id="regionLoaded" javaBean="false" /> - <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> - - <java.awt.CardLayout id='cardlayoutPrincipal'/> - - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='region' javaBean='null'/> - - <script><![CDATA[ -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.StorageChangeEvent; -import fr.ifremer.isisfish.datastore.StorageChangeListener; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; -import fr.ifremer.isisfish.ui.WelcomeSaveVerifier; -import fr.ifremer.isisfish.ui.WelcomePanelUI; -import fr.ifremer.isisfish.ui.models.common.StringListModel; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import org.nuiton.topia.TopiaContext; - -getContextValue(WelcomeSaveVerifier.class).addSaveVerifier(getVerifier()); - -new fr.ifremer.isisfish.ui.input.InputNavigationTreeSelectionAdapter(this); - -StorageChangeListener regionStorageListener; -regionStorageListener = new StorageChangeListener() { - @Override - public void versionDataChanged(StorageChangeEvent e) { - setFieldCurrentRegionModel(); - } -}; -RegionStorage.addStorageChangeListener(regionStorageListener); - -protected InputAction getAction() { - return getContextValue(InputAction.class); -} -protected InputSaveVerifier getVerifier() { - return getContextValue(InputSaveVerifier.class); -} -protected RegionStorage getRegionStorage() { - return getContextValue(RegionStorage.class); -} -protected void setFieldCurrentRegionModel() { - StringListModel model = new StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames()); - fieldCurrentRegion.setModel(model); -} -protected void regionChange(ItemEvent e) { - // event launched twice with itemchange listener - if (e.getStateChange() == ItemEvent.SELECTED) { - final String name = fieldCurrentRegion.getSelectedItem().toString(); - if (log.isDebugEnabled()) { - log.debug("Region change, selected : " + name); - } - - // long operation, run status bar - setStatusMessage(_("isisfish.message.loading.region", name), true); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - loadRegion(name); - getVerifier().setIsisContext(getContextValue(TopiaContext.class)); - setStatusMessage(_("isisfish.message.load.finished")); - setTreeModel(); - } - }); - } -} -protected void loadRegion(String name) { - if (log.isDebugEnabled()) { - log.debug("Loadregion : " + name); - } - setRegion((FisheryRegionImpl)getAction().loadRegion(this, name)); - if (getRegion() == null) { - regionNull(); - } - else { - setTreeModel(); - getCardlayoutPrincipal().show(inputPanePrincipal,"normale"); - } -} -protected void setTreeModel() { - if (getRegion() != null) { - String regionName = getRegion().getName(); - setContextValue(getRegion()); - NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion()); - - setContextValue(model); - navigation.setModel(model); - setTreeSelection("$root"); - - /*TC-20090702 Fix bug #1772 - EC-20090706 no working solution found - model.nodeChanged(model.getRoot()); - java.util.Enumeration<?> e = model.getRoot().children(); - while (e.hasMoreElements()) { - NavigationTreeNode n = (NavigationTreeNode) e.nextElement(); - String contextPath = n.getContextPath(); - if (contextPath.equals("$root/$cells")) { - //TC-20090702 : ce noeud est trop long a recharger - continue; - } - log.debug("reload node " + contextPath); - model.nodeChanged(n); - java.util.Enumeration<?> e2 = n.children(); - while (e2.hasMoreElements()) { - NavigationTreeNode n2 = (NavigationTreeNode) e2.nextElement(); - n2.getJAXXContextValue(InputUI.this); - } - }*/ - } -} - -public void repaintNode(String path) { - NavigationTreeModel model = getContextValue(NavigationTreeModel.class); - NavigationTreeNode currentNode = model.findNode(path); - model.nodeChanged(currentNode); -} -public void setTreeSelection(String path) { - NavigationTreeNode node = NavigationUtil.findNode(this, null, path); - TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node)); - navigation.setSelectionPath(pathToRoot); - navigation.scrollPathToVisible(pathToRoot); -} -protected void setStatusMessage(String s) { - WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); - root.setStatusMessage(s); -} -protected void setStatusMessage(String s, boolean running) { - WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); - root.setStatusMessage(s, running); -} -protected void newRegion() { - String name = fieldNewRegion.getText(); - setStatusMessage(_("isisfish.message.creating.region", name), true); - getContextValue(InputAction.class).newRegion(name); - fieldCurrentRegion.setSelectedItem(name); - JButtonNewRegion.setEnabled(false); - fieldNewRegion.setText(""); - setStatusMessage(_("isisfish.message.creation.finished")); -} -protected void regionNull() { - getCardlayoutPrincipal().show(inputPanePrincipal,"none"); - DefaultTreeModel model = new DefaultTreeModel(null); - navigation.setModel(model); -} -protected void newChanged() { - JButtonNewRegion.setEnabled(true); -} -protected void importRegion() { - setStatusMessage(_("isisfish.message.import.zip"), true); - getContextValue(InputAction.class).importRegion(); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importRegionAndRename() { - setStatusMessage(_("isisfish.message.import.zip"), true); - getContextValue(InputAction.class).importRegionAndRename(); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importV2Region() { - setStatusMessage(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region(), true); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importRegionFromSimulation() { - setStatusMessage(_("isisfish.message.import", getContextValue(InputAction.class).importRegionFromSimulation()), true); - setStatusMessage(_("isisfish.message.export.done")); -} -protected void exportRegion() { - setStatusMessage(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion(getRegionStorage())), true); - setStatusMessage(_("isisfish.message.export.done")); -} -protected void copyRegion() { - // TODO region name in not knwon before copy - setStatusMessage(_("isisfish.message.copy.region"), true); - getContextValue(InputAction.class).copyRegion(getRegionStorage()); - setStatusMessage(_("isisfish.message.copy.finished")); -} -protected void removeRegion(boolean deletecvs) { - setStatusMessage(_("isisfish.message.removing.region", getRegionStorage().getName()), true); - boolean deleted = getContextValue(InputAction.class).removeRegion(getRegionStorage(), deletecvs); - if (deleted) { - setStatusMessage(_("isisfish.message.region.removed")); - regionNull(); - } - else { - setStatusMessage(_("isisfish.message.region.remove.canceled")); - } -} -protected void commitRegionInCVS() { - setStatusMessage(_("isisfish.message.commiting.region", getRegionStorage().getName()), true); - setStatusMessage(getContextValue(InputAction.class).commitRegionInCVS(getRegionStorage())); -} - ]]> - </script> <JMenuBar id="menu" constraints='BorderLayout.NORTH'> <JMenu text="isisfish.common.region"> - <JMenuItem text="isisfish.input.menu.importRegion" onActionPerformed="importRegion()" /> - <JMenuItem text="isisfish.input.menu.importRenameRegion" onActionPerformed="importRegionAndRename()" /> - <JMenuItem text="isisfish.input.menu.importRegionV2" onActionPerformed="importV2Region()" /> - <JMenuItem text="isisfish.input.menu.importRegionSimulation" onActionPerformed="importRegionFromSimulation()" /> - <JMenuItem text="isisfish.input.menu.exportRegion" enabled='{getRegion() != null}' onActionPerformed="exportRegion()" /> - <JMenuItem text="isisfish.input.menu.copyRegion" enabled='{getRegion() != null}' onActionPerformed="copyRegion()" /> + <JMenuItem text="isisfish.input.menu.importRegion" onActionPerformed="getHandler().importRegion(this)" /> + <JMenuItem text="isisfish.input.menu.importRenameRegion" onActionPerformed="getHandler().importRegionAndRename(this)" /> + <JMenuItem text="isisfish.input.menu.importRegionV2" onActionPerformed="getHandler().importV2Region(this)" /> + <JMenuItem text="isisfish.input.menu.importRegionSimulation" onActionPerformed="getHandler().importRegionFromSimulation(this)" /> + <JMenuItem text="isisfish.input.menu.exportRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().exportRegion(this)" /> + <JMenuItem text="isisfish.input.menu.copyRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().copyRegion(this)" /> <JSeparator/> - <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocaly" enabled='{getRegion() != null}' onActionPerformed="removeRegion(false)" /> + <JMenuItem text="isisfish.input.menu.removeLocaly" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().removeRegion(this, false)" /> </JMenu> <JMenu text="isisfish.input.menu.server"> - <JMenuItem text="isisfish.input.menu.addRegion" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" /> - <JMenuItem text="isisfish.input.menu.commit" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" /> + <JMenuItem text="isisfish.input.menu.addRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().commitRegionInCVS(this)" /> + <JMenuItem text="isisfish.input.menu.commit" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().commitRegionInCVS(this)" /> <JSeparator/> - <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocalyRemotely" enabled='{getRegion() != null}' onActionPerformed="removeRegion(true)" /> + <JMenuItem text="isisfish.input.menu.removeLocalyRemotely" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().removeRegion(this, true)" /> </JMenu> <JMenu text="isisfish.input.menu.sensitivity"> - <JMenuItem text="isisfish.input.menu.sensitivity.export" enabled='{getRegion() != null}' onActionPerformed="getAction().exportRegionSensitivityFactors(this, getRegion())" /> + <JMenuItem text="isisfish.input.menu.sensitivity.export" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().exportRegionSensitivityFactors(this)" /> </JMenu> </JMenuBar> <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> @@ -247,30 +54,37 @@ <Table constraints='BorderLayout.NORTH'> <row> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldNewRegion" onKeyReleased='newChanged()'/> + <JTextField id="fieldNewRegion" /> </cell> <cell fill='horizontal'> - <JButton id="JButtonNewRegion" text="isisfish.input.newRegion" onActionPerformed='newRegion()' enabled='false'/> + <JButton id="buttonNewRegion" text="isisfish.input.newRegion" + onActionPerformed='getHandler().createNewRegion(this)' enabled='{getFieldNewRegion().getText().length() > 0}'/> </cell> </row> <row> <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldCurrentRegion" onItemStateChanged='regionChange(event)' + <JComboBox id="fieldCurrentRegion" onItemStateChanged='getHandler().regionChange(this, event)' model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'/> </cell> </row> </Table> <JPanel id="treePanel" name="treePanel" layout='{new BorderLayout()}'> <JScrollPane constraints='BorderLayout.CENTER'> - <JTree id="navigation" selectionModel='{getNavigationSelectionModel()}' cellRenderer='{getNavigationTreeCellRenderer()}' - rootVisible="true" selectionRow='0' model='{new DefaultTreeModel(null)}' - rowHeight="0" /> + <javax.swing.tree.DefaultTreeSelectionModel id='fisheryRegionTreeSelectionModel' + selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <JTree id="fisheryRegionTree" selectionModel='{fisheryRegionTreeSelectionModel}' + rootVisible="true" selectionRow='0' model='{new javax.swing.tree.DefaultTreeModel(null)}' rowHeight="0" + onValueChanged="getHandler().nodeSelectionChanged(this, event)" /> + <!-- cellRenderer='{new fr.ifremer.isisfish.ui.input.tree.FisheryRegionTreeRenderer()}' --> </JScrollPane> </JPanel> </JPanel> + <java.awt.CardLayout id='cardlayoutPrincipal'/> <JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}' minimumSize="{new java.awt.Dimension(0,0)}"> - <NoneUI id='noneUI' constraints='"none"'/> - <JPanel id="inputPane" layout='{getCardlayout()}' constraints='"normale"'/> + <JPanel layout='{new BorderLayout()}' constraints='"none"'> + <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> + </JPanel> + <JPanel id="inputPane" layout='{new BorderLayout()}' constraints='"normale"'/> </JPanel> </JSplitPane> -</JPanel> +</fr.ifremer.isisfish.ui.NavigationUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,31 +22,56 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> <Boolean id='metierSeasonSelected' javaBean='false'/> <Boolean id='targetSpeciesSelected' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.MetierImpl; +import fr.ifremer.isisfish.entities.Metier; import fr.ifremer.isisfish.entities.Species; import fr.ifremer.isisfish.entities.TargetSpecies; import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoTargetSpeciesTableModel; import fr.ifremer.isisfish.ui.input.metier.SpeciesComboModel; import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -tableTargetSpecies.addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(tableTargetSpecies.getSelectedRow() != -1); - } -}); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setTargetSpeciesModel(); + } + if (evt.getNewValue() != null) { + setTableTargetSpeciesModel(); + } + } + }); + addPropertyChangeListener(PROPERTY_METIER_SEASON_INFO, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + setTargetSpeciesModel(); + remove.setEnabled(false); + setAddButton(); + + // is actif is not working for targetFactor + // maybe set to true by addCurrentPanel + targetFactor.setActive(targetSpeciesSelected); + } + } + }); +} + @Override public void refresh() { getVerifier().addCurrentPanel(targetFactor); @@ -62,7 +87,7 @@ // is actif is not working for targetFactor // maybe set to true by addCurrentPanel - targetFactor.setActif(targetSpeciesSelected); + targetFactor.setActive(targetSpeciesSelected); } @Override @@ -137,66 +162,69 @@ add.setEnabled(isMetierSeasonSelected() && isTargetSpeciesSelected()); } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldTargetSpecies" onActionPerformed='targetSpeciesChanged()' - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='targetFactor' constructorParams='this' - actif='{isTargetSpeciesSelected()}' - text='isisfish.metierSeasonInfoSpecies.targetFactor' - bean='{getBean()}' formuleCategory='TargetFactor' - clazz='{fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class}' - decorator='boxed' _bean='{MetierImpl.class}' _method='""'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" - enabled='{isTargetSpeciesSelected()}' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTable id="tableTargetSpecies" rowHeight='24' enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" - onActionPerformed='remove()' enabled='false' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='0.5'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" + enabled='{isMetierSeasonSelected()}' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldTargetSpecies" onActionPerformed='targetSpeciesChanged()' + enabled='{isMetierSeasonSelected()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='targetFactor' constructorParams='this' + active='{isTargetSpeciesSelected()}' + text='isisfish.metierSeasonInfoSpecies.targetFactor' + bean='{getBean()}' formuleCategory='TargetFactor' + clazz='{fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class}' + decorator='boxed' _bean='{Metier.class}' _method='""'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" + enabled='{isTargetSpeciesSelected()}' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0' weighty='0.5'> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' + enabled='{isMetierSeasonSelected()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JTable id="tableTargetSpecies" rowHeight='24' enabled='{isMetierSeasonSelected()}' decorator='boxed' + onMouseReleased="remove.setEnabled(tableTargetSpecies.getSelectedRow() != -1)"/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JButton id="remove" text="isisfish.common.remove" + onActionPerformed='remove()' enabled='false' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,22 +22,36 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> <Boolean id='metierSeasonInfoSelected' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.MetierImpl; import fr.ifremer.isisfish.entities.MetierSeasonInfo; -import fr.ifremer.isisfish.entities.MetierSeasonInfoImpl; import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboModel; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + DefaultComboBoxModel seasonModel = new DefaultComboBoxModel(); + fieldMetierSeasonInfo.setModel(seasonModel); + } + if (evt.getNewValue() != null) { + setSeasonModel(); + } + } + }); +} + @Override public void refresh() { Metier metier = getVerifier().getEntity(Metier.class); @@ -45,7 +59,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((MetierImpl) metier); + setBean(metier); getVerifier().addCurrentPanel(metierSeasonInfoSpeciesEditor); if (getBean() != null) { @@ -78,44 +92,45 @@ if (log.isDebugEnabled()) { log.debug("Metier season changed : " + selectedMSI); } - // FIXME really need to fix impl cast !!! - setMetierSeasonInfo((MetierSeasonInfoImpl)selectedMSI); + setMetierSeasonInfo(selectedMSI); getVerifier().addCurrentEntity(getMetierSeasonInfo()); } metierSeasonInfoSpeciesEditor.refresh(); } ]]></script> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonInfoChanged()' - renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <MetierSeasonInfoSpeciesEditorUI id='metierSeasonInfoSpeciesEditor' constructorParams='this' - bean='{getBean()}' metierSeasonInfo='{getMetierSeasonInfo()}' metierSeasonSelected='{isMetierSeasonInfoSelected()}' - actif='{isActif()}' - _bean='{MetierSeasonInfoImpl.class}' _method='"SpeciesTargetSpecies"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonInfoChanged()' + renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <MetierSeasonInfoSpeciesEditorUI id='metierSeasonInfoSpeciesEditor' constructorParams='this' + bean='{getBean()}' metierSeasonInfo='{getMetierSeasonInfo()}' metierSeasonSelected='{isMetierSeasonInfoSelected()}' + active='{isActive()}' + _bean='{MetierSeasonInfo.class}' _method='"SpeciesTargetSpecies"'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,76 +22,78 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> <Boolean id='metierSeasonInfoNotNull' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Metier; - import fr.ifremer.isisfish.entities.MetierImpl; import fr.ifremer.isisfish.entities.MetierSeasonInfo; - import fr.ifremer.isisfish.entities.MetierSeasonInfoImpl; import fr.ifremer.isisfish.entities.Season; import fr.ifremer.isisfish.entities.Zone; import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboModel; import fr.ifremer.isisfish.ui.widget.Interval; import fr.ifremer.isisfish.ui.widget.IntervalPanel; + import java.beans.PropertyChangeEvent; + import java.beans.PropertyChangeListener; protected Interval interval = null; protected boolean init = false; + + protected void $afterCompleteSetup() { + /* + * Don't add both in same listener. + * When first is set, last value from getPopulationSeasonInfo() + * is erased by interval.getLast() default value. + */ + ip.addPropertyChangeListener("first", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getMetierSeasonInfo() != null) { + getMetierSeasonInfo().setFirstMonth(new Month(interval.getFirst())); + } + } + }); + ip.addPropertyChangeListener("last", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getMetierSeasonInfo() != null) { + getMetierSeasonInfo().setLastMonth(new Month(interval.getLast())); + } + } + }); - /* - * Don't add both in same listener. - * When first is set, last value from getPopulationSeasonInfo() - * is erased by interval.getLast() default value. - */ - ip.addPropertyChangeListener("first", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getMetierSeasonInfo() != null) { - getMetierSeasonInfo().setFirstMonth(new Month(interval.getFirst())); + save.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getVerifier().topiaSave(); + setMetierSeasonInfoCombo(); } - } - }); - ip.addPropertyChangeListener("last", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getMetierSeasonInfo() != null) { - getMetierSeasonInfo().setLastMonth(new Month(interval.getLast())); + }); + + create.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); + setMetierSeasonInfoCombo(); } - } - }); - - save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getVerifier().topiaSave(); - setMetierSeasonInfoCombo(); - } - }); + + }); - create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); - setMetierSeasonInfoCombo(); - } - - }); + remove.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); + setMetierSeasonInfoCombo(); + } + }); + } - remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); - setMetierSeasonInfoCombo(); - } - }); - @Override public void refresh() { @@ -99,13 +101,13 @@ log.debug("Refresh called in ui : " + this); } - //if (!isActif()) { + //if (!isActive()) { setMetierSeasonInfoNotNull(false); //} Metier metier = getVerifier().getEntity(Metier.class); // don't add setBean(null) here : useless - setBean((MetierImpl) metier); + setBean(metier); if (getBean() != null) { // Model instanciation @@ -128,7 +130,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save, false); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "MetierSeasonInfo", false); + getVerifier().setNewButton(create, MetierSeasonInfo.class, false); getVerifier().setDeleteButton(remove, false); } @@ -193,7 +195,7 @@ } protected void seasonChanged() { init = true; - setMetierSeasonInfo((MetierSeasonInfoImpl)metierSeasonInfoCombo.getSelectedItem()); + setMetierSeasonInfo((MetierSeasonInfo)metierSeasonInfoCombo.getSelectedItem()); getVerifier().addCurrentEntity(getMetierSeasonInfo()); setMetierSeasonInfoNotNull(getMetierSeasonInfo() != null); setSeason(); @@ -201,72 +203,74 @@ init = false; } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="metierSeasonInfoCombo" onActionPerformed='seasonChanged()' enabled='{isActif()}' - renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <IntervalPanel id='ip' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.zone" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.7'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="metierZones" onValueChanged='metierZonesChanged()' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <!-- jaxx.runtime.SwingUtil.getStringValue for null values --> - <JTextArea id="fieldMetierSeasonZoneComment" text='{jaxx.runtime.SwingUtil.getStringValue(getMetierSeasonInfo().getSeasonZoneComment())}' onKeyReleased='getMetierSeasonInfo().setSeasonZoneComment(fieldMetierSeasonZoneComment.getText())' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="metierSeasonInfoCombo" onActionPerformed='seasonChanged()' enabled='{isActive()}' + renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" /> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isMetierSeasonInfoNotNull()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <IntervalPanel id='ip' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.zone" enabled='{isMetierSeasonInfoNotNull()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.7'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JAXXList id="metierZones" onValueChanged='metierZonesChanged()' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isMetierSeasonInfoNotNull()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <!-- jaxx.runtime.SwingUtil.getStringValue for null values --> + <JTextArea id="fieldMetierSeasonZoneComment" text='{jaxx.runtime.SwingUtil.getStringValue(getMetierSeasonInfo().getSeasonZoneComment())}' onKeyReleased='getMetierSeasonInfo().setSeasonZoneComment(fieldMetierSeasonZoneComment.getText())' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,129 +22,135 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> <script><![CDATA[ - import fr.ifremer.isisfish.entities.Gear; - import fr.ifremer.isisfish.entities.Metier; - import fr.ifremer.isisfish.entities.MetierImpl; - - protected boolean init = false; - - @Override - public void refresh() { - - if (log.isDebugEnabled()) { - log.debug("Refresh called in ui : " + this); - } +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; - Metier metier = getVerifier().getEntity(Metier.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean((MetierImpl) metier); - - try { - if (getBean() != null) { +protected boolean init = false; + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { init = true; jaxx.runtime.SwingUtil.fillComboBox(fieldMetierGear, getRegion().getGear(), getBean().getGear(), true); init = false; } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't refresh", e); - } } + }); +} + + at Override +public void refresh() { + + if (log.isDebugEnabled()) { + log.debug("Refresh called in ui : " + this); } + + Metier metier = getVerifier().getEntity(Metier.class); - @Override - public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Metier"); - getVerifier().setDeleteButton(remove); + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(metier); +} + + at Override +public void setActionButtons() { + getVerifier().setSaveButton(save); + getVerifier().setCancelButton(cancel); + getVerifier().setNewButton(create, Metier.class); + getVerifier().setDeleteButton(remove); +} + +protected void gearChanged() { + if (!init) { + getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); } - - protected void gearChanged() { - if (!init) { - getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); - } - } +} ]]></script> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldMetierName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldMetierName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.gear" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldMetierGear" onActionPerformed='gearChanged()' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.rangeValues" enabled='{isActif()}'/> - </cell> - <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldMetierParam" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGearParameterValue())}' - onKeyReleased='getBean().setGearParameterValue(fieldMetierParam.getText())' enabled='{isActif()}' decorator='boxed' - _bean='{MetierImpl.class}' _method='"GearParameterValue"' /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.comments" enabled='{isActif()}'/> - </cell> - <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTextArea id="fieldMetierComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldMetierComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metier.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldMetierName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldMetierName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.gear" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldMetierGear" onActionPerformed='gearChanged()' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metier.rangeValues" enabled='{isActive()}'/> + </cell> + <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldMetierParam" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGearParameterValue())}' + onKeyReleased='getBean().setGearParameterValue(fieldMetierParam.getText())' enabled='{isActive()}' decorator='boxed' + _bean='{Metier.class}' _method='"GearParameterValue"' /> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metier.comments" enabled='{isActive()}'/> + </cell> + <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> + <cell fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JTextArea id="fieldMetierComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldMetierComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,20 +22,26 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Metier'> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + <script><![CDATA[ -// Constructor code -setButtonTitle(_("isisfish.input.continueTripTypes")); -setNextPath("$root/$tripTypes"); +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; - at Override -public void refresh() { - +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueTripTypes")); + setNextPath("$root/$tripTypes"); + // install change listener // (depends on sensitivity c'ant be done on constructor) installChangeListener(metierTab); +} + at Override +public void refresh() { + // add tab in reverse order // metierTabUI at last, for this tab refresh at end, and save/cancel button linked to // entity change @@ -48,16 +54,16 @@ setCurrentTabActionButtons(metierTab); } ]]></script> - <JPanel layout='{new BorderLayout()}'> + <JPanel id="body"> <JTabbedPane id="metierTab" constraints='BorderLayout.CENTER'> <tab title='{_("isisfish.metier.title")}'> - <MetierTabUI id="metierTabUI" constructorParams='this'/> + <MetierTabUI id="metierTabUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <tab title='{_("isisfish.metierSeasonInfoZone.title")}'> - <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='this'/> + <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'> - <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='this'/> + <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -1,27 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 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 2 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-2.0.html>. - #L% - --> -<JPanel layout='{new BorderLayout()}'> - <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> -</JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -59,50 +59,8 @@ protected IsisMapBean map; protected int selectMode = CellSelectionLayer.SINGLE_SELECTION; - + /** - * OnMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseDragged = null; - - /** - * OnMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseEntered = null; - - /** - * OnMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseExited = null; - - /** - * OnMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseMoved = null; - - /** - * OnMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMousePressed = null; - - /** - * OnMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseReleased = null; - - /** * Constructor. * * Register himself to {@code map} mapMouseListener. @@ -128,138 +86,6 @@ // do nothing, it's not reel layer } - /** - * Get onMouseDragged property. - * - * @return OnMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseDragged() { - return this.onMouseDragged; - } - - /** - * Set onMouseDragged property. - * - * @param onMouseDragged New onMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseDragged(String onMouseDragged) { - this.onMouseDragged = onMouseDragged; - } - - /** - * Get onMouseEntered property. - * - * @return OnMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseEntered() { - return this.onMouseEntered; - } - - /** - * Set onMouseEntered property. - * - * @param onMouseEntered New onMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseEntered(String onMouseEntered) { - this.onMouseEntered = onMouseEntered; - } - - /** - * Get onMouseExited property. - * - * @return OnMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseExited() { - return this.onMouseExited; - } - - /** - * Set onMouseExited property. - * - * @param onMouseExited New onMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseExited(String onMouseExited) { - this.onMouseExited = onMouseExited; - } - - /** - * Get onMouseMoved property. - * - * @return OnMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseMoved() { - return this.onMouseMoved; - } - - /** - * Set onMouseMoved property. - * - * @param onMouseMoved New onMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseMoved(String onMouseMoved) { - this.onMouseMoved = onMouseMoved; - } - - /** - * Get onMousePressed property. - * - * @return OnMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMousePressed() { - return this.onMousePressed; - } - - /** - * Set onMousePressed property. - * - * @param onMousePressed New onMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMousePressed(String onMousePressed) { - this.onMousePressed = onMousePressed; - } - - /** - * Get onMouseReleased property. - * - * @return OnMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseReleased() { - return this.onMouseReleased; - } - - /** - * Set onMouseReleased property. - * - * @param onMouseReleased New onMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseReleased(String onMouseReleased) { - this.onMouseReleased = onMouseReleased; - } - @Override public String[] getMouseModeServiceList() { return new String[] { SelectMouseMode.modeID }; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,10 +22,10 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ @@ -34,28 +34,31 @@ import fr.ifremer.isisfish.entities.Species; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import javax.swing.table.DefaultTableModel; import org.nuiton.topia.persistence.TopiaEntity; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - fieldPopulationBasicsName.setText(""); - fieldPopulationBasicsGeographicID.setText(""); - fieldPopulationBasicsNbClasses.setText(""); - fieldPopulationBasicsComment.setText(""); - fieldPopulationBasicsMatureClass.setSelectedItem(null); - tableAgeLength.setModel(new DefaultTableModel()); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + fieldPopulationBasicsName.setText(""); + fieldPopulationBasicsGeographicID.setText(""); + fieldPopulationBasicsNbClasses.setText(""); + fieldPopulationBasicsComment.setText(""); + fieldPopulationBasicsMatureClass.setSelectedItem(null); + tableAgeLength.setModel(new DefaultTableModel()); + } + if (evt.getNewValue() != null) { + if (getBean().getPopulationGroup() != null) { + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationBasicsMatureClass, getBean().getPopulationGroup(), getBean().getMaturityGroup(), true); + } + setTableAgeLengthModel(); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text") - } - } -}); + }); +} @Override public void refresh() { @@ -64,7 +67,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); if (getBean() != null) { if (getBean().getPopulationGroup() != null) { @@ -79,7 +82,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Population", false); + getVerifier().setNewButton(create, Population.class, false); getVerifier().setDeleteButton(remove); } @@ -117,7 +120,7 @@ getBean().setMaturityGroup((PopulationGroup) selected); } } -protected void setTableAgeLengthModel(){ +protected void setTableAgeLengthModel() { java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup(); if (popGroup != null){ DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1); @@ -132,130 +135,149 @@ tableAgeLength.setModel(model); } } -protected void create(){ - Species species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getNavigationPath()); + +protected void create() { + Species species = null; //getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getNavigationPath()); if (species == null){ - species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getParent().getNavigationPath()); + species = null; //getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getParent().getNavigationPath()); } - TopiaEntity topia = getContextValue(InputAction.class).createPopulation(getVerifier().getIsisContext(), species); - getParentContainer(InputUI.class).setTreeModel(); - getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ species.getTopiaId() +"/$populations/"+topia.getTopiaId()); + TopiaEntity topia = getContextValue(InputAction.class).createPopulation(getTopiaContext(), species); + // FIXME echatellier 20110306 use new tree api + //getParentContainer(InputUI.class).setTreeModel(); + //getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ species.getTopiaId() +"/$populations/"+topia.getTopiaId()); setInfoText(_("isisfish.message.creation.finished")); } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.name" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldPopulationBasicsName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsGeographicID" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGeographicId())}' onKeyReleased='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsNbClasses" text='{getBean() == null ? "" : getBean().sizePopulationGroup()}' editable="false" enabled='{isActif()}' decorator='boxed'/> - </cell> - <cell fill='horizontal'> - <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createGroups()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - <cell fill='horizontal'> - <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" selected='{getBean().getPlusGroup()}' onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"PlusGroup"'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0'> - <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='growthEquation' constructorParams='this' - text='isisfish.populationBasics.growth' actif='{isActif()}' - bean='{getBean()}' beanProperty='growth' formuleCategory='Growth' - clazz='{fr.ifremer.isisfish.equation.PopulationGrowth.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"Growth"'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='growthReverseEquation' constructorParams='this' - text='isisfish.populationBasics.growthReverse' actif='{isActif()}' - bean='{getBean()}' formuleCategory='GrowthReverse' beanProperty='GrowthReverse' - clazz='{fr.ifremer.isisfish.equation.PopulationGrowthReverse.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"GrowthReverse"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.population.comments" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldPopulationBasicsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' /> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' onActionPerformed='create()' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed' /> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.name" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldPopulationBasicsName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsGeographicID" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGeographicId())}' + onKeyReleased='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsNbClasses" + text='{String.valueOf(getBean() == null ? "" : getBean().sizePopulationGroup())}' + editable="false" enabled='{isActive()}' decorator='boxed'/> + </cell> + <cell fill='horizontal'> + <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" + onActionPerformed='createGroups()' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' + enabled='{isActive()}' decorator='boxed'/> + </cell> + <cell fill='horizontal'> + <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" + selected='{getBean().getPlusGroup()}' + onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' + enabled='{isActive()}' decorator='boxed' _bean='{Population.class}' _method='"PlusGroup"'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0'> + <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='growthEquation' constructorParams='this' + text='isisfish.populationBasics.growth' active='{isActive()}' + bean='{getBean()}' beanProperty='growth' formuleCategory='Growth' + clazz='{fr.ifremer.isisfish.equation.PopulationGrowth.class}' + decorator='boxed' _bean='{Population.class}' _method='"Growth"'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='growthReverseEquation' constructorParams='this' + text='isisfish.populationBasics.growthReverse' active='{isActive()}' + bean='{getBean()}' formuleCategory='GrowthReverse' beanProperty='GrowthReverse' + clazz='{fr.ifremer.isisfish.equation.PopulationGrowthReverse.class}' + decorator='boxed' _bean='{Population.class}' _method='"GrowthReverse"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.population.comments" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTextArea id="fieldPopulationBasicsComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' /> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' onActionPerformed='create()' decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed' /> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,37 +22,40 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.nuiton.math.matrix.gui.MatrixPanelListener; +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationCapturabilityComment.setText(""); + fieldPopulationCapturability.setMatrix(null); + } + if (evt.getNewValue() != null) { + if (getBean().getCapturability() != null) { + fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); + } + } + } + }); +} + protected void populationCapturabilityMatrixChanged(MatrixPanelEvent event) { if (getBean() != null && fieldPopulationCapturability.getMatrix() != null) { getBean().setCapturability(fieldPopulationCapturability.getMatrix().copy()); } } -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - fieldPopulationCapturabilityComment.setText(""); - fieldPopulationCapturability.setMatrix(null); - } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); - @Override public void refresh() { Population population = getVerifier().getEntity(Population.class); @@ -60,7 +63,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); if (getBean() != null){ if (getBean().getCapturability() != null) { @@ -80,39 +83,44 @@ } ]]> </script> - <Table id='body'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> - <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' - matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"Capturability"' - onMatrixChanged="populationCapturabilityMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> - <JLabel text="isisfish.populationCapturability.comments" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <JTextArea id="fieldPopulationCapturabilityComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCapturabilityComment())}' onKeyReleased='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> + <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' + matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' + enabled='{isActive()}' decorator='boxed' _bean='{Population.class}' _method='"Capturability"' + onMatrixChanged="populationCapturabilityMatrixChanged(event)" /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> + <JLabel text="isisfish.populationCapturability.comments" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <JScrollPane> + <JTextArea id="fieldPopulationCapturabilityComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCapturabilityComment())}' + onKeyReleased='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,16 +22,15 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Formule; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; @Override public void refresh() { @@ -40,7 +39,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); getVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); } @@ -52,41 +51,43 @@ } ]]> </script> - <Table id='body'> - <row> - <cell columns='2' fill='both' weightx='0.5' weighty='0.3'> - <InputOneEquationUI id='naturalDeathRate' constructorParams='this' - text='isisfish.populationEquation.naturalDeathRate' - bean='{getBean()}' formuleCategory='NaturalDeathRate' beanProperty='NaturalDeathRate' - clazz='{fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRate"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='meanWeight' constructorParams='this' - text='isisfish.populationEquation.meanWeight' - bean='{getBean()}' formuleCategory='MeanWeight' beanProperty='MeanWeight' - clazz='{fr.ifremer.isisfish.equation.PopulationMeanWeight.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"MeanWeight"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='price' constructorParams='this' - text='isisfish.populationEquation.price' - bean='{getBean()}' formuleCategory='Price' beanProperty='Price' - clazz='{fr.ifremer.isisfish.equation.PopulationPrice.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"Price"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='0.5' weighty='0.3'> + <InputOneEquationUI id='naturalDeathRate' constructorParams='this' + text='isisfish.populationEquation.naturalDeathRate' active="{isActive()}" + bean='{getBean()}' formuleCategory='NaturalDeathRate' beanProperty='NaturalDeathRate' + clazz='{fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class}' + decorator='boxed' _bean='{Population.class}' _method='"NaturalDeathRate"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <InputOneEquationUI id='meanWeight' constructorParams='this' + text='isisfish.populationEquation.meanWeight' active="{isActive()}" + bean='{getBean()}' formuleCategory='MeanWeight' beanProperty='MeanWeight' + clazz='{fr.ifremer.isisfish.equation.PopulationMeanWeight.class}' + decorator='boxed' _bean='{Population.class}' _method='"MeanWeight"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <InputOneEquationUI id='price' constructorParams='this' + text='isisfish.populationEquation.price' active="{isActive()}" + bean='{getBean()}' formuleCategory='Price' beanProperty='Price' + clazz='{fr.ifremer.isisfish.equation.PopulationPrice.class}' + decorator='boxed' _bean='{Population.class}' _method='"Price"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -32,11 +32,11 @@ seule, et contiennent les resulats des equations en simple visualisation. --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationGroupImpl id='populationGroup' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationGroup id='populationGroup' javaBean='null'/> <Boolean id='popGroupNotNull' javaBean='false'/> @@ -46,44 +46,46 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationImpl; import org.nuiton.math.matrix.MatrixND; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -addPropertyChangeListener("populationGroup", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - fieldPopulationGroupMeanWeight.setText(""); - fieldPopulationGroupPrice.setText(""); - fieldPopulationGroupReproductionRate.setText(""); - fieldPopulationGroupAge.setText(""); - fieldPopulationGroupMinLength.setText(""); - fieldPopulationGroupMaxLength.setText(""); - fieldPopulationGroupComment.setText(""); - fieldPopulationGroupNaturalDeathRate.setMatrix(null); - setPopGroupNotNull(false); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + if (getBean().getPopulationGroup() != null) { + jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), true); + } + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - } - } -}); + }); -/*fieldPopulationGroupNaturalDeathRate.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - if (getPopulationGroup() != null){ - // not sure of this code - // fieldPopulationGroupNaturalDeathRate contains of "part of" - // natural death rate matrix - // can't overrite matrix ... - // just enable save ? - save.setEnabled(true); + addPropertyChangeListener(PROPERTY_POPULATION_GROUP, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationGroupMeanWeight.setText(""); + fieldPopulationGroupPrice.setText(""); + fieldPopulationGroupReproductionRate.setText(""); + fieldPopulationGroupAge.setText(""); + fieldPopulationGroupMinLength.setText(""); + fieldPopulationGroupMaxLength.setText(""); + fieldPopulationGroupComment.setText(""); + fieldPopulationGroupNaturalDeathRate.setMatrix(null); + setPopGroupNotNull(false); + } + if (evt.getNewValue() != null) { + + } } - } -});*/ + }); +} @Override public void refresh() { - //if (!isActif()) { + //if (!isActive()) { setPopGroupNotNull(false); //} Population population = getVerifier().getEntity(Population.class); @@ -91,13 +93,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); - - if (getBean() != null) { - if (getBean().getPopulationGroup() != null) { - jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), true); - } - } + setBean(population); } @Override @@ -147,114 +143,116 @@ } ]]> </script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id='populationGroupPopulationGroupComboBox' onActionPerformed='populationGroupChanged()' enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupMeanWeight" text='{getPopulationGroup().getMeanWeight()}' - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.price" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupPrice" text='{getPopulationGroup().getPrice()}' - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' - enabled='false' decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRateMatrix"' /> - <!-- this bindings totally break UI - matrix='{getBean() == null || getPopulationGroup() == null ? null : ((AbstractMatrixND)getBean().getNaturalDeathRateMatrix()).getSubMatrixOnSemantic(0, getPopulationGroup())}' --> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldPopulationGroupReproductionRate' constructorParams='this' - bean='{getPopulationGroup()}' property='reproductionRate' - useSign='true' enabled='{isPopGroupNotNull()}' decorator='boxed' - _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/--> - <JTextField id="fieldPopulationGroupReproductionRate" text='{getPopulationGroup().getReproductionRate()}' - onKeyReleased='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' - enabled='{isPopGroupNotNull()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.age" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- non editable age field --> - <JTextField id="fieldPopulationGroupAge" text='{getPopulationGroup().getAge()}' - onKeyReleased='getPopulationGroup().setAge(Double.parseDouble(fieldPopulationGroupAge.getText()))' - enabled='{getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' - decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"Age"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.length" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable min length field --> - <JTextField id="fieldPopulationGroupMinLength" text='{getPopulationGroup().getMinLength()}' - toolTipText="isisfish.populationGroup.minimumLength" - onKeyReleased='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' - enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MinLength"'/> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable max length field --> - <JTextField id="fieldPopulationGroupMaxLength" text='{getPopulationGroup().getMaxLength()}' - toolTipText="isisfish.populationGroup.maximumLength" - onKeyReleased='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' - enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MaxLength"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.comments" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> - <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' - onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isPopGroupNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JAXXComboBox id='populationGroupPopulationGroupComboBox' onActionPerformed='populationGroupChanged()' enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupMeanWeight" text='{String.valueOf(getPopulationGroup().getMeanWeight())}' + enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.price" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupPrice" text='{String.valueOf(getPopulationGroup().getPrice())}' + enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' + enabled='false' decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRateMatrix"' /> + <!-- this bindings totally break UI + matrix='{getBean() == null || getPopulationGroup() == null ? null : ((AbstractMatrixND)getBean().getNaturalDeathRateMatrix()).getSubMatrixOnSemantic(0, getPopulationGroup())}' --> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldPopulationGroupReproductionRate' constructorParams='this' + bean='{getPopulationGroup()}' property='reproductionRate' + useSign='true' enabled='{isPopGroupNotNull()}' decorator='boxed' + _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/--> + <JTextField id="fieldPopulationGroupReproductionRate" text='{String.valueOf(getPopulationGroup().getReproductionRate())}' + onKeyReleased='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' + enabled='{isPopGroupNotNull()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.age" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- non editable age field --> + <JTextField id="fieldPopulationGroupAge" text='{String.valueOf(getPopulationGroup().getAge())}' + onKeyReleased='getPopulationGroup().setAge(Double.parseDouble(fieldPopulationGroupAge.getText()))' + enabled='{getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' + decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"Age"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.length" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell fill='both' weightx='0.5'> + <!-- non editable min length field --> + <JTextField id="fieldPopulationGroupMinLength" text='{String.valueOf(getPopulationGroup().getMinLength())}' + toolTipText="isisfish.populationGroup.minimumLength" + onKeyReleased='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' + enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MinLength"'/> + </cell> + <cell fill='both' weightx='0.5'> + <!-- non editable max length field --> + <JTextField id="fieldPopulationGroupMaxLength" text='{String.valueOf(getPopulationGroup().getMaxLength())}' + toolTipText="isisfish.populationGroup.maximumLength" + onKeyReleased='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' + enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MaxLength"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.comments" enabled='{isPopGroupNotNull()}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> + <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' + onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isPopGroupNotNull()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,11 +22,11 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> @@ -34,174 +34,170 @@ <script><![CDATA[ import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Zone; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.nuiton.math.matrix.gui.MatrixPanelListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - populationMigrationEmigrationTable.setMatrix(null); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + populationMigrationEmigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); -populationMigrationEmigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - } -}); + }); +} - public void init(PopulationSeasonInfo pi){ - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); - populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); - } - - @Override - public void refresh(){ - Population population = getVerifier().getEntity(Population.class); +public void init(PopulationSeasonInfo pi){ + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setPopInfo(null); + setPopInfo(pi); + populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); +} - // setBean(null); useless here - setBean((PopulationImpl) population); + at Override +public void refresh(){ + Population population = getVerifier().getEntity(Population.class); - refreshPanel(); - } - - @Override - public void setActionButtons() { + // setBean(null); useless here + setBean(population); - } - - public void refreshPanel() { - setFieldPopulationMigrationMigrationGroupChooserModel(); - setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); - remove.setEnabled(false); - setAddButton(); + refreshPanel(); +} - /*populationMigrationEmigrationTable.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - if (popInfo != null){ - popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); - } - } - });*/ - } + at Override +public void setActionButtons() { - protected void populationMigrationEmigrationMatrixChanged(MatrixPanelEvent event) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - if (popInfo != null){ - popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); +} + +public void refreshPanel() { + setFieldPopulationMigrationMigrationGroupChooserModel(); + setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); + remove.setEnabled(false); + setAddButton(); + + /*populationMigrationEmigrationTable.addMatrixListener(new MatrixPanelListener() { + @Override + public void matrixChanged(MatrixPanelEvent arg0) { + remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); + if (popInfo != null){ + popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); + } } + });*/ +} + +protected void populationMigrationEmigrationMatrixChanged(MatrixPanelEvent event) { + remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); + if (popInfo != null){ + popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); } +} - protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ - if (getBean() != null && getBean().getPopulationGroup() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationGroupChooser,getBean().getPopulationGroup(), null, true); - } +protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ + if (getBean() != null && getBean().getPopulationGroup() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationGroupChooser,getBean().getPopulationGroup(), null, true); } - protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ - if (getBean() != null && getBean().getPopulationZone() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); - } +} +protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ + if (getBean() != null && getBean().getPopulationZone() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); } - protected void add(){ - getContextValue(InputAction.class).addEmigration( - getPopInfo(), - (PopulationGroup) fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem(), - (Zone) fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem(), - Double.parseDouble(fieldPopulationMigrationEmigrationCoefficient.getText())); - populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().clone()); - } - - protected void remove() { - log.debug("removeEmigration called"); - try { - int row = populationMigrationEmigrationTable.getTable().getSelectedRow(); - Object group = populationMigrationEmigrationTable.getTable().getValueAt(row, 0); - Object departure = populationMigrationEmigrationTable.getTable().getValueAt(row, 1); +} +protected void add(){ + getContextValue(InputAction.class).addEmigration( + getPopInfo(), + (PopulationGroup) fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem(), + (Zone) fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem(), + Double.parseDouble(fieldPopulationMigrationEmigrationCoefficient.getText())); + populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().clone()); +} - MatrixND mat = popInfo.getEmigrationMatrix().clone(); - mat.setValue(group, departure, 0); - popInfo.setEmigrationMatrix(mat); - remove.setEnabled(false); - } catch(Exception eee) { - log.error("Can't remove migration", eee); - } +protected void remove() { + log.debug("removeEmigration called"); + try { + int row = populationMigrationEmigrationTable.getTable().getSelectedRow(); + Object group = populationMigrationEmigrationTable.getTable().getValueAt(row, 0); + Object departure = populationMigrationEmigrationTable.getTable().getValueAt(row, 1); + + MatrixND mat = popInfo.getEmigrationMatrix().clone(); + mat.setValue(group, departure, 0); + popInfo.setEmigrationMatrix(mat); + remove.setEnabled(false); + } catch(Exception eee) { + log.error("Can't remove migration", eee); } - protected void groupChanged() { - setGPopSelected(fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem() != null); - setAddButton(); - } - protected void coefChanged() { - setCoefNonVide(!fieldPopulationMigrationEmigrationCoefficient.getText().equals("")); - setAddButton(); - } - protected void zoneChanged() { - setZoneDepartSelected(fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem() != null); - setAddButton(); - } - protected void setAddButton() { - add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getCoefNonVide()); - } - ]]> - </script> - <Table id='body'> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActif()}' onActionPerformed='zoneChanged()'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JPanel/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationEmigrationTable' - linearModel="true" enabled='{isActif()}' - onMatrixChanged="populationMigrationEmigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> +} +protected void groupChanged() { + setGPopSelected(fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem() != null); + setAddButton(); +} +protected void coefChanged() { + setCoefNonVide(!fieldPopulationMigrationEmigrationCoefficient.getText().equals("")); + setAddButton(); +} +protected void zoneChanged() { + setZoneDepartSelected(fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem() != null); + setAddButton(); +} +protected void setAddButton() { + add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getCoefNonVide()); +} +]]></script> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActive()}' onActionPerformed='groupChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActive()}' onKeyReleased='coefChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActive()}' onActionPerformed='zoneChanged()'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JPanel/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActive()}'/> + </cell> + </row> + <row columns='4'> + <cell fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationEmigrationTable' + linearModel="true" enabled='{isActive()}' + onMatrixChanged="populationMigrationEmigrationMatrixChanged(event)" + onMouseReleased="remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1)"/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal' weightx='1.0'> + <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,22 +22,21 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -public void init(PopulationSeasonInfo pi) { +public void init(PopulationSeasonInfo populationSeasonInfo) { // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); + setPopInfo(populationSeasonInfo); } @Override @@ -51,33 +50,35 @@ } ]]> </script> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='migrationEquation' constructorParams='this' - text='isisfish.common.migration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Migration' beanProperty='MigrationEquation' - clazz='{fr.ifremer.isisfish.equation.MigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"MigrationEquation"'/> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='emigrationEquation' constructorParams='this' - text='isisfish.common.emigration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Emigration' beanProperty='EmigrationEquation' - clazz='{fr.ifremer.isisfish.equation.EmigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"EmigrationEquation"'/> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='immigrationEquation' constructorParams='this' - text='isisfish.common.immigration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Immigration' beanProperty='ImmigrationEquation' - clazz='{fr.ifremer.isisfish.equation.ImmigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"ImmigrationEquation"'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='migrationEquation' constructorParams='this' + text='isisfish.common.migration' active='{isActive()}' + bean='{getPopInfo()}' formuleCategory='Migration' beanProperty='MigrationEquation' + clazz='{fr.ifremer.isisfish.equation.MigrationEquation.class}' + decorator='boxed' _bean='{PopulationSeasonInfo.class}' _method='"MigrationEquation"'/> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='emigrationEquation' constructorParams='this' + text='isisfish.common.emigration' active='{isActive()}' + bean='{getPopInfo()}' formuleCategory='Emigration' beanProperty='EmigrationEquation' + clazz='{fr.ifremer.isisfish.equation.EmigrationEquation.class}' + decorator='boxed' _bean='{PopulationSeasonInfo.class}' _method='"EmigrationEquation"'/> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='immigrationEquation' constructorParams='this' + text='isisfish.common.immigration' active='{isActive()}' + bean='{getPopInfo()}' formuleCategory='Immigration' beanProperty='ImmigrationEquation' + clazz='{fr.ifremer.isisfish.equation.ImmigrationEquation.class}' + decorator='boxed' _bean='{PopulationSeasonInfo.class}' _method='"ImmigrationEquation"'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,68 +22,51 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> <Boolean id='coefNonVide' javaBean='false'/> <script><![CDATA[ - +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Zone; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import org.nuiton.math.matrix.gui.MatrixPanelListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - populationMigrationImmigrationTable.setMatrix(null); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + populationMigrationImmigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} -populationMigrationImmigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationImmigrationTable.getTable().getSelectedRow() != -1); - } -}); - -/*populationMigrationImmigrationTable.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - if (getPopInfo() != null) { - getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); - } - } -});*/ - protected void populationMigrationImmigrationMatrixChanged(MatrixPanelEvent event) { if (getPopInfo() != null){ getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); } } -public void init(PopulationSeasonInfo pi) { +public void init(PopulationSeasonInfo populationSeasonInfo) { // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); + setPopInfo(populationSeasonInfo); populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); } @@ -91,7 +74,7 @@ @Override public void refresh(){ Population population = getVerifier().getEntity(Population.class); - setBean((PopulationImpl) population); + setBean(population); refreshPanel(); } @@ -153,48 +136,51 @@ } ]]> </script> - <Table> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActif()}' onActionPerformed='zoneChanged()'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JPanel/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationImmigrationTable' - linearModel="true" enabled='{isActif()}' - onMatrixChanged="populationMigrationImmigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActive()}' onActionPerformed='groupChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActive()}' onKeyReleased='coefChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActive()}' onActionPerformed='zoneChanged()'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JPanel/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActive()}'/> + </cell> + </row> + <row columns='4'> + <cell fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationImmigrationTable' + linearModel="true" enabled='{isActive()}' + onMatrixChanged="populationMigrationImmigrationMatrixChanged(event)" + onMouseReleased="remove.setEnabled(populationMigrationImmigrationTable.getTable().getSelectedRow() != -1)"/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal' weightx='1.0'> + <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,11 +22,11 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> @@ -36,36 +36,29 @@ <script><![CDATA[ import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.PopulationSeasonInfo; import fr.ifremer.isisfish.entities.Zone; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.nuiton.math.matrix.gui.MatrixPanelListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - populationMigrationMigrationTable.setMatrix(null); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + populationMigrationMigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} -populationMigrationMigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationMigrationTable.getTable().getSelectedRow() != -1); - } -}); - protected void populationMigrationMigrationMatrixChanged(MatrixPanelEvent event) { if (getPopInfo() != null) { getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix().clone()); @@ -75,7 +68,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); + setPopInfo(pi); if (getPopInfo() != null && getPopInfo().getMigrationMatrix() != null){ populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); @@ -86,7 +79,7 @@ public void refresh() { Population population = getVerifier().getEntity(Population.class); // setBean(null); is useless here - setBean((PopulationImpl) population); + setBean(population); refreshPanel(); } @@ -161,51 +154,54 @@ } ]]> </script> - <Table id='body'> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActif()}' onActionPerformed='zoneDepartueChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActif()}' onActionPerformed='zoneArrivalChanged()'/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='populationMigrationMigrationTable' - linearModel='{true}' enabled='{isActif()}' - onMatrixChanged="populationMigrationMigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActive()}' onActionPerformed='groupChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActive()}' onKeyReleased='coefChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActive()}' onActionPerformed='zoneDepartueChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActive()}' onActionPerformed='zoneArrivalChanged()'/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActive()}'/> + </cell> + </row> + <row columns='4'> + <cell fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='populationMigrationMigrationTable' + linearModel='{true}' enabled='{isActive()}' + onMatrixChanged="populationMigrationMigrationMatrixChanged(event)" + onMouseReleased="remove.setEnabled(populationMigrationMigrationTable.getTable().getSelectedRow() != -1)"/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal' weightx='1.0'> + <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,32 +22,32 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id="selectedPopulationSeasonInfo" javaBean='false' /> <script><![CDATA[ import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboModel; import fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboRenderer; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; addPropertyChangeListener("bean", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { + if (evt.getNewValue() == null) { fieldPopulationMigrationComment.setText(""); fieldUseEquationMigration.setSelected(false); } - /*if (evt.getNewValue() != null) { - - }*/ + if (evt.getNewValue() != null) { + refresh(); + } } }); @@ -57,8 +57,8 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect - setBean(null); - setBean((PopulationImpl) population); + //setBean(null); + //setBean(population); // refresh psi list in combo box PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); @@ -82,7 +82,7 @@ } getVerifier().addCurrentPanel(populationMigrationEquationUI, populationMigrationMigrationUI, populationMigrationImmigrationUI, populationMigrationEmigrationUI); - // addCurrentPanel set all to isActif() + // addCurrentPanel set all to isActive() // force it to isSelectedPopulationSeasonInfo() // twice for real change event :( setSelectedPopulationSeasonInfo(fieldPopulationMigrationSeasonChooser.getModel().getSelectedItem() == null); @@ -98,7 +98,7 @@ protected void seasonChanged() { PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); PopulationSeasonInfo selectedPSI = (PopulationSeasonInfo)model.getSelectedItem(); - setPopInfo((PopulationSeasonInfoImpl)selectedPSI); + setPopInfo(selectedPSI); if (getPopInfo() != null) { getVerifier().addCurrentEntity(getPopInfo()); populationMigrationEquationUI.init(getPopInfo()); @@ -106,7 +106,7 @@ populationMigrationImmigrationUI.init(getPopInfo()); populationMigrationEmigrationUI.init(getPopInfo()); - setSelectedPopulationSeasonInfo(isActif()); + setSelectedPopulationSeasonInfo(isActive()); } else { setSelectedPopulationSeasonInfo(false); @@ -131,73 +131,75 @@ } ]]> </script> - <Table id='body'> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationMigrationSeasonChooser" - model='{new PopulationSeasonInfoComboModel()}' - renderer="{new PopulationSeasonInfoComboRenderer()}" - onActionPerformed='seasonChanged()' - enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' anchor='west'> - <JCheckBox id="fieldUseEquationMigration" selected='{getPopInfo().getUseEquationMigration()}' - text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' enabled='{isSelectedPopulationSeasonInfo()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.7'> - <JPanel id="hidablePanel" layout='{new CardLayout()}'> - <JTabbedPane id="fieldUseMatrix" constraints='"fieldUseMatrix"' enabled='{isSelectedPopulationSeasonInfo()}'> - <tab title='{_("isisfish.populationMigrationMigration.title")}'> - <PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"MigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - <tab title='{_("isisfish.populationMigrationImmigration.title")}'> - <PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"ImmigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - <tab title='{_("isisfish.populationMigrationEmigration.title")}'> - <PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"EmigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - </JTabbedPane> - <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this' - actif='{isSelectedPopulationSeasonInfo()}' /> - </JPanel> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationMigration.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <!-- comment can be null jaxx.runtime.SwingUtil.getStringValue() --> - <JTextArea id="fieldPopulationMigrationComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getMigrationComment())}' - onKeyReleased='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' - enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldPopulationMigrationSeasonChooser" + model='{new PopulationSeasonInfoComboModel()}' + renderer="{new PopulationSeasonInfoComboRenderer()}" + onActionPerformed='seasonChanged()' + enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' anchor='west'> + <JCheckBox id="fieldUseEquationMigration" selected='{getPopInfo().getUseEquationMigration()}' + text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' enabled='{isSelectedPopulationSeasonInfo()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.7'> + <JPanel id="hidablePanel" layout='{new CardLayout()}'> + <JTabbedPane id="fieldUseMatrix" constraints='"fieldUseMatrix"' enabled='{isSelectedPopulationSeasonInfo()}'> + <tab title='{_("isisfish.populationMigrationMigration.title")}'> + <PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this' decorator='boxed' + _bean='{PopulationSeasonInfo.class}' _method='"MigrationMatrix"' active='{isSelectedPopulationSeasonInfo()}' /> + </tab> + <tab title='{_("isisfish.populationMigrationImmigration.title")}'> + <PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this' decorator='boxed' + _bean='{PopulationSeasonInfo.class}' _method='"ImmigrationMatrix"' active='{isSelectedPopulationSeasonInfo()}' /> + </tab> + <tab title='{_("isisfish.populationMigrationEmigration.title")}'> + <PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this' decorator='boxed' + _bean='{PopulationSeasonInfo.class}' _method='"EmigrationMatrix"' active='{isSelectedPopulationSeasonInfo()}' /> + </tab> + </JTabbedPane> + <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this' + active='{isSelectedPopulationSeasonInfo()}' /> + </JPanel> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationMigration.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane> + <!-- comment can be null jaxx.runtime.SwingUtil.getStringValue() --> + <JTextArea id="fieldPopulationMigrationComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getMigrationComment())}' + onKeyReleased='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,15 +22,17 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.nuiton.math.matrix.gui.MatrixPanelListener; addPropertyChangeListener("bean", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @@ -62,7 +64,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); getVerifier().addCurrentPanel(reproductionEquation); @@ -84,81 +86,83 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <InputOneEquationUI id='reproductionEquation' constructorParams='this' - text='isisfish.populationRecruitment.reproductionEquation' - bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"ReproductionEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' - bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' - _method='"MonthGapBetweenReproRecrutement"'/--> - <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{getBean().getMonthGapBetweenReproRecrutement()}' - onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"MonthGapBetweenReproRecrutement"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' - matrix='{getBean().getRecruitmentDistribution() == null ? null : getBean().getRecruitmentDistribution().copy()}' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"RecruitmentDistribution"' - onMatrixChanged="populationRecruitmentDistributionMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='getAction().createRecruitmentDistribution(getBean())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> - <JTextArea id="fieldPopulationRecruitmentComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getRecruitmentComment())}' - onKeyReleased='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' - enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> -</Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <InputOneEquationUI id='reproductionEquation' constructorParams='this' + text='isisfish.populationRecruitment.reproductionEquation' active="{isActive()}" + bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' + decorator='boxed' _bean='{Population.class}' _method='"ReproductionEquation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' + bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' + enabled='{isActive()}' decorator='boxed' _bean='{PopulationImpl.class}' + _method='"MonthGapBetweenReproRecrutement"'/--> + <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{String.valueOf(getBean().getMonthGapBetweenReproRecrutement())}' + onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{Population.class}' _method='"MonthGapBetweenReproRecrutement"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' + matrix='{getBean().getRecruitmentDistribution() == null ? null : getBean().getRecruitmentDistribution().copy()}' + enabled='{isActive()}' decorator='boxed' _bean='{Population.class}' _method='"RecruitmentDistribution"' + onMatrixChanged="populationRecruitmentDistributionMatrixChanged(event)" /> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='getAction().createRecruitmentDistribution(getBean())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> + <JTextArea id="fieldPopulationRecruitmentComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getRecruitmentComment())}' + onKeyReleased='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,23 +22,23 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='populationSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> <Boolean id='popSeasonInfoNotNull' javaBean='false'/> <Boolean id='ageGroupType' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.ui.util.ErrorHelper; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.gui.MatrixPanelEditor; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import org.nuiton.math.matrix.gui.MatrixPanelListener; protected void populationSeasonLengthMatrixChanged(MatrixPanelEvent event) { if (getPopulationSeasonInfo() != null && matrixPanelPopulationSeasonLengthChange.getMatrix() != null) { @@ -117,55 +117,57 @@ } ]]></script> - <Table> - <row> - <cell> - <Panel/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' - text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{!getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' - text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' - enabled='{isPopSeasonInfoNotNull()}' onActionPerformed='computeMatrixChangeOfGroup()'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" - enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected()}' decorator='boxed' - onActionPerformed='showSpacializedMatrixChangeOfGroup()' - visible='{isAgeGroupType()}'/> - </cell> - </row> - <row> - <cell> - <Panel/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='matrixPanelPopulationSeasonLengthChange' - enabled='{isPopSeasonInfoNotNull()}' - _bean='{PopulationSeasonInfoImpl.class}' _method='"LengthChangeMatrix"' - visible='{isAgeGroupType()}' decorator='boxed' - matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getLengthChangeMatrix().copy()}' - onMatrixChanged="populationSeasonLengthMatrixChanged(event)" /> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell> + <Panel/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" + buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" + selected='{getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' + enabled='{isPopSeasonInfoNotNull()}' + text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' + visible='{isAgeGroupType()}' decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" + buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" + selected='{!getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' + enabled='{isPopSeasonInfoNotNull()}' + text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' + visible='{isAgeGroupType()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' + enabled='{isPopSeasonInfoNotNull()}' onActionPerformed='computeMatrixChangeOfGroup()'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" + enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected()}' decorator='boxed' + onActionPerformed='showSpacializedMatrixChangeOfGroup()' + visible='{isAgeGroupType()}'/> + </cell> + </row> + <row> + <cell> + <Panel/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='matrixPanelPopulationSeasonLengthChange' + enabled='{isPopSeasonInfoNotNull()}' + _bean='{PopulationSeasonInfo.class}' _method='"LengthChangeMatrix"' + visible='{isAgeGroupType()}' decorator='boxed' + matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getLengthChangeMatrix().copy()}' + onMatrixChanged="populationSeasonLengthMatrixChanged(event)" /> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,102 +22,92 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='populationSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> <Boolean id='popSeasonInfoNotNull' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.ui.widget.Interval; import org.nuiton.math.matrix.MatrixND; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.nuiton.math.matrix.gui.MatrixPanelListener; -//protected MatrixPanelListener matrixPanelListener; protected Interval seasonInterval; protected boolean init = false; -/* - * Don't add both in same listener. - * When first is set, last value from getPopulationSeasonInfo() - * is erased by interval.getLast() default value. - */ -seasonIntervalPanel.addPropertyChangeListener("first", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getPopulationSeasonInfo() != null) { - getPopulationSeasonInfo().setFirstMonth(new Month(seasonInterval.getFirst())); - setReproductionDistributionMatrix(); - } - } -}); -seasonIntervalPanel.addPropertyChangeListener("last", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getPopulationSeasonInfo() != null) { - getPopulationSeasonInfo().setLastMonth(new Month(seasonInterval.getLast())); - setReproductionDistributionMatrix(); - } - } -}); -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldPopulationSeasonComment.setText(""); - fieldPopulationSeasonReproductionDistribution.setMatrix(null); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationSeasonComment.setText(""); + fieldPopulationSeasonReproductionDistribution.setMatrix(null); + } + if (evt.getNewValue() != null) { + refresh(); + } } - if (evt.getNewValue() != null) { - + }); + + /* + * Don't add both in same listener. + * When first is set, last value from getPopulationSeasonInfo() + * is erased by interval.getLast() default value. + */ + seasonIntervalPanel.addPropertyChangeListener("first", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getPopulationSeasonInfo() != null) { + getPopulationSeasonInfo().setFirstMonth(new Month(seasonInterval.getFirst())); + setReproductionDistributionMatrix(); + } } - } -}); - -create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); - setPopulationSeasonInfo((PopulationSeasonInfoImpl)seasonNew); - setPopulationSeasonInfoCombo(); - } -}); - -remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); - setPopulationSeasonInfoCombo(); - } -}); - -save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getVerifier().topiaSave(); - setPopulationSeasonInfoCombo(); - } -}); - -/*matrixPanelListener = new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { - MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); - if (log.isDebugEnabled()) { - log.debug("Matrix ReproductionDistribution modified : " + reproductionDistribution); + }); + seasonIntervalPanel.addPropertyChangeListener("last", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getPopulationSeasonInfo() != null) { + getPopulationSeasonInfo().setLastMonth(new Month(seasonInterval.getLast())); + setReproductionDistributionMatrix(); } - getPopulationSeasonInfo().setReproductionDistribution(reproductionDistribution); } - } -};*/ + }); + + create.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); + setPopulationSeasonInfo(seasonNew); + setPopulationSeasonInfoCombo(); + } + }); + + remove.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); + setPopulationSeasonInfoCombo(); + } + }); + + save.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getVerifier().topiaSave(); + setPopulationSeasonInfoCombo(); + } + }); +} protected void populationSeasonReproductionDistributionMatrixChanged(MatrixPanelEvent event) { if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { @@ -131,7 +121,7 @@ @Override public void refresh() { - if (!isActif()) { + if (!isActive()) { setPopSeasonInfoNotNull(false); } @@ -139,8 +129,8 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect - setBean(null); - setBean((PopulationImpl) population); + //setBean(null); + //setBean(population); // Model instanciation seasonInterval = new Interval(); @@ -158,7 +148,7 @@ //fieldPopulationSeasonReproductionDistribution.addMatrixListener(matrixPanelListener); if(getPopulationSeasonInfo() != null) { - PopulationSeasonInfoImpl popInfo = getPopulationSeasonInfo(); + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); setPopulationSeasonInfo(null); setPopulationSeasonInfo(popInfo); getVerifier().addCurrentEntity(getPopulationSeasonInfo()); @@ -170,7 +160,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save, false); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "PopulationSeasonInfo", false); + getVerifier().setNewButton(create, PopulationSeasonInfo.class, false); getVerifier().setDeleteButton(remove, false); } @@ -228,7 +218,7 @@ if (log.isDebugEnabled()) { log.debug("Season changed : " + seasonInfoSelected); } - setPopulationSeasonInfo((PopulationSeasonInfoImpl)seasonInfoSelected); + setPopulationSeasonInfo(seasonInfoSelected); setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null); setSeasonInterval(); setReproductionDistributionMatrix(); @@ -254,104 +244,105 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationSeasonInfoChooser" - onActionPerformed='seasonChanged()' - enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.common.season" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='both'> - <JPanel/> - </cell> - <cell fill='both' weightx='1.0'> - <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" selected='{getPopulationSeasonInfo().getGroupChange()}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"GroupChange"' - onActionPerformed='seasonGroupChanged()' enabled='{isPopSeasonInfoNotNull()}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> - <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' bean='{getBean()}' - populationSeasonInfo='{getPopulationSeasonInfo()}' popSeasonInfoNotNull='{isPopSeasonInfoNotNull()}' - ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().getReproduction()}' - onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' - text="isisfish.populationSeasons.Reproduction" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isPopSeasonInfoNotNull()}' - visible='{getPopulationSeasonInfo().getReproduction()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.2'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationSeasonReproductionDistribution' - matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getReproductionDistribution().copy()}' - enabled='{isPopSeasonInfoNotNull()}' - visible='{getPopulationSeasonInfo().getReproduction()}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"ReproductionDistribution"' - onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.comments" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.1'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> - <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getSeasonsComment())}' onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldPopulationSeasonInfoChooser" + onActionPerformed='seasonChanged()' enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.common.season" enabled='{isPopSeasonInfoNotNull()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='both'> + <JPanel/> + </cell> + <cell fill='both' weightx='1.0'> + <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" selected='{getPopulationSeasonInfo().getGroupChange()}' + decorator='boxed' _bean='{PopulationSeasonInfo.class}' _method='"GroupChange"' + onActionPerformed='seasonGroupChanged()' enabled='{isPopSeasonInfoNotNull()}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> + <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' bean='{getBean()}' + populationSeasonInfo='{getPopulationSeasonInfo()}' popSeasonInfoNotNull='{isPopSeasonInfoNotNull()}' + ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().getReproduction()}' + onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' + text="isisfish.populationSeasons.Reproduction" enabled='{isPopSeasonInfoNotNull()}'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isPopSeasonInfoNotNull()}' + visible='{getPopulationSeasonInfo().getReproduction()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.2'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationSeasonReproductionDistribution' + matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getReproductionDistribution().copy()}' + enabled='{isPopSeasonInfoNotNull()}' + visible='{getPopulationSeasonInfo().getReproduction()}' + decorator='boxed' _bean='{PopulationSeasonInfo.class}' _method='"ReproductionDistribution"' + onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.comments" enabled='{isPopSeasonInfoNotNull()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.1'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> + <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getSeasonsComment())}' onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,24 +22,25 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <script><![CDATA[ import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabbedPaneListener; -setButtonTitle(_("isisfish.input.continueGears")); -setNextPath("$root/$gears"); - - at Override -public void refresh() { - +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueGears")); + setNextPath("$root/$gears"); + // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(populationTab); +} + at Override +public void refresh() { // reverse ordre is no more needed getVerifier().addCurrentPanel(populationMigrationUI, populationRecruitementUI, populationCapturabilityUI, populationSeasonsUI, populationZoneUI, populationEquationUI, populationGroupUI, populationBasicsUI); @@ -52,39 +53,39 @@ } ]]> </script> - <JPanel id='body' layout='{new BorderLayout()}'> - <JTabbedPane id="populationTab" constraints='BorderLayout.CENTER'> + <JPanel id='body'> + <JTabbedPane id="populationTab"> <!-- Saisie des populations --> <tab title='{_("isisfish.populationBasics.title")}'> - <PopulationBasicsUI id='populationBasicsUI' constructorParams='this'/> + <PopulationBasicsUI id='populationBasicsUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Zones --> <tab title='{_("isisfish.populationZones.title")}'> - <PopulationZonesUI id='populationZoneUI' constructorParams='this'/> + <PopulationZonesUI id='populationZoneUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisons --> <tab title='{_("isisfish.populationSeasons.title")}'> - <PopulationSeasonsUI id='populationSeasonsUI' constructorParams='this'/> + <PopulationSeasonsUI id='populationSeasonsUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des équations --> <tab title='{_("isisfish.populationEquation.title")}'> - <PopulationEquationUI id='populationEquationUI' constructorParams='this'/> + <PopulationEquationUI id='populationEquationUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des reproductions --> <tab title='{_("isisfish.populationRecruitment.title")}'> - <PopulationRecruitmentUI id='populationRecruitementUI' constructorParams='this'/> + <PopulationRecruitmentUI id='populationRecruitementUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des groupes de population --> <tab title='{_("isisfish.populationGroup.title")}'> - <PopulationGroupUI id='populationGroupUI' constructorParams='this'/> + <PopulationGroupUI id='populationGroupUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!--Capturabilité --> <tab title='{_("isisfish.populationCapturability.title")}'> - <PopulationCapturabilityUI id='populationCapturabilityUI' constructorParams='this'/> + <PopulationCapturabilityUI id='populationCapturabilityUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Migration --> <tab title='{_("isisfish.populationMigration.title")}'> - <PopulationMigrationUI id='populationMigrationUI' constructorParams='this'/> + <PopulationMigrationUI id='populationMigrationUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,25 +22,39 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Zone; import fr.ifremer.isisfish.ui.input.population.ZoneListModel; import org.nuiton.math.matrix.gui.MatrixPanelEvent; +import org.nuiton.math.matrix.gui.MatrixPanelListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -/*MatrixPanelListener listener = new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - fieldPopulationMappingZoneReproZoneRecruChanged(); - } -};*/ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + } + if (evt.getNewValue() != null) { + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + } + } + }); +} protected void populationMappingZoneReproZoneRecruMatrixChanged(MatrixPanelEvent event) { - //fieldPopulationMappingZoneReproZoneRecruChanged(); getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().clone()); } @@ -59,9 +73,6 @@ } -/*protected void fieldPopulationMappingZoneReproZoneRecruChanged(){ - getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix()); -}*/ protected void setFieldPopulationMappingZoneReproZoneRecru(){ if (getBean() != null){ if (getBean().getMappingZoneReproZoneRecru() != null){ @@ -130,46 +141,48 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="populationZonesPresence" onMouseClicked='presenceChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="fieldPopulationZonesReproduction" onMouseClicked='reproductionChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="fieldPopulationZonesRecruitment" onMouseClicked='recruitementChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' anchor='west'> - <JLabel text="isisfish.populationZones.betweenSpawningRecruitmentAreas" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationMappingZoneReproZoneRecru' - constructorParams='false' enabled='{isActif()}' - onMatrixChanged="populationMappingZoneReproZoneRecruMatrixChanged(event)" /> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell fill='both' weightx='0.3' weighty='0.5'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JList id="populationZonesPresence" onMouseClicked='presenceChanged()' enabled='{isActive()}'/> + </JScrollPane> + </cell> + <cell fill='both' weightx='0.3' weighty='0.5'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JList id="fieldPopulationZonesReproduction" onMouseClicked='reproductionChanged()' enabled='{isActive()}'/> + </JScrollPane> + </cell> + <cell fill='both' weightx='0.3' weighty='0.5'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JList id="fieldPopulationZonesRecruitment" onMouseClicked='recruitementChanged()' enabled='{isActive()}'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3' anchor='west'> + <JLabel text="isisfish.populationZones.betweenSpawningRecruitmentAreas" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationMappingZoneReproZoneRecru' + constructorParams='false' enabled='{isActive()}' + onMatrixChanged="populationMappingZoneReproZoneRecruMatrixChanged(event)" /> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,15 +22,14 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; @Override public void refresh() { @@ -39,7 +38,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); getVerifier().addCurrentPanel(popZones); } @@ -51,21 +50,23 @@ } ]]> </script> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1'> - <PopulationZonesEditorUI id='popZones' constructorParams='this' - bean='{getBean()}' actif='{isActif()}' decorator='boxed' - _bean='{PopulationImpl.class}' _method='"MappingZoneReproZoneRecru"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1'> + <PopulationZonesEditorUI id='popZones' constructorParams='this' + bean='{getBean()}' active='{isActive()}' decorator='boxed' + _bean='{Population.class}' _method='"MappingZoneReproZoneRecru"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,48 +22,69 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Port'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PortImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Port id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.PortImpl; import fr.ifremer.isisfish.entities.Cell; import com.bbn.openmap.gui.Tool; import com.bbn.openmap.gui.OMToolSet; import fr.ifremer.isisfish.map.CellSelectionLayer; import fr.ifremer.isisfish.map.CopyMapToClipboardListener; import com.bbn.openmap.event.SelectMouseMode; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; protected OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; boolean portChanged = true; -toolSet.setupListeners(portMap); -toolMap.add((Tool)toolSet); +protected void $afterCompleteSetup() { + toolSet.setupListeners(portMap); + toolMap.add((Tool)toolSet); + + // add copy to clipboard support + portMap.addMapMouseListener(new CopyMapToClipboardListener(portMap)); + new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + for (Cell c : portMap.getSelectedCells()) { + if (getBean() != null) { + if (getBean().getCell() != null) { + if (!getBean().getCell().getTopiaId().equals(c.getTopiaId())){ + getBean().setCell(c); + return true; + } + } + else { + getBean().setCell(c); + return true; + } + } + } + return true; + } + }; -// add copy to clipboard support -portMap.addMapMouseListener(new CopyMapToClipboardListener(portMap)); - -setMapListener(); -setButtonTitle(_("isisfish.input.continueSpecies")); -setNextPath("$root/$species"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldPortName.setText(""); - fieldPortComment.setText(""); + setButtonTitle(_("isisfish.input.continueSpecies")); + setNextPath("$root/$species"); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPortName.setText(""); + fieldPortComment.setText(""); + } + if (evt.getNewValue() != null) { + fillList(); + } } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - @Override public void refresh() { Port port = getVerifier().getEntity(Port.class); @@ -71,18 +92,16 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PortImpl) port); + setBean(port); // reload region in map refreshRegionInMap(portMap); - - fillList(); } @Override public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Port"); + getVerifier().setNewButton(create, Port.class); getVerifier().setDeleteButton(remove); } @@ -94,30 +113,6 @@ portChanged = true; } } -protected void setMapListener() { - if (mapListener == null) { - mapListener = new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - for (Cell c : portMap.getSelectedCells()) { - if (getBean() != null) { - if (getBean().getCell() != null) { - if (!getBean().getCell().getTopiaId().equals(c.getTopiaId())){ - getBean().setCell(c); - return true; - } - } - else { - getBean().setCell(c); - return true; - } - } - } - return true; - } - }; - } -} protected void portChanged() { if (portChanged) { @@ -125,70 +120,68 @@ } } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JSplitPane id="PortTab" name="Ports" - oneTouchExpandable="true" dividerLocation="270" orientation="horizontal"> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JLabel text="isisfish.port.name" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JTextField id="fieldPortName" text='{SwingUtil.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldPortName.getText())' enabled='{isActif()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JLabel text="isisfish.port.cell" enabled='{isActif()}'/> - - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> - <JScrollPane> - <JList id="portCell" selectedValue='{getBean().getCell()}' selectionMode="0" onMouseClicked='portChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.port.comments" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.3' weightx='1.0' > - <JScrollPane> - <JTextArea id="fieldPortComment" text='{SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPortComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='portMap' selectedCells='{getBean().getCell()}' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' constraints='BorderLayout.CENTER' selectionMode="1" decorator='boxed' fisheryRegion='{getRegion()}'/> - </JPanel> - </JSplitPane> - </cell> - </row> - </Table> + <JPanel id="body"> + <JSplitPane oneTouchExpandable="true" dividerLocation="270" orientation="horizontal"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JLabel text="isisfish.port.name" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JTextField id="fieldPortName" text='{SwingUtil.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldPortName.getText())' enabled='{isActive()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JLabel text="isisfish.port.cell" enabled='{isActive()}'/> + + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> + <JScrollPane> + <JAXXList id="portCell" selectedValue='{getBean().getCell()}' selectionMode="0" onMouseClicked='portChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.port.comments" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.3' weightx='1.0' > + <JScrollPane> + <JTextArea id="fieldPortComment" text='{SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPortComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + constraints='BorderLayout.NORTH' decorator='boxed' enabled='{getBean() != null}' /> + <fr.ifremer.isisfish.map.IsisMapBean id='portMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + constraints='BorderLayout.CENTER' selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" + decorator='boxed' enabled='{getBean() != null}' fisheryRegion='{getRegion()}' selectedCells='{getBean().getCell()}' /> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,19 +22,20 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.types.RangeOfValues; import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -addPropertyChangeListener("bean", new PropertyChangeListener() { +addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { + if (evt.getNewValue() == null) { fieldGearParamPossibleValue.setText(""); } if (evt.getNewValue() != null) { @@ -52,7 +53,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((GearImpl) gear); + setBean(gear); if (getBean() != null) { java.util.List<Object> values = new ArrayList<Object>(); @@ -79,14 +80,16 @@ } } ]]></script> - <Table id='body'> - <row> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldGearParamType" onActionPerformed='gearParamChanged()' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue() == null ? "" : getBean().getPossibleValue().getValues()}' onKeyReleased='gearParamChanged()' enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldGearParamType" onActionPerformed='gearParamChanged()' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue() == null ? "" : getBean().getPossibleValue().getValues()}' onKeyReleased='gearParamChanged()' enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,21 +22,19 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationImpl id='population' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='population' javaBean='null'/> <Boolean id='selectivityPopulationSelected' javaBean='false'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Equation; import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.Selectivity; import fr.ifremer.isisfish.entities.Species; import fr.ifremer.isisfish.ui.input.gear.GearPopulationSelectivityModel; @@ -47,7 +45,7 @@ @Override public void mouseReleased(MouseEvent e) { // le bouton ne doit pas s'activer dans l'analyse de sensibilite - if (isActif()) { + if (isActive()) { removeSelectivityButton.setEnabled(selectivityTable.getSelectedRow() != -1); } } @@ -61,7 +59,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((GearImpl) gear); + setBean(gear); if (getBean() != null) { setSelectivityPopulationSelected(false); @@ -71,7 +69,7 @@ getVerifier().addCurrentPanel(selectivityEquation); // reset to false after addCurrentPanel refresh - selectivityEquation.setActif(false); + selectivityEquation.setActive(false); setSelectivityPopulationSelected(false); removeSelectivityButton.setEnabled(false); @@ -105,7 +103,7 @@ } protected void addSelectivity() { - getAction().addSelectivity((Population)getPopulation(), selectivityEquation.getEditor().getText(), getBean()); + getAction().addSelectivity(getPopulation(), selectivityEquation.getEditor().getText(), getBean()); setSelectivityTableModel(); } @@ -133,48 +131,49 @@ protected void selectivityChanged() { setSelectivityPopulationSelected(fieldSelectivityPopulation.getSelectedItem() != null); - // FIXME remove Impl reference - setPopulation((PopulationImpl)fieldSelectivityPopulation.getSelectedItem()); + setPopulation((Population)fieldSelectivityPopulation.getSelectedItem()); addSelectivityButton.setEnabled(isSelectivityPopulationSelected()); } ]]></script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActif()}' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSelectivityPopulation" onActionPerformed='selectivityChanged()' enabled='{isActif()}' - decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0' insets="0"> - <InputOneEquationUI id='selectivityEquation' constructorParams='this' - text='isisfish.selectivity.equation' - bean='{getBean()}' formuleCategory='Selectivity' actif='{isSelectivityPopulationSelected()}' - clazz='{fr.ifremer.isisfish.equation.SelectivityEquation.class}' + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActive()}' decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldSelectivityPopulation" onActionPerformed='selectivityChanged()' enabled='{isActive()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="addSelectivityButton" text="isisfish.common.add" onActionPerformed='addSelectivity()' - enabled='{isSelectivityPopulationSelected()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTable id="selectivityTable" rowHeight='24' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="removeSelectivityButton" text="isisfish.common.remove" onActionPerformed='removeSelectivity()' - enabled='false' decorator='boxed' /> - </cell> - </row> - </Table> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0' insets="0"> + <InputOneEquationUI id='selectivityEquation' constructorParams='this' + text='isisfish.selectivity.equation' + bean='{getBean()}' formuleCategory='Selectivity' active='{isSelectivityPopulationSelected()}' + clazz='{fr.ifremer.isisfish.equation.SelectivityEquation.class}' + decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JButton id="addSelectivityButton" text="isisfish.common.add" onActionPerformed='addSelectivity()' + enabled='{isSelectivityPopulationSelected()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTable id="selectivityTable" rowHeight='24' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JButton id="removeSelectivityButton" text="isisfish.common.remove" onActionPerformed='removeSelectivity()' + enabled='false' decorator='boxed' /> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,15 +22,29 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + getVerifier().addCurrentPanel(editor); + } + } + }); +} + @Override public void refresh() { Gear gear = (Gear)getVerifier().getEntity(Gear.class); @@ -38,7 +52,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((GearImpl) gear); + setBean(gear); getVerifier().addCurrentPanel(editor); } @@ -49,20 +63,22 @@ getVerifier().setCancelButton(cancel); } ]]></script> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> - <SelectivityEditorUI id='editor' constructorParams='this' bean='{getBean()}' - _bean='{GearImpl.class}' _method='"PopulationSelectivity"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> + <SelectivityEditorUI id='editor' constructorParams='this' bean='{getBean()}' + _bean='{Gear.class}' _method='"PopulationSelectivity"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,10 +22,10 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> <script><![CDATA[ @@ -36,7 +36,6 @@ import fr.ifremer.isisfish.entities.Formule; import fr.ifremer.isisfish.entities.SetOfVessels; import jaxx.runtime.swing.editor.NumberEditor; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; boolean init = false; @@ -47,7 +46,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((SetOfVesselsImpl) setOfVessels); + setBean(setOfVessels); if (getBean() != null) { init = true; @@ -66,7 +65,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "SetOfVessels"); + getVerifier().setNewButton(create, SetOfVessels.class); getVerifier().setDeleteButton(remove); } @@ -82,106 +81,108 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldSetOfVesselsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.common.port" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSetOfVesselsPort" onActionPerformed='portChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSetOfVesselsVesselType" onActionPerformed='vesselTypeChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldSetOfVesselsNumberOfVessels' constructorParams='this' - bean='{getBean()}' property='numberOfVessels' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{SetOfVesselsImpl.class}' _method='"NumberOfVessels"'/--> - <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{getBean().getNumberOfVessels()}' - onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"NumberOfVessels"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldSetOfVesselsFixedCosts' constructorParams='this' - bean='{getBean()}' property='fixedCosts' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{SetOfVesselsImpl.class}' _method='"FixedCosts"'/--> - <JTextField id="fieldSetOfVesselsFixedCosts" text='{getBean().getFixedCosts()}' - onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"FixedCosts"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='technicalEfficiency' constructorParams='this' - text='isisfish.setOfVessels.technicalEfficiency' - bean='{getBean()}' formuleCategory='TechnicalEfficiency' beanProperty='TechnicalEfficiencyEquation' - clazz='{fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class}' - decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"TechnicalEfficiencyEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <JTextArea id="fieldSetOfVesselsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldSetOfVesselsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.common.port" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldSetOfVesselsPort" onActionPerformed='portChanged()' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldSetOfVesselsVesselType" onActionPerformed='vesselTypeChanged()' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldSetOfVesselsNumberOfVessels' constructorParams='this' + bean='{getBean()}' property='numberOfVessels' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{SetOfVesselsImpl.class}' _method='"NumberOfVessels"'/--> + <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{String.valueOf(getBean().getNumberOfVessels())}' + onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{SetOfVessels.class}' _method='"NumberOfVessels"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldSetOfVesselsFixedCosts' constructorParams='this' + bean='{getBean()}' property='fixedCosts' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{SetOfVesselsImpl.class}' _method='"FixedCosts"'/--> + <JTextField id="fieldSetOfVesselsFixedCosts" text='{String.valueOf(getBean().getFixedCosts())}' + onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{SetOfVessels.class}' _method='"FixedCosts"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <InputOneEquationUI id='technicalEfficiency' constructorParams='this' + text='isisfish.setOfVessels.technicalEfficiency' + bean='{getBean()}' formuleCategory='TechnicalEfficiency' beanProperty='TechnicalEfficiencyEquation' + clazz='{fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class}' + decorator='boxed' _bean='{SetOfVessels.class}' _method='"TechnicalEfficiencyEquation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane> + <JTextArea id="fieldSetOfVesselsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='1.0'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,19 +22,23 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.SetOfVessels'> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + <script><![CDATA[ -setButtonTitle(_("isisfish.input.continueStrategies")); -setNextPath("$root/$strategies"); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueStrategies")); + setNextPath("$root/$strategies"); - at Override -public void refresh() { - // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(setOfVesselsTab); +} + at Override +public void refresh() { + getVerifier().addCurrentPanel(setOfVesselsBasicsUI, effortDescriptionUI, effortParametersUI); } @@ -44,16 +48,16 @@ setCurrentTabActionButtons(setOfVesselsTab); } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JTabbedPane id="setOfVesselsTab" constraints='BorderLayout.CENTER'> + <JPanel id="body"> + <JTabbedPane id="setOfVesselsTab"> <tab title='{_("isisfish.setOfVessels.title")}'> - <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' constructorParams='this'/> + <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' bean="{getBean()}" constructorParams='this'/> </tab> <tab title='{_("isisfish.effortDescription.title")}'> - <EffortDescriptionUI id='effortDescriptionUI' constructorParams='this'/> + <EffortDescriptionUI id='effortDescriptionUI' bean="{getBean()}" constructorParams='this'/> </tab> <tab title='{_("isisfish.effortDescription.parametersTitle")}'> - <EffortDescriptionParametersUI id='effortParametersUI' constructorParams='this'/> + <EffortDescriptionParametersUI id='effortParametersUI' bean="{getBean()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,10 +22,11 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> -<Table> - <fr.ifremer.isisfish.entities.SpeciesImpl id='bean' javaBean='null'/> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> + + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> <Boolean id='actif' javaBean='false'/> + <script><![CDATA[ @Override @@ -45,15 +46,18 @@ } ]]> </script> - <row> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().getAgeGroupType()}' - buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().getAgeGroupType()}' - buttonGroup="structuredGroup" enabled='{isActif()}'/> - </cell> - </row> -</Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().getAgeGroupType()}' + buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().getAgeGroupType()}' + buttonGroup="structuredGroup" enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,31 +22,35 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SpeciesImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.SpeciesImpl; import jaxx.runtime.swing.editor.NumberEditor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -setButtonTitle(_("isisfish.input.continuePopulations")); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continuePopulations")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldSpeciesName.setText(""); + fieldSpeciesScientificName.setText(""); + fieldSpeciesCodeRubbin.setText(""); + fieldSpeciesCEE.setText(""); + fieldSpeciesComment.setText(""); + } + if (evt.getNewValue() != null) { -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldSpeciesName.setText(""); - fieldSpeciesScientificName.setText(""); - fieldSpeciesCodeRubbin.setText(""); - fieldSpeciesCEE.setText(""); - fieldSpeciesComment.setText(""); + } } - if (evt.getNewValue() != null) { - } - } -}); + }); +} public void refresh() { Species species = (Species)getVerifier().getEntity(Species.class); @@ -54,7 +58,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((SpeciesImpl) species); + setBean(species); if (getBean() != null) { setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations"); @@ -67,103 +71,106 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Species"); + getVerifier().setNewButton(create, Species.class); getVerifier().setDeleteButton(delete); } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell> - <JLabel text="isisfish.species.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldSpeciesName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesScientificName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getScientificName())}' - onKeyReleased='getBean().setScientificName(fieldSpeciesScientificName.getText())' - enabled='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"ScientificName"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesCodeRubbin" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCodeRubbin())}' - onKeyReleased='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActif()}' - decorator='boxed' _bean='{SpeciesImpl.class}' _method='"CodeRubbin"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.cee" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <!--NumberEditor id='fieldSpeciesCEE' constructorParams='this' - bean='{getBean()}' property='codeCEE' - decorator='boxed' _bean='{SpeciesImpl.class}' - useSign='true' _method='"CodeCEE"'/--> - <JTextField id="fieldSpeciesCEE" text='{getBean().getCodeCEE()}' - onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"CodeCEE"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.structured" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1' columns='2'> - <SpeciesStructuredUI bean='{getBean()}' actif='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"AgeGroupType"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' columns='2' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldSpeciesComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell> + <JLabel text="isisfish.species.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <JTextField id="fieldSpeciesName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldSpeciesName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.scientificName" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <JTextField id="fieldSpeciesScientificName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getScientificName())}' + onKeyReleased='getBean().setScientificName(fieldSpeciesScientificName.getText())' + enabled='{isActive()}' decorator='boxed' _bean='{Species.class}' _method='"ScientificName"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.rubbinCode" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <JTextField id="fieldSpeciesCodeRubbin" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCodeRubbin())}' + onKeyReleased='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActive()}' + decorator='boxed' _bean='{Species.class}' _method='"CodeRubbin"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.cee" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <!--NumberEditor id='fieldSpeciesCEE' constructorParams='this' + bean='{getBean()}' property='codeCEE' + decorator='boxed' _bean='{SpeciesImpl.class}' + useSign='true' _method='"CodeCEE"'/--> + <JTextField id="fieldSpeciesCEE" text='{String.valueOf(getBean().getCodeCEE())}' + onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{Species.class}' _method='"CodeCEE"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.structured" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1' columns='2'> + <SpeciesStructuredUI bean='{getBean()}' active='{isActive()}' decorator='boxed' + _bean='{Species.class}' _method='"AgeGroupType"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' columns='2' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTextArea id="fieldSpeciesComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% 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,10 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + <script><![CDATA[ import org.apache.commons.lang.StringUtils; @@ -53,59 +55,59 @@ getVerifier().setCancelButton(cancel); } ]]></script> - <JPanel id='body' layout='{new BorderLayout()}'> + <JPanel id='body'> <Table constraints='BorderLayout.CENTER'> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyJanuary' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.january"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyFebuary' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.february"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyMarch' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.march"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyApril' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyApril' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.april"))}' /> </cell> </row> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMay' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyMay' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.may"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJune' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyJune' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.june"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyJuly' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.july"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyAugust' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.august"))}' /> </cell> </row> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='this' + <StrategyOneMonthInfoUI id='strategySeptember' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.september"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyOctober' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.october"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyNovember' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.november"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='this' + <StrategyOneMonthInfoUI id='strategyDecember' bean="{getBean()}" constructorParams='this' strategieMonthText='{StringUtils.capitalize(_("isisfish.month.december"))}' /> </cell> </row> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,22 +22,22 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> <String id="strategieMonthText" javaBean='null'/> <!-- bean property --> - <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfoImpl id='strategyMonthInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo' javaBean='null'/> <script><![CDATA[ -import fr.ifremer.isisfish.entities.StrategyMonthInfoImpl; import fr.ifremer.isisfish.entities.Strategy; -import fr.ifremer.isisfish.entities.StrategyImpl; +import fr.ifremer.isisfish.entities.StrategyMonthInfo; import org.nuiton.math.matrix.gui.MatrixPanelEvent; import jaxx.runtime.swing.editor.NumberEditor; import fr.ifremer.isisfish.entities.TripType; +import org.nuiton.math.matrix.gui.MatrixPanelListener; protected int month = 0; @@ -55,7 +55,7 @@ Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class); // don't use setBean(null) here - setBean((StrategyImpl)strategy); + setBean(strategy); if (getBean() != null) { Object[] monthInfos = getBean().getStrategyMonthInfo().toArray(); @@ -64,7 +64,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setStrategyMonthInfo(null); - setStrategyMonthInfo((StrategyMonthInfoImpl) monthInfos[month]); + setStrategyMonthInfo((StrategyMonthInfo)monthInfos[month]); getVerifier().addCurrentEntity(getStrategyMonthInfo()); if (getStrategyMonthInfo() != null) { @@ -111,48 +111,50 @@ } } ]]></script> - <Table id='body'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'> - <JLabel enabled='{isActif()}' text="{getStrategieMonthText()}" font-weight="bold"/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel id='numberOfTrips' text='{getStrategyMonthInfo().getNumberOfTrips()}' enabled='{isActif()}' - decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"NumberOfTrips"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <!-- NumberEditor id='fieldStrategyMonthInfoMinInactivityDays' constructorParams='this' - bean='{getStrategyMonthInfo()}' property='minInactivityDays' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/--> - <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{getStrategyMonthInfo().getMinInactivityDays()}' - onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" linearModelShowDefault='{true}' - linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' - onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" - enabled='{isActif()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"ProportionMetier"'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'> + <JLabel enabled='{isActive()}' text="{getStrategieMonthText()}" font-weight="bold"/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5' anchor='west'> + <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5' anchor='west'> + <JLabel id='numberOfTrips' text='{String.valueOf(getStrategyMonthInfo().getNumberOfTrips())}' enabled='{isActive()}' + decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"NumberOfTrips"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5' anchor='west'> + <JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <!-- NumberEditor id='fieldStrategyMonthInfoMinInactivityDays' constructorParams='this' + bean='{getStrategyMonthInfo()}' property='minInactivityDays' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/--> + <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{String.valueOf(getStrategyMonthInfo().getMinInactivityDays())}' + onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" linearModelShowDefault='{true}' + linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' + onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" + enabled='{isActive()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"ProportionMetier"'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,14 +22,13 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> <!-- bean property --> - <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.StrategyImpl; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.Formule; import fr.ifremer.isisfish.entities.SetOfVessels; @@ -43,14 +42,14 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((StrategyImpl) strategy); + setBean(strategy); if (getBean() != null) { setSetOfVesselsModel(); //fieldStrategyProportionSetOfVessels.init(); // code to replace bindings : - strategyInactivity.setActif(isActif() && getBean().getInactivityEquationUsed()); + strategyInactivity.setActive(isActive() && getBean().getInactivityEquationUsed()); getVerifier().addCurrentPanel(strategyInactivity); } @@ -62,7 +61,7 @@ fieldStrategyComment.setText(""); // code to replace bindings : - strategyInactivity.setActif(isActif()); + strategyInactivity.setActive(isActive()); } } @@ -70,7 +69,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Strategy"); + getVerifier().setNewButton(create, Strategy.class); getVerifier().setDeleteButton(remove); } @@ -88,96 +87,98 @@ protected void inactivityEquationActionPerformed() { boolean checked = fieldUseEquationInactivity.isSelected(); getBean().setInactivityEquationUsed(checked); - strategyInactivity.setActif(checked); + strategyInactivity.setActive(checked); } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldStrategyName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldStrategyName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.common.setOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldStrategySetOfVessels" onActionPerformed='getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldStrategyProportionSetOfVessels' constructorParams='this' - bean='{getBean()}' property='proportionSetOfVessels' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{StrategyImpl.class}' _method='"ProportionSetOfVessels"'/--> - <JTextField id="fieldStrategyProportionSetOfVessels" text='{getBean().getProportionSetOfVessels()}' - onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{StrategyImpl.class}' _method='"ProportionSetOfVessels"'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().getInactivityEquationUsed()}' - text="isisfish.strategy.inactivityEquationUsed" - onActionPerformed='inactivityEquationActionPerformed()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> - <InputOneEquationUI id="strategyInactivity" constructorParams='this' - text='isisfish.strategy.inactivity' - bean='{getBean()}' formuleCategory='Inactivity' beanProperty='InactivityEquation' - clazz='{fr.ifremer.isisfish.equation.StrategyInactivityEquation.class}' - decorator='boxed' _bean='{StrategyImpl.class}' _method='"Inactivity"'/> <!-- bindings not work well actif='{getBean().getInactivityEquationUsed()}' --> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <JTextArea id="fieldStrategyComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='west'> + <JLabel text="isisfish.strategy.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldStrategyName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldStrategyName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text="isisfish.common.setOfVessels" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldStrategySetOfVessels" onActionPerformed='getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldStrategyProportionSetOfVessels' constructorParams='this' + bean='{getBean()}' property='proportionSetOfVessels' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{StrategyImpl.class}' _method='"ProportionSetOfVessels"'/--> + <JTextField id="fieldStrategyProportionSetOfVessels" text='{String.valueOf(getBean().getProportionSetOfVessels())}' + onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{Strategy.class}' _method='"ProportionSetOfVessels"'/> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().getInactivityEquationUsed()}' + text="isisfish.strategy.inactivityEquationUsed" + onActionPerformed='inactivityEquationActionPerformed()' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> + <InputOneEquationUI id="strategyInactivity" constructorParams='this' + text='isisfish.strategy.inactivity' + bean='{getBean()}' formuleCategory='Inactivity' beanProperty='InactivityEquation' + clazz='{fr.ifremer.isisfish.equation.StrategyInactivityEquation.class}' + decorator='boxed' _bean='{Strategy.class}' _method='"Inactivity"'/> <!-- bindings not work well actif='{getBean().getInactivityEquationUsed()}' --> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text="isisfish.strategy.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.5'> + <JScrollPane> + <JTextArea id="fieldStrategyComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,14 +22,18 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + <script><![CDATA[ - at Override -public void refresh() { - +protected void $afterCompleteSetup() { // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(strategyTab); +} + at Override +public void refresh() { getVerifier().addCurrentPanel(strategyMonthInfoUI, strategyTabUI); } @@ -40,13 +44,13 @@ setCurrentTabActionButtons(strategyTab); } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JTabbedPane id="strategyTab" constraints='BorderLayout.CENTER'> + <JPanel id="body"> + <JTabbedPane id="strategyTab"> <tab title='isisfish.strategy.title'> - <StrategyTabUI id='strategyTabUI' constructorParams='this'/> + <StrategyTabUI id='strategyTabUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <tab title='isisfish.strategyMonthInfo.title'> - <StrategyMonthInfoUI id='strategyMonthInfoUI' constructorParams='this'/> + <StrategyMonthInfoUI id='strategyMonthInfoUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,15 +22,16 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='TripType'> <!-- bean property --> - <fr.ifremer.isisfish.entities.TripTypeImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.TripType id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.TripTypeImpl; import fr.ifremer.isisfish.types.TimeUnit; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; setButtonTitle(_("isisfish.input.continueVesselTypes")); setNextPath("$root/$vesselTypes"); @@ -59,88 +60,90 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((TripTypeImpl) tripType); + setBean(tripType); } @Override public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "TripType"); + getVerifier().setNewButton(create, TripType.class); getVerifier().setDeleteButton(delete); } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell> - <JLabel text="isisfish.tripType.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldTripTypeName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.duration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeDuration" text='{getBean().getTripDuration().getHour()}' toolTipText="isisfish.common.duration.inhours" - onKeyReleased='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' - enabled='{isActif()}' decorator='boxed' _bean='{TripTypeImpl.class}' _method='"TripDuration"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.minTime" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='{getBean().getMinTimeBetweenTrip().getHour()}' - onKeyReleased='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' - enabled='{isActif()}' decorator='boxed' _bean='{TripTypeImpl.class}' _method='"MinTimeBetweenTrip"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldTripTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell> + <JLabel text="isisfish.tripType.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldTripTypeName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldTripTypeName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.tripType.duration" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldTripTypeDuration" text='{String.valueOf(getBean().getTripDuration().getHour())}' toolTipText="isisfish.common.duration.inhours" + onKeyReleased='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' + enabled='{isActive()}' decorator='boxed' _bean='{TripType.class}' _method='"TripDuration"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.tripType.minTime" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='{String.valueOf(getBean().getMinTimeBetweenTrip().getHour())}' + onKeyReleased='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' + enabled='{isActive()}' decorator='boxed' _bean='{TripType.class}' _method='"MinTimeBetweenTrip"'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.tripType.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTextArea id="fieldTripTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,20 +22,20 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='VesselType'> <!-- bean property --> - <fr.ifremer.isisfish.entities.VesselTypeImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.VesselType id='bean' javaBean='null'/> <script><![CDATA[ import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.VesselTypeImpl; import fr.ifremer.isisfish.entities.TripType; import fr.ifremer.isisfish.types.TimeUnit; import fr.ifremer.isisfish.ui.input.triptype.TripTypeListModel; import jaxx.runtime.swing.editor.NumberEditor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; - setButtonTitle(_("isisfish.input.continueSetOfVessels")); setNextPath("$root/$setOfVessels"); addPropertyChangeListener("bean", new PropertyChangeListener() { @@ -63,7 +63,7 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((VesselTypeImpl) vesselType); + setBean(vesselType); if (getBean() != null) { setListModel(); @@ -83,7 +83,7 @@ public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "VesselType"); + getVerifier().setNewButton(create, VesselType.class); getVerifier().setDeleteButton(delete); } @@ -104,147 +104,149 @@ getBean().setTripType(tripTypes); } ]]></script> - <Table id='body' constraints='BorderLayout.CENTER'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldVesselTypeName" text='{getBean().getName()}' enabled='{isActif()}' - onKeyReleased='getBean().setName(fieldVesselTypeName.getText())' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.length" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeLength' constructorParams='this' - bean='{getBean()}' property='length' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"Length"'/--> - <JTextField id="fieldVesselTypeLength" text='{getBean().getLength()}' enabled='{isActif()}' - onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"Length"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.speed" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeSpeed' constructorParams='this' - bean='{getBean()}' property='speed' useSign='true' - enabled='{isActif()}' decorator='boxed' - _bean='{VesselTypeImpl.class}' _method='"Speed"'/--> - <JTextField id="fieldVesselTypeSpeed" text='{getBean().getSpeed()}' enabled='{isActif()}' - onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"Speed"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.maxDuration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldVesselTypeMaxTripDuration" text='{getBean().getMaxTripDuration().getHour()}' toolTipText="isisfish.common.duration.inhours" - enabled='{isActif()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText()) * 3600))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"MaxTripDuration"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.activityRange" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeActivityRange' constructorParams='this' - bean='{getBean()}' property='activityRange' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"ActivityRange"'/--> - <JTextField id="fieldVesselTypeActivityRange" text='{getBean().getActivityRange()}' enabled='{isActif()}' - onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"ActivityRange"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.miniCrew" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeMinCrewSize' constructorParams='this' - bean='{getBean()}' property='minCrewSize' useSign='true' - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' - _method='"MinCrewSize"'/--> - <JTextField id="fieldVesselTypeMinCrewSize" text='{getBean().getMinCrewSize()}' enabled='{isActif()}' - onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"MinCrewSize"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.fuelCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeUnitFuelCostOfTravel' constructorParams='this' - bean='{getBean()}' property='unitFuelCostOfTravel' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"UnitFuelCostOfTravel"'/--> - <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{getBean().getUnitFuelCostOfTravel()}' - onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"UnitFuelCostOfTravel"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.tripType" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.7'> - <JScrollPane> - <JList id="vesselTypeTripType" selectedValues='{getBean().getTripType() == null ? null : getBean().getTripType().toArray()}' - onMouseClicked='tripTypeChanged()' - cellRenderer="{new fr.ifremer.isisfish.ui.input.triptype.TripTypeListRenderer()}" - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"TripType"'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <JTextArea id="fieldVesselTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldVesselTypeName" text='{getBean().getName()}' enabled='{isActive()}' + onKeyReleased='getBean().setName(fieldVesselTypeName.getText())' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.length" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeLength' constructorParams='this' + bean='{getBean()}' property='length' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{VesselType.class}' _method='"Length"'/--> + <JTextField id="fieldVesselTypeLength" text='{String.valueOf(getBean().getLength())}' enabled='{isActive()}' + onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))' + decorator='boxed' _bean='{VesselType.class}' _method='"Length"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.speed" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeSpeed' constructorParams='this' + bean='{getBean()}' property='speed' useSign='true' + enabled='{isActive()}' decorator='boxed' + _bean='{VesselType.class}' _method='"Speed"'/--> + <JTextField id="fieldVesselTypeSpeed" text='{String.valueOf(getBean().getSpeed())}' enabled='{isActive()}' + onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))' + decorator='boxed' _bean='{VesselType.class}' _method='"Speed"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.maxDuration" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldVesselTypeMaxTripDuration" text='{String.valueOf(getBean().getMaxTripDuration().getHour())}' toolTipText="isisfish.common.duration.inhours" + enabled='{isActive()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText()) * 3600))' + decorator='boxed' _bean='{VesselType.class}' _method='"MaxTripDuration"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.activityRange" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeActivityRange' constructorParams='this' + bean='{getBean()}' property='activityRange' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{VesselType.class}' _method='"ActivityRange"'/--> + <JTextField id="fieldVesselTypeActivityRange" text='{String.valueOf(getBean().getActivityRange())}' enabled='{isActive()}' + onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))' + decorator='boxed' _bean='{VesselType.class}' _method='"ActivityRange"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.miniCrew" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeMinCrewSize' constructorParams='this' + bean='{getBean()}' property='minCrewSize' useSign='true' + enabled='{isActive()}' decorator='boxed' _bean='{VesselType.class}' + _method='"MinCrewSize"'/--> + <JTextField id="fieldVesselTypeMinCrewSize" text='{String.valueOf(getBean().getMinCrewSize())}' enabled='{isActive()}' + onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))' + decorator='boxed' _bean='{VesselType.class}' _method='"MinCrewSize"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.fuelCost" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeUnitFuelCostOfTravel' constructorParams='this' + bean='{getBean()}' property='unitFuelCostOfTravel' + enabled='{isActive()}' decorator='boxed' useSign='true' + _bean='{VesselType.class}' _method='"UnitFuelCostOfTravel"'/--> + <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{String.valueOf(getBean().getUnitFuelCostOfTravel())}' + onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' + enabled='{isActive()}' decorator='boxed' _bean='{VesselType.class}' _method='"UnitFuelCostOfTravel"'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.tripType" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.7'> + <JScrollPane> + <JAXXList id="vesselTypeTripType" selectedValues='{getBean().getTripType() == null ? null : getBean().getTripType().toArray()}' + onMouseClicked='tripTypeChanged()' + cellRenderer="{new fr.ifremer.isisfish.ui.input.triptype.TripTypeListRenderer()}" + enabled='{isActive()}' decorator='boxed' _bean='{VesselType.class}' _method='"TripType"'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane> + <JTextArea id="fieldVesselTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -30,8 +30,10 @@ import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.entities.Equation; import fr.ifremer.isisfish.entities.Population; + import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.PopulationGroupDAO; + import fr.ifremer.isisfish.entities.PopulationDAO; protected String current = null; protected boolean ageType = false; @@ -232,21 +234,21 @@ pop.setMaturityGroup(null); // remove all old group - TopiaContext isisContext = pop.getTopiaContext(); + TopiaContext isisContext = ((PopulationImpl)pop).getTopiaContext(); pop.clearPopulationGroup(); - PopulationGroupDAO dao = IsisFishDAOHelper.getPopulationGroupDAO(isisContext); + PopulationGroupDAO populationGroupDAO = IsisFishDAOHelper.getPopulationGroupDAO(isisContext); if (isAgeType()) { double ageFirst = getFirst(); double ageLast = getLast(); for (int id=0; id + ageFirst <= ageLast; id++) { - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(id); group.setPopulation(pop); group.setAge(ageFirst + id); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); } } else if (isInputType()) { double minLength = getFirst(); @@ -254,13 +256,13 @@ for(int i=0; i<values.length; i++){ if (!"".equals(values[i])) { double length = Double.parseDouble(values[i]); - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(minLength); group.setMaxLength(length); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); minLength = length; } } @@ -279,13 +281,13 @@ double maxLength = minLength; for(int i=0; i<numberOfGroup; i++){ maxLength = minLength + step; - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(minLength); group.setMaxLength(maxLength); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); minLength = maxLength; } } else if (isGrowthCurveType()) { @@ -301,7 +303,7 @@ double Lmin = minLength; for(int i=0; i<numberOfGroup; i++){ // on creer la classe avec une valeur Lmax fausses ... - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(Lmin); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-03-15 15:50:27 UTC (rev 3158) @@ -22,51 +22,60 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> <!-- bean property --> - <fr.ifremer.isisfish.entities.ZoneImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> <script><![CDATA[ import javax.swing.event.ListSelectionEvent; import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.entities.ZoneImpl; import fr.ifremer.isisfish.map.CellSelectionLayer; import fr.ifremer.isisfish.map.CopyMapToClipboardListener; import com.bbn.openmap.event.SelectMouseMode; import com.bbn.openmap.gui.Tool; import com.bbn.openmap.gui.OMToolSet; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; protected OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; -toolSet.setupListeners(zoneMap); -toolMap.add((Tool)toolSet); +protected void $afterCompleteSetup() { + toolSet.setupListeners(zoneMap); + toolMap.add((Tool)toolSet); -// add copy to clipboard support -zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); + // add copy to clipboard support + zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); + new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + getBean().setCell(zoneMap.getSelectedCells()); + if (getBean().getCell() != null){ + zoneCells.setSelectedValues(getBean().getCell().toArray()); + } + return true; + } + }; -zoneMap.addMapMouseListener(getMapListener()); -setButtonTitle(_("isisfish.input.continuePorts")); -setNextPath("$root/$ports"); + setButtonTitle(_("isisfish.input.continuePorts")); + setNextPath("$root/$ports"); -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("bean changed " + evt.getOldValue() + " : " + evt.getNewValue()); + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldZoneName.setText(""); + fieldZoneComment.setText(""); + zoneMap.setSelectedCells((Cell)null); + } + if (evt.getNewValue() != null) { + setZoneCells(); + zoneMap.setSelectedCells(getBean().getCell()); + } } - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldZoneName.setText(""); - fieldZoneComment.setText(""); - zoneMap.setSelectedCells((Cell)null); - } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - @Override public void refresh() { Zone zone = getVerifier().getEntity(Zone.class); @@ -74,22 +83,17 @@ // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((ZoneImpl) zone); + setBean(zone); // reload region in map refreshRegionInMap(zoneMap); - - if (getBean() != null) { - setZoneCells(); - zoneMap.setSelectedCells(getBean().getCell()); - } } @Override public void setActionButtons() { getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Zone"); + getVerifier().setNewButton(create, Zone.class); getVerifier().setDeleteButton(remove); } @@ -104,27 +108,12 @@ } } } -protected OpenMapEvents getMapListener() { - if (mapListener == null) { - mapListener = new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - getBean().setCell(zoneMap.getSelectedCells()); - if (getBean().getCell() != null){ - zoneCells.setSelectedValues(getBean().getCell().toArray()); - } - return true; - } - }; - } - return mapListener; -} protected void zoneCellsChange(ListSelectionEvent event) { // sans ca, ca boucle (modification depuis la carte) if (event.getValueIsAdjusting()) { // pas a faie dans le cas d'une AS - if (isActif()) { + if (isActive()) { java.util.List<Cell> cells = new ArrayList<Cell>(); for (Object o : zoneCells.getSelectedValues()) { cells.add((Cell) o); @@ -140,87 +129,79 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JSplitPane id="ZoneTab" name="Zones" - oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.name"/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldZoneName" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' - enabled='{isActif()}' decorator='boxed' - onKeyReleased='getBean().setName(fieldZoneName.getText())'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.cells"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> - <JScrollPane> - <!-- FIXME le binding genere un tas d'envenement multiples ! --> - <JList id="zoneCells" enabled='{isActif()}' selectedValues='{getBean().getCell() == null ? null : getBean().getCell().toArray()}' - onValueChanged='zoneCellsChange(event)' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.comments"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.3' weightx='1.0'> - <JScrollPane> - <JTextArea id="fieldZoneComment" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - enabled='{isActif()}' - decorator='boxed' - onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' - javaBean='new com.bbn.openmap.gui.ToolPanel()' - decorator='boxed' - constraints='BorderLayout.NORTH'/> - <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' - javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' - selectionMode="2" - fisheryRegion='{getRegion()}' - selectedCells='{getBean().getCell()}' - decorator='boxed' - constraints='BorderLayout.CENTER'/> - </JPanel> - </JSplitPane> - </cell> - </row> - </Table> + <JPanel id='body'> + <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.name"/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldZoneName" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' + enabled='{isActive()}' decorator='boxed' + onKeyReleased='getBean().setName(fieldZoneName.getText())'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> + <JScrollPane> + <!-- FIXME le binding genere un tas d'envenement multiples ! --> + <JAXXList id="zoneCells" enabled='{isActive()}' selectedValues='{getBean().getCell() == null ? null : getBean().getCell().toArray()}' + onValueChanged='zoneCellsChange(event)' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.comments"/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.3' weightx='1.0'> + <JScrollPane> + <JTextArea id="fieldZoneComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + enabled='{isActive()}' + decorator='boxed' + onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' decorator='boxed'/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' + javaBean='new com.bbn.openmap.gui.ToolPanel()' + decorator='boxed' constraints='BorderLayout.NORTH'/> + <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" + fisheryRegion='{getRegion()}' selectedCells='{getBean().getCell()}' + decorator='boxed' constraints='BorderLayout.CENTER'/> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryDataProvider.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryDataProvider.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryDataProvider.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,64 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input.tree; + +import jaxx.runtime.swing.nav.NavDataProvider; +import fr.ifremer.isisfish.entities.FisheryRegion; + +/** + * Fishery region data provider. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FisheryDataProvider implements NavDataProvider { + + protected FisheryRegion fisheryRegion; + + public FisheryDataProvider(FisheryRegion fisheryRegion) { + this.fisheryRegion = fisheryRegion; + } + + /** + * Get provider fishery region. + * + * @return provide fichery region + */ + public FisheryRegion getFisheryRegion() { + return fisheryRegion; + } + + /* + * @see jaxx.runtime.swing.nav.NavDataProvider#isEnabled() + */ + @Override + public boolean isEnabled() { + return true; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryDataProvider.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,108 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree; + +import static org.nuiton.i18n.I18n._; + +import javax.swing.tree.TreeModel; + +import jaxx.runtime.swing.nav.tree.NavTreeHelper; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.Port; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.entities.Strategy; +import fr.ifremer.isisfish.entities.TripType; +import fr.ifremer.isisfish.entities.VesselType; +import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.ui.input.tree.loadors.CellsNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.GearsNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.MetiersNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.PortsNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.SetOfVesselsNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.SpeciesNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.StrategiesNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.TripTypesNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.VesselTypesNodeLoador; +import fr.ifremer.isisfish.ui.input.tree.loadors.ZonesNodeLoador; + +/** + * Fishery region tree helpers. + * + * @author chatellier + * @since 3.3.1 + */ +public class FisheryTreeHelper extends NavTreeHelper<FisheryTreeNode> { + + public TreeModel createTreeModel(FisheryRegion fisheryRegion) { + + FisheryDataProvider provider = new FisheryDataProvider(fisheryRegion); + setDataProvider(provider); + + // Create root static node + FisheryTreeNode root = new FisheryTreeNode(FisheryRegion.class, + fisheryRegion.getTopiaId(), null, null); + + // first level nodes + FisheryTreeNode cellsChild = new FisheryTreeNode(Cell.class, + _("isisfish.input.tree.cells"), null, new CellsNodeLoador()); + FisheryTreeNode zonesChild = new FisheryTreeNode(Zone.class, + _("isisfish.input.tree.zones"), null, new ZonesNodeLoador()); + FisheryTreeNode portsChild = new FisheryTreeNode(Port.class, + _("isisfish.input.tree.ports"), null, new PortsNodeLoador()); + FisheryTreeNode speciesChild = new FisheryTreeNode(Species.class, + _("isisfish.input.tree.species"), null, new SpeciesNodeLoador()); + FisheryTreeNode gearsChild = new FisheryTreeNode(Gear.class, + _("isisfish.input.tree.gears"), null, new GearsNodeLoador()); + FisheryTreeNode metiersChild = new FisheryTreeNode(Metier.class, + _("isisfish.input.tree.metiers"), null, new MetiersNodeLoador()); + FisheryTreeNode tripTypesChild = new FisheryTreeNode(TripType.class, + _("isisfish.input.tree.triptypes"), null, new TripTypesNodeLoador()); + FisheryTreeNode vesselTypesChild = new FisheryTreeNode(VesselType.class, + _("isisfish.input.tree.vesseltypes"), null, new VesselTypesNodeLoador()); + FisheryTreeNode setOfVesselsChild = new FisheryTreeNode(SetOfVessels.class, + _("isisfish.input.tree.setofvessels"), null, new SetOfVesselsNodeLoador()); + FisheryTreeNode strategiesChild = new FisheryTreeNode(Strategy.class, + _("isisfish.input.tree.strategies"), null, new StrategiesNodeLoador()); + + root.add(cellsChild); + root.add(zonesChild); + root.add(portsChild); + root.add(speciesChild); + root.add(gearsChild); + root.add(metiersChild); + root.add(tripTypesChild); + root.add(vesselTypesChild); + root.add(setOfVesselsChild); + root.add(strategiesChild); + + // Create model + TreeModel model = createModel(root); + + return model; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeNode.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeNode.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeNode.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,57 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input.tree; + +import jaxx.runtime.swing.nav.tree.NavTreeNode; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; + +/** + * Do nothing, just to type strange template. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FisheryTreeNode extends NavTreeNode<FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = -3813351863284748776L; + + /** + * Constructor. + * + * @param internalClass + * @param id + * @param context + * @param childLoador + */ + public FisheryTreeNode(Class<?> internalClass, String id, String context, + NavTreeNodeChildLoador<?, ?, FisheryTreeNode> childLoador) { + super(internalClass, id, context, childLoador); + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeNode.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,133 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input.tree; + +import java.awt.Component; + +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; + +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.FisheryRegionImpl; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.Port; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.entities.Strategy; +import fr.ifremer.isisfish.entities.TripType; +import fr.ifremer.isisfish.entities.VesselType; +import fr.ifremer.isisfish.entities.Zone; + +/** + * Renderer pour les noeud {@link FisheryTreeNode} de l'arbre. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FisheryTreeRenderer extends DefaultTreeCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID = -9045080128695551208L; + + protected FisheryDataProvider provider; + + public FisheryTreeRenderer(FisheryDataProvider provider) { + this.provider = provider; + } + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean sel, boolean expanded, boolean leaf, int row, + boolean hasFocus) { + + String stringValue = null; + if (value instanceof FisheryTreeNode) { + FisheryTreeNode node = (FisheryTreeNode)value; + + if (!node.isStaticNode() || node.isStringNode()) { + stringValue = node.getId(); + } else { + FisheryRegion fisheryRegion = provider.getFisheryRegion(); + TopiaContext topiaContext = ((FisheryRegionImpl)fisheryRegion).getTopiaContext(); + try { + TopiaEntity entity = topiaContext.findByTopiaId(node.getId()); + + if (FisheryRegion.class.isAssignableFrom(entity.getClass())) { + stringValue = ((FisheryRegion)entity).getName(); + } + else if (Cell.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Cell)entity).getName(); + } + else if (Gear.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Gear)entity).getName(); + } + else if (Metier.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Metier)entity).getName(); + } + else if (Population.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Population)entity).getName(); + } + else if (Port.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Port)entity).getName(); + } + else if (SetOfVessels.class.isAssignableFrom(entity.getClass())) { + stringValue = ((SetOfVessels)entity).getName(); + } + else if (Species.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Species)entity).getName(); + } + else if (Strategy.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Strategy)entity).getName(); + } + else if (TripType.class.isAssignableFrom(entity.getClass())) { + stringValue = ((TripType)entity).getName(); + } + else if (VesselType.class.isAssignableFrom(entity.getClass())) { + stringValue = ((VesselType)entity).getName(); + } + else if (Zone.class.isAssignableFrom(entity.getClass())) { + stringValue = ((Zone)entity).getName(); + } + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't get entity for id " + node.getId(), eee); + } + } + } + return super.getTreeCellRendererComponent(tree, stringValue, sel, expanded, leaf, + row, hasFocus); + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/CellsNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/CellsNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/CellsNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Cell tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class CellsNodeLoador extends NavTreeNodeChildLoador<Cell, Cell, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public CellsNodeLoador() { + super(Cell.class); + } + + @Override + public List<Cell> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Cell> cell = fisheryRegion.getCell(); + return cell; + } + + @Override + public FisheryTreeNode createNode(Cell cell, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode cellNode = new FisheryTreeNode( + Cell.class, cell.getTopiaId(), + null, null); + + return cellNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/CellsNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/GearsNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/GearsNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/GearsNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Gear tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class GearsNodeLoador extends NavTreeNodeChildLoador<Gear, Gear, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public GearsNodeLoador() { + super(Gear.class); + } + + @Override + public List<Gear> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Gear> gears = fisheryRegion.getGear(); + return gears; + } + + @Override + public FisheryTreeNode createNode(Gear gear, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode gearNode = new FisheryTreeNode( + Gear.class, gear.getTopiaId(), + null, null); + + return gearNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/GearsNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/MetiersNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/MetiersNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/MetiersNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Metier tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class MetiersNodeLoador extends NavTreeNodeChildLoador<Metier, Metier, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public MetiersNodeLoador() { + super(Metier.class); + } + + @Override + public List<Metier> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Metier> metier = fisheryRegion.getMetier(); + return metier; + } + + @Override + public FisheryTreeNode createNode(Metier metier, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode metierNode = new FisheryTreeNode( + Metier.class, metier.getTopiaId(), + null, null); + + return metierNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/MetiersNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PopulationsNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PopulationsNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PopulationsNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,69 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.ArrayList; +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * SetOfVessels tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class PopulationsNodeLoador extends NavTreeNodeChildLoador<Population, Population, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + protected Species species; + + public PopulationsNodeLoador(Species species) { + super(Population.class); + this.species = species; + } + + @Override + public List<Population> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + List<Population> populations = new ArrayList<Population>(species.getPopulation()); + return populations; + } + + @Override + public FisheryTreeNode createNode(Population population, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode populationNode = new FisheryTreeNode( + Population.class, population.getTopiaId(), + null, null); + + return populationNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PopulationsNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PortsNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PortsNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PortsNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Port; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Port tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class PortsNodeLoador extends NavTreeNodeChildLoador<Port, Port, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public PortsNodeLoador() { + super(Port.class); + } + + @Override + public List<Port> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Port> port = fisheryRegion.getPort(); + return port; + } + + @Override + public FisheryTreeNode createNode(Port port, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode portNode = new FisheryTreeNode( + Port.class, port.getTopiaId(), + null, null); + + return portNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/PortsNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SetOfVesselsNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SetOfVesselsNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SetOfVesselsNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * SetOfVessels tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class SetOfVesselsNodeLoador extends NavTreeNodeChildLoador<SetOfVessels, SetOfVessels, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public SetOfVesselsNodeLoador() { + super(SetOfVessels.class); + } + + @Override + public List<SetOfVessels> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<SetOfVessels> setOfVessel = fisheryRegion.getSetOfVessels(); + return setOfVessel; + } + + @Override + public FisheryTreeNode createNode(SetOfVessels setOfVessel, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode setOfVesselNode = new FisheryTreeNode( + SetOfVessels.class, setOfVessel.getTopiaId(), + null, null); + + return setOfVesselNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SetOfVesselsNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,78 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import static org.nuiton.i18n.I18n._; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Species tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class SpeciesNodeLoador extends NavTreeNodeChildLoador<Species, Species, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public SpeciesNodeLoador() { + super(Species.class); + } + + @Override + public List<Species> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Species> species = fisheryRegion.getSpecies(); + return species; + } + + @Override + public FisheryTreeNode createNode(Species species, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode speciesNode = new FisheryTreeNode( + Species.class, species.getTopiaId(), + null, null); + + // Create clients static nodes + FisheryTreeNode speciesPopulationStaticNode = new FisheryTreeNode( + Population.class, _("isisfish.input.tree.populations"), + null, new PopulationsNodeLoador(species)); + + speciesNode.add(speciesPopulationStaticNode); + + return speciesNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/StrategiesNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/StrategiesNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/StrategiesNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Strategy; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Strategy tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class StrategiesNodeLoador extends NavTreeNodeChildLoador<Strategy, Strategy, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public StrategiesNodeLoador() { + super(Strategy.class); + } + + @Override + public List<Strategy> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Strategy> stategy = fisheryRegion.getStrategy(); + return stategy; + } + + @Override + public FisheryTreeNode createNode(Strategy stategy, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode stategyNode = new FisheryTreeNode( + Strategy.class, stategy.getTopiaId(), + null, null); + + return stategyNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/StrategiesNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/TripTypesNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/TripTypesNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/TripTypesNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.TripType; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * TripType tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class TripTypesNodeLoador extends NavTreeNodeChildLoador<TripType, TripType, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public TripTypesNodeLoador() { + super(TripType.class); + } + + @Override + public List<TripType> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<TripType> tripType = fisheryRegion.getTripType(); + return tripType; + } + + @Override + public FisheryTreeNode createNode(TripType tripType, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode tripTypeNode = new FisheryTreeNode( + TripType.class, tripType.getTopiaId(), + null, null); + + return tripTypeNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/TripTypesNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/VesselTypesNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/VesselTypesNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/VesselTypesNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.VesselType; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * VesselType tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class VesselTypesNodeLoador extends NavTreeNodeChildLoador<VesselType, VesselType, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public VesselTypesNodeLoador() { + super(VesselType.class); + } + + @Override + public List<VesselType> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<VesselType> vesselType = fisheryRegion.getVesselType(); + return vesselType; + } + + @Override + public FisheryTreeNode createNode(VesselType vesselType, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode vesselTypeNode = new FisheryTreeNode( + VesselType.class, vesselType.getTopiaId(), + null, null); + + return vesselTypeNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/VesselTypesNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ZonesNodeLoador.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ZonesNodeLoador.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ZonesNodeLoador.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -0,0 +1,68 @@ +/* + * #%L + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.ui.input.tree.loadors; + +import java.util.List; + +import jaxx.runtime.swing.nav.NavDataProvider; +import jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; +import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; + +/** + * Zone tree path node loader. + * + * @author chatellier + * @since 3.3.1 + */ +public class ZonesNodeLoador extends NavTreeNodeChildLoador<Zone, Zone, FisheryTreeNode> { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6540304326033236054L; + + public ZonesNodeLoador() { + super(Zone.class); + } + + @Override + public List<Zone> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider) throws Exception { + FisheryDataProvider ficheryRegionDataProvider = (FisheryDataProvider)dataProvider; + FisheryRegion fisheryRegion = ficheryRegionDataProvider.getFisheryRegion(); + List<Zone> zone = fisheryRegion.getZone(); + return zone; + } + + @Override + public FisheryTreeNode createNode(Zone zone, NavDataProvider dataProvider) { + + // Create clients static nodes + FisheryTreeNode zoneNode = new FisheryTreeNode( + Zone.class, zone.getTopiaId(), + null, null); + + return zoneNode; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/ZonesNodeLoador.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java 2011-03-12 14:19:01 UTC (rev 3157) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java 2011-03-15 15:50:27 UTC (rev 3158) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -28,10 +28,25 @@ import static org.nuiton.i18n.I18n._; import java.awt.Component; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.swing.JOptionPane; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; import org.jdesktop.swingx.JXErrorPane; import org.jdesktop.swingx.error.ErrorInfo; +import org.jdesktop.swingx.error.ErrorReporter; +import fr.ifremer.isisfish.IsisConfig; +import fr.ifremer.isisfish.IsisFish; + /** * Error helper. * @@ -41,7 +56,7 @@ * Last update : $Date$ * By : $Author$ */ -public class ErrorHelper { +public class ErrorHelper implements ErrorReporter { /** * Display a user friendly error frame. @@ -52,11 +67,13 @@ */ public static void showErrorDialog(Component parent, String message, Throwable cause) { - + JXErrorPane pane = new JXErrorPane(); ErrorInfo info = new ErrorInfo(_("isisfish.error.errorpane.title"), _("isisfish.error.errorpane.htmlmessage", message), null, null, cause, null, null); - JXErrorPane.showDialog(parent, info); + pane.setErrorInfo(info); + pane.setErrorReporter(new ErrorHelper()); + JXErrorPane.showDialog(parent, pane); } /** @@ -77,4 +94,67 @@ public static void showErrorDialog(String message, Throwable cause) { showErrorDialog(null, message, cause); } + + /* + * @see org.jdesktop.swingx.error.ErrorReporter#reportError(org.jdesktop.swingx.error.ErrorInfo) + */ + @Override + public void reportError(ErrorInfo errorInfo) throws NullPointerException { + + MultiPartEmail email = new MultiPartEmail(); + try { + String emailTo = "support at codelutin.com"; + + // smtp + email.setHostName("smtp"); + // to + email.addTo(emailTo, "Support"); + // from + email.setFrom("no-reply at isis-fish.org", "Isis-Fish"); + // subject + email.setSubject("Project error notification : Isis-Fish"); + + // message description + String message = formatMessage("Project", "Isis-Fish " + IsisConfig.getVersion()); + message += formatMessage("Date", new Date().toString()); + message += formatMessage("Title", errorInfo.getTitle()); + message += formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", "")); + + // message configuration + message += formatMessage("Configuration", null); + List<String> propertiesNames = new ArrayList<String>(IsisFish.config.getOptions().stringPropertyNames()); + Collections.sort(propertiesNames); + for (String propertyName : propertiesNames) { + // security, don't send string containing password : + if (!propertyName.contains("pass")) { + message += "\t" + propertyName + " : " + IsisFish.config.getOptions().getProperty(propertyName) + "\n"; + } + } + + // message exception + StringWriter out = new StringWriter(); + PrintWriter writer = new PrintWriter(out); + errorInfo.getErrorException().printStackTrace(writer); + message += formatMessage("Exception", out.toString()); + + // TODO i18n files are iso encoded :( + email.setContent(message, "text/plain; charset=ISO-8859-9"); + + // send mail + email.send(); + + JOptionPane.showMessageDialog(null, "A report message has been sent to " + emailTo); + } catch (EmailException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected String formatMessage(String category, String content) { + String formatted = category + " :\n"; + if (StringUtils.isNotEmpty(content)) { + formatted += "\t" + content + "\n"; + } + return formatted; + } }
participants (1)
-
chatellier@users.labs.libre-entreprise.org