r4218 - in trunk/src: license main/java/fr/ifremer/isisfish/entities main/java/fr/ifremer/isisfish/export main/java/fr/ifremer/isisfish/ui main/java/fr/ifremer/isisfish/ui/input main/java/fr/ifremer/isisfish/ui/input/cell main/java/fr/ifremer/isisfish/ui/input/fisheryregion main/java/fr/ifremer/isisfish/ui/input/gear main/java/fr/ifremer/isisfish/ui/input/metier main/java/fr/ifremer/isisfish/ui/input/observation main/java/fr/ifremer/isisfish/ui/input/population main/java/fr/ifremer/isisf
Author: echatellier Date: 2015-05-07 08:47:11 +0000 (Thu, 07 May 2015) New Revision: 4218 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/4218 Log: Refactor input UIs packaging. Move some script code to handler. Remove a lot of useless model classes. Added: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/RangeOfValuesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/SelectivityUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoSpeciesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesTableModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoZoneUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/observation/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/observation/ObservationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationCapturabilityUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationGroupUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEmigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationImmigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationMigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationPriceUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationRecruitmentUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonSpacializedUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesEditorUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/WizardGroupCreationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/port/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/port/PortUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/FormuleComboRenderer.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionParametersUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesStructuredUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyMonthInfoUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyOneMonthInfoUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/TripTypeUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/vesseltype/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/vesseltype/VesselTypeUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneUI.jaxx trunk/src/test/java/fr/ifremer/isisfish/ui/input/InputSaveVerifierTest.java Removed: trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/ObservationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationPriceUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/ trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/ trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java Modified: trunk/src/license/THIRD-PARTY.properties trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java trunk/src/main/java/fr/ifremer/isisfish/export/ExportInfo.java trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericComboModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericListModel.java trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooserHandler.java trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenManagerFactory.java trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenMarker.java trunk/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java trunk/src/main/resources/i18n/isis-fish_en_GB.properties trunk/src/main/resources/i18n/isis-fish_fr_FR.properties Modified: trunk/src/license/THIRD-PARTY.properties =================================================================== --- trunk/src/license/THIRD-PARTY.properties 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/license/THIRD-PARTY.properties 2015-05-07 08:47:11 UTC (rev 4218) @@ -2,18 +2,21 @@ #------------------------------------------------------------------------------- # Already used licenses in project : # - AL 2.0 +# - ASL, version 2 # - Apache License 2.0 # - Apache License, version 2.0 +# - BSD 2-Clause # - BSD License # - CDDL # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 # - Common Development and Distribution License -# - Common Public License Version 1.0 # - Custom FPL License # - Eclipse Distribution License (EDL), Version 1.0 # - Eclipse Public License (EPL), Version 1.0 # - Eclipse Public License - v 1.0 +# - Eclipse Public License 1.0 # - Eclipse Public License v1.0 +# - FreeBSD # - GNU General Public License - Version 2 with the class path exception # - GNU General Public License, Version 2 with the Classpath Exception # - GNU Lesser General Public Licence @@ -23,6 +26,7 @@ # - GPLv2 # - GPLv2+CE # - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - LGPL, version 2.1 # - Lesser General Public License (LGPL) # - Lesser General Public License (LGPL) v 3.0 # - Lesser General Public License (LPGL) @@ -45,10 +49,10 @@ # Please fill the missing licenses for dependencies : # # -#Tue Nov 11 10:25:22 CET 2014 -#TODO check CERN license +#Tue May 05 18:40:31 CEST 2015 colt--colt--1.2.0=Lesser General Public License (LGPL) commons-jxpath--commons-jxpath--1.3=The Apache Software License, Version 2.0 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD License +net.jcip--jcip-annotations--1.0=The Apache Software License, Version 2.0 org.antlr--antlr-runtime--3.4=BSD License Modified: trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationGroupImpl.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -212,7 +212,7 @@ toStringCache = this.getPopulation() + " Group " + this.getId(); } catch (LazyInitializationException e) { // cette exception se produit quand le toString est appelé par exemple lors - // su lancement d'une population mais que l'entité d'origine a été rechargée + // du lancement d'une population mais que l'entité d'origine a été rechargée // depuis une précédente transation fermé (rechargement d'une simulation // avec ses facteurs) toStringCache = "Unknow Population Group " + this.getId(); Modified: trunk/src/main/java/fr/ifremer/isisfish/export/ExportInfo.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/export/ExportInfo.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/export/ExportInfo.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2015 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 @@ -25,10 +25,6 @@ package fr.ifremer.isisfish.export; -import java.io.Writer; - -import fr.ifremer.isisfish.datastore.SimulationStorage; - /** * Interface que doivent implanter les classes d'export de resultats. * Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -3,7 +3,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2011 - 2015 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 Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,212 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Cell'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Cell id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.n - static org.nuiton.i18n.I18n.t - java.awt.event.MouseEvent - fr.ifremer.isisfish.entities.Cell - com.bbn.openmap.event.SelectMouseMode - fr.ifremer.isisfish.map.CellSelectionLayer - fr.ifremer.isisfish.map.OpenMapEvents - fr.ifremer.isisfish.map.CopyMapToClipboardListener - fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - javax.swing.DefaultComboBoxModel - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Cell' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldCellName" /> - </BeanValidator> - - <script><![CDATA[ -boolean cellChanged = true; - -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueZones")); - setNextPath(n("isisfish.input.tree.zones")); - - //cellMap.init(cellMapInfo); - 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) { - if (getBean() != null) { // impossible de desactiver la carte :( - for (Cell c : cellMap.getSelectedCells()) { - if (!c.getTopiaId().equals(getBean().getTopiaId())) { - fieldCell.setSelectedItem(c); - result = true; - } - } - } - //} - return result; - } - }; - - 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, getFisheryRegion().getCell(), getBean()); - cellChanged = true; - } - } - }); -} - -/*public void refresh() { - Cell cell = getSaveVerifier().getEntity(Cell.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(cell); - - // reload region in map - refreshRegionInMap(cellMap); -}*/ - -protected void fieldCellChanged(ItemEvent event) { - if (cellChanged && event.getStateChange() == ItemEvent.SELECTED) { - Cell c = (Cell)fieldCell.getSelectedItem(); - if (c==null) { - return; - } - Cell oldC = getBean(); - if (oldC != null && c.getTopiaId().equals(oldC.getTopiaId())) { - // avoid reentrant code - return; - } - - // FIXME il ne faut pas appeler le parent - // on ne sais jamais de quel type est le parent - InputUI inputUI = getParentContainer(InputUI.class); - if (inputUI != null) { - inputUI.getHandler().setTreeSelection(this, c.getTopiaId()); - } - else { - SensitivityTabUI sensitivityTabUI = getParentContainer(SensitivityTabUI.class); - sensitivityTabUI.getHandler().setTreeSelection(this, c.getTopiaId()); - } - } -} -]]></script> - <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" onItemStateChanged='fieldCellChanged(event)' - model='{new DefaultComboBoxModel()}' enabled='{getBean() != null}'/> - </cell> - </row> - <row> - <cell> - <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='{isActive()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.cell.latitude" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLatitude" text='{String.valueOf(getBean().getLatitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.cell.longitude" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLongitude" text='{String.valueOf(getBean().getLongitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.cell.land" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActive()}' selected='{getBean().isLand()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal'> - <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='{isActive()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' - selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" - fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()}' - constraints='BorderLayout.CENTER' decorator='boxed' enabled='{getBean() != null}'/> - <com.bbn.openmap.InformationDelegator id="cellMapInfo" constraints='BorderLayout.SOUTH' /> - </JPanel> - </JSplitPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,329 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.EffortDescription id='effortDescription' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - java.util.ArrayList; - fr.ifremer.isisfish.entities.EffortDescription; - fr.ifremer.isisfish.entities.SetOfVessels; - fr.ifremer.isisfish.types.TimeUnit; - fr.ifremer.isisfish.ui.input.model.EffortDescriptionListModel; - fr.ifremer.isisfish.ui.input.renderer.EffortDescriptionListRenderer; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - - <BeanValidator id='validator' context="effortdescriptionparameters" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validatorEffort' context="setofvessels" - bean='{getEffortDescription()}' beanClass='fr.ifremer.isisfish.entities.EffortDescription' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged() || validatorEffort.isChanged()}" - valid="{validator.isValid() && validatorEffort.isValid()}"/> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - setEffortDescription(null); - } - 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); - } - } - }); - addPropertyChangeListener(PROPERTY_EFFORT_DESCRIPTION, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (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) { - // FIX non working binding in jaxx 2.4.1 - if (getEffortDescription().getFishingOperationDuration() == null) { - fieldEffortDescriptionFishingOperationDuration.setText(""); - } - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -/*public void refresh() { - SetOfVessels setOfVessels = getSaveVerifier().getEntity(SetOfVessels.class); - - // twice event for jaxx bindings detection - setBean(null); - setBean(setOfVessels); -}*/ - -protected void effortDescriptionSelectionChanged() { - EffortDescription selectedEffort = (EffortDescription)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); - setEffortDescription(selectedEffort); - - if (getEffortDescription() != null) { - getSaveVerifier().addCurrentEntity(getEffortDescription()); - selectedEffort.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - changeModel.setStayChanged(true); - } - }); - - /* NumberEditor is not working - fieldEffortDescriptionFishingOperation.init(); - fieldEffortDescriptionGearsNumberPerOperation.init(); - fieldEffortDescriptionCrewSize.init(); - fieldEffortDescriptionUnitCostOfFishing.init(); - fieldEffortDescriptionFixedCrewSalary.init(); - fieldEffortDescriptionCrewFoodCost.init(); - fieldEffortDescriptionCrewShareRate.init(); - fieldEffortDescriptionRepairAndMaintenanceGearCost.init(); - fieldEffortDescriptionLandingCosts.init(); - fieldEffortDescriptionOtherRunningCost.init();*/ - } -} - ]]> - </script> - <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(t("isisfish.effortDescription.effortTitle"))}'> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{getEffortDescription() != null}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionFishingOperation' constructorParams='this' - bean='{getEffortDescription()}' property='fishingOperation' - enabled='{isActive()}' decorator='boxed' useSign='true' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperation"'/--> - <JFormattedTextField id="fieldEffortDescriptionFishingOperation" text='{String.valueOf(getEffortDescription().getFishingOperation())}' - onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{getEffortDescription() != null}'/> - </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='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperationDuration"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{getEffortDescription() != null}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionGearsNumberPerOperation' constructorParams='this' - bean='{getEffortDescription()}' property='gearsNumberPerOperation' - enabled='{isActive()}' decorator='boxed' useSign='true' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"GearsNumberPerOperation"'/--> - <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{String.valueOf(getEffortDescription().getGearsNumberPerOperation())}' - onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"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(t("isisfish.effortDescription.economicTitle"))}'> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewSize" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewSize"'/--> - <JTextField id="fieldEffortDescriptionCrewSize" text='{String.valueOf(getEffortDescription().getCrewSize())}' - onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewSize"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"UnitCostOfFishing"'/--> - <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{String.valueOf(getEffortDescription().getUnitCostOfFishing())}' - onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"UnitCostOfFishing"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FixedCrewSalary"'/--> - <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{String.valueOf(getEffortDescription().getFixedCrewSalary())}' - onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FixedCrewSalary"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewFoodCost"'/--> - <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{String.valueOf(getEffortDescription().getCrewFoodCost())}' - onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewFoodCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewShareRate"'/--> - <JTextField id="fieldEffortDescriptionCrewShareRate" text='{String.valueOf(getEffortDescription().getCrewShareRate())}' - onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewShareRate"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{getEffortDescription() != null}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionRepairAndMaintenanceGearCost' constructorParams='this' - bean='{getEffortDescription()}' property='repairAndMaintenanceGearCost' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' - _sensitivityMethod='"RepairAndMaintenanceGearCost"' useSign='true'/--> - <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{String.valueOf(getEffortDescription().getRepairAndMaintenanceGearCost())}' - onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"RepairAndMaintenanceGearCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.landingCosts" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"LandingCosts"'/--> - <JTextField id="fieldEffortDescriptionLandingCosts" text='{String.valueOf(getEffortDescription().getLandingCosts())}' - onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"LandingCosts"'/> - </cell> - </row> - <row> - <cell anchor='northeast' fill='none' weighty='1.0'> - <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{getEffortDescription() != null}'/> - </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' - _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"OtherRunningCost"'/--> - <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{String.valueOf(getEffortDescription().getOtherRunningCost())}' - onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' - enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"OtherRunningCost"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.3'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorEffort.setChanged(false);changeModel.setStayChanged(false)"/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,168 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - - <import> - java.util.ArrayList; - fr.ifremer.isisfish.entities.EffortDescription; - fr.ifremer.isisfish.entities.SetOfVessels; - fr.ifremer.isisfish.entities.Metier; - fr.ifremer.isisfish.ui.input.model.MetierListModel; - fr.ifremer.isisfish.ui.input.renderer.MetierListRenderer; - fr.ifremer.isisfish.ui.input.model.EffortDescriptionListModel; - fr.ifremer.isisfish.ui.input.renderer.EffortDescriptionListRenderer; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - - <BeanValidator id='validator' context="effortdescription" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -/** - * Get input action from context. - */ -protected InputAction getInputAction() { - return getContextValue(InputAction.class); -} - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - MetierListModel metierModel = (MetierListModel)fieldEffortDescriptionMetierList.getModel(); - if (evt.getNewValue() == null) { - metierModel.setMetiers(null); - } - if (evt.getNewValue() != null) { - metierModel.setMetiers(getFisheryRegion().getMetier()); - setEffortDescriptionEffortDescriptionList(); - } - } - }); -} - -/*public void refresh() { - SetOfVessels setOfVessels = getSaveVerifier().getEntity(SetOfVessels.class); - - // twice event for jaxx bindings detection - setBean(null); - setBean(setOfVessels); -}*/ - -protected void onFieldEffortDescriptionMetierListValueChanged() { - // active le bouton seulement si l'interface est active - // dans le cas de sensitivity par exemple - if (isActive()) { - buttonEffortDescriptionAdd.setEnabled(fieldEffortDescriptionMetierList.getSelectedIndex() != -1); - } -} - -protected void onFieldEffortDescriptionEffortDescriptionListValueChanged() { - // active le bouton seulement si l'interface est active - // dans le cas de sensitivity par exemple - if (isActive()) { - removeEffortDescriptionButton.setEnabled(fieldEffortDescriptionEffortDescriptionList.getSelectedIndex() != -1); - } -} - -protected void setEffortDescriptionEffortDescriptionList() { - EffortDescriptionListModel model = new EffortDescriptionListModel(); - if (getBean() != null && getBean().getPossibleMetiers() != null) { - java.util.List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); - model.setEffortDescriptions(effortDescriptions); - } - fieldEffortDescriptionEffortDescriptionList.setModel(model); -} - -protected void addEffortDescriptions() { - Object[] selectedValues = (Object[])fieldEffortDescriptionMetierList.getSelectedValues(); - for (Object selectedValue : selectedValues) { - Metier selectedMetier = (Metier)selectedValue; - getInputAction().addEffortDescription(getBean(), selectedMetier); - } - setEffortDescriptionEffortDescriptionList(); -} -protected void removeEffortDescriptions() { - Object[] selectedValues = (Object[])fieldEffortDescriptionEffortDescriptionList.getSelectedValues(); - for (Object selectedValue : selectedValues) { - EffortDescription selectedEffortDescription = (EffortDescription)selectedValue; - getInputAction().removeEffortDescription(getBean(), selectedEffortDescription); - } - setEffortDescriptionEffortDescriptionList(); -} - ]]> - </script> - <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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,319 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='FisheryRegion'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.FisheryRegion id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.n - static org.nuiton.i18n.I18n.t - fr.ifremer.isisfish.entities.FisheryRegion; - fr.ifremer.isisfish.map.CopyMapToClipboardListener; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - javax.swing.DefaultListModel - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.FisheryRegion' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldRegion" /> - </BeanValidator> - - <script><![CDATA[ - - -protected void $afterCompleteSetup() { - - //cellMap.init(cellMapInfo); - - setButtonTitle(t("isisfish.input.continueCells")); - setNextPath(n("isisfish.input.tree.cells")); - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - - } - if (evt.getNewValue() != null) { - setFieldMapfilesModel(getBean()); - /* numberEditor is not working - fieldLatMin.init(); - fieldLatMax.init(); - fieldLongMin.init(); - fieldLongMax.init(); - fieldCellLengthLatitude.init(); - fieldCellLengthLongitude.init();*/ - } - } - }); -} - -public void refresh() { - FisheryRegion region = getSaveVerifier().getEntity(FisheryRegion.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(region); -} - -protected InputAction getInputAction() { - return getContextValue(InputAction.class); -} - -protected void setFieldMapfilesModel(FisheryRegion region) { - DefaultListModel model = new DefaultListModel(); - java.util.List<String> mapList = region.getMapFileList(); - if (mapList != null) { - int cnt = 0; - for (String map : mapList) { - model.add(cnt, map); - cnt++; - } - } - fieldMapfiles.setModel(model); -} - -protected void addMap() { - getInputAction().addMap(getBean()); - setFieldMapfilesModel(getBean()); -} - -protected void delMap() { - getInputAction().removeMap(getBean(), fieldMapfiles.getSelectedValues()); - setFieldMapfilesModel(getBean()); -} - -/*protected void cellFile() { - getInputAction().loadCellFile(fieldCellFile.getText()); -}*/ - -protected void check() { - getContextValue(InputAction.class).checkFisheryRegion(getBean()); - setInfoText(t("isisfish.message.check.finished")); -} - -protected void save() { - setInfoText(t("isisfish.message.checking.cell")); - - // this make save done by verifier instead of saveFisheryRegion - // and refresh tree is not working - getSaveVerifier().reset(); - - // save generating cells - getInputAction().saveFisheryRegion(getBean()); - - // reload tree - InputUI inputUI = getParentContainer(InputUI.class); - inputUI.getHandler().reloadFisheryTree(inputUI); - - setInfoText(t("isisfish.message.save.finished")); -} - ]]></script> - <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' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="save();validator.setChanged(false)"/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </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()}'> - <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'/> - <com.bbn.openmap.InformationDelegator id="cellMapInfo" constraints='BorderLayout.SOUTH' /> - </JPanel> - </JSplitPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,182 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Gear; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - - <BeanValidator id='validator' context="gear" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldGearName" /> - <field name="effortUnit" component="fieldGearEffortUnit" /> - </BeanValidator> - - <script><![CDATA[ - -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) { - - } - } - }); -} - -/*public void refresh() { - Gear gear = getSaveVerifier().getEntity(Gear.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(gear); - - getVerifier().addCurrentPanel(rangeOfValues); - - // chatellier commented since number editor is not working - //if (getBean() != null) { - // fieldGearStandardisationFactor.init(); - //} -}*/ - ]]></script> - <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' _sensitivityBean='{Gear.class}' - _sensitivityMethod='"StandardisationFactor"' useSign='true'/--> - <JTextField id="fieldGearStandardisationFactor" text='{String.valueOf(getBean().getStandardisationFactor())}' - onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Gear.class}' _sensitivityMethod='"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" bean="{getBean()}" active='{isActive()}' constructorParams='this' - decorator='boxed' _sensitivityBean='{Gear.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Gear.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,84 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Gear'> - - <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - <script><![CDATA[ - -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueMetiers")); - setNextPath(n("isisfish.input.tree.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); -} - -/*public void refresh() { - //getVerifier().addCurrentPanel(gearTabUI, selectivityUI); -}*/ - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - gearTabUI.setLayer(active); - selectivityUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - gearTabUI.resetChangeModel(); - selectivityUI.resetChangeModel(); -} - ]]></script> - <JPanel id="body"> - <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab"> - <tab title='isisfish.gear.title'> - <GearTabUI id="gearTabUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this' /> - </tab> - <tab title='isisfish.selectivity.title'> - <SelectivityUI id="selectivityUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Added: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentHandler.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,101 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 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; + +import java.awt.event.ActionEvent; + +import javax.swing.JComponent; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.persistence.TopiaEntityContextable; + +import fr.ifremer.isisfish.ui.CommonHandler; +import fr.ifremer.isisfish.ui.sensitivity.wizard.FactorWizardUI; +import fr.ifremer.isisfish.ui.sensitivity.wizard.SensitivityWizardHandler; + +/** + * Common handler for all input ui. + */ +public class InputContentHandler<T extends InputContentUI<? extends TopiaEntityContextable>> extends CommonHandler { + + /** Class logger. */ + private static final Log log = LogFactory.getLog(InputContentHandler.class); + + protected T inputContentUI; + + protected void init(final T inputContentUI) { + this.inputContentUI = inputContentUI; + } + + /** + * Action appelée lors du clic sur un layer (sensitivity). + * + * @param inputContentUI inputContentUI + * @param e l'event initial intersepté par le layer + */ + public void accept(InputContentUI<?> inputContentUI, ActionEvent e) { + + // get clicked component info + JComponent source = (JComponent) e.getSource(); + Class<? extends TopiaEntityContextable> sensitivityBeanClass = + (Class<? extends TopiaEntityContextable>)source.getClientProperty("sensitivityBean"); + String sensitivityBeanID = (String)source.getClientProperty("sensitivityBeanID"); + String sensitivityMethod = (String)source.getClientProperty("sensitivityMethod"); + + if (log.isDebugEnabled()) { + log.debug("Event intercepted " + source); + log.debug(" client property (bean) : " + sensitivityBeanClass); + log.debug(" client property (beanID) : " + sensitivityBeanID); + log.debug(" client property (method) : " + sensitivityMethod); + } + + displayFactorWizard(inputContentUI, sensitivityBeanClass, sensitivityBeanID, sensitivityMethod); + } + + public void displayFactorWizard(InputContentUI<?> inputContentUI, Class<? extends TopiaEntityContextable> sensitivityBeanClass, + String sensitivityBeanID, String sensitivityMethod) { + + // get bean for component class info + TopiaEntityContextable bean = null; + if (sensitivityBeanID == null) { + bean = inputContentUI.getSaveVerifier().getEntity(sensitivityBeanClass); + } else { + bean = inputContentUI.getSaveVerifier().getEntity(sensitivityBeanClass, sensitivityBeanID); + } + + if (bean != null) { + FactorWizardUI factorWizardUI = new FactorWizardUI(inputContentUI); + SensitivityWizardHandler handler = factorWizardUI.getHandler(); + handler.initNewFactor(factorWizardUI, bean, sensitivityMethod); + factorWizardUI.pack(); + factorWizardUI.setLocationRelativeTo(inputContentUI); + factorWizardUI.setVisible(true); + } else { + if (log.isErrorEnabled()) { + log.error("Can't find bean in current verifier (sensitivityBeanClass = " + sensitivityBeanClass + ", sensitivityBeanID = " + sensitivityBeanID + ")"); + } + } + } +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric + Copyright (C) 2009 - 2015 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 @@ -24,8 +24,6 @@ --> <JPanel layout='{new BorderLayout()}' genericType='B extends TopiaEntityContextable' abstract="true"> - <InputHandler id="handler" /> - <!-- UI state when editing. If no entity selected, active = false --> <Boolean id='active' javaBean='false'/> @@ -76,13 +74,21 @@ </import> <script><![CDATA[ -/* +/** * Overriden with generic type */ public abstract void setBean(B entity); +/** + * Overriden with generic type + */ public abstract B getBean(); +public <U extends InputContentHandler<? extends InputContentUI<B>>> U getHandler() { + // FIXME remove this and set it abstract + return (U)new InputContentHandler<InputContentUI<B>>(); +} + /** * Pas très safe, le bean doit s'appeler changeModel dans l'heritage "FORCEMENT" * @@ -186,7 +192,7 @@ * * @param tabbedPane tabbed pane to install change listener */ -protected void installChangeListener(JTabbedPane tabbedPane) { +public void installChangeListener(JTabbedPane tabbedPane) { // in fichery input, we must listener for tab switch // to ask user for saving // in sensitivity, fishery can't be saved Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -3,7 +3,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2011 - 2012 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2011 - 2015 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 @@ -26,8 +26,8 @@ import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; -import java.awt.*; -import java.awt.event.ActionEvent; +import java.awt.BorderLayout; +import java.awt.Cursor; import java.awt.event.ItemEvent; import java.io.File; import java.io.IOException; @@ -35,7 +35,6 @@ import java.util.HashMap; import java.util.Map; -import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -45,11 +44,10 @@ import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXContext; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.prompt.PromptSupport; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaEntityContextable; @@ -78,16 +76,28 @@ import fr.ifremer.isisfish.mexico.export.RegionExportFactorXML; import fr.ifremer.isisfish.ui.CommonHandler; import fr.ifremer.isisfish.ui.NavigationUI; +import fr.ifremer.isisfish.ui.input.cell.CellUI; +import fr.ifremer.isisfish.ui.input.fisheryregion.FisheryRegionUI; +import fr.ifremer.isisfish.ui.input.gear.GearUI; +import fr.ifremer.isisfish.ui.input.metier.MetierUI; +import fr.ifremer.isisfish.ui.input.observation.ObservationUI; +import fr.ifremer.isisfish.ui.input.population.PopulationUI; +import fr.ifremer.isisfish.ui.input.port.PortUI; +import fr.ifremer.isisfish.ui.input.setofvessels.SetOfVesselsUI; +import fr.ifremer.isisfish.ui.input.species.SpeciesUI; +import fr.ifremer.isisfish.ui.input.strategy.StrategyUI; 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.input.tree.FisheryTreeSelectionModel; import fr.ifremer.isisfish.ui.input.tree.loadors.PopulationsNodeLoador; +import fr.ifremer.isisfish.ui.input.triptype.TripTypeUI; +import fr.ifremer.isisfish.ui.input.vesseltype.VesselTypeUI; +import fr.ifremer.isisfish.ui.input.zone.ZoneUI; import fr.ifremer.isisfish.ui.models.common.GenericComboModel; -import fr.ifremer.isisfish.ui.sensitivity.wizard.FactorWizardUI; -import fr.ifremer.isisfish.ui.sensitivity.wizard.SensitivityWizardHandler; import fr.ifremer.isisfish.vcs.VCSException; +import jaxx.runtime.JAXXContext; /** * Main handler for fishery edition action. @@ -108,15 +118,24 @@ public class InputHandler extends CommonHandler { /** Class logger. */ - private static Log log = LogFactory.getLog(InputHandler.class); + private static final 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<?>>(); + protected Map<Class<?>, InputContentUI<?>> uiInstanceCache = new HashMap<>(); /** + * Post init ui. + * + * @param ui ui + */ + public void init(InputUI ui) { + PromptSupport.setPrompt(t("isisfish.input.newRegion"), ui.getFieldNewRegion()); + } + + /** * Load region by region name, set it into jaxx context and refresh ui. * * Before loading region, try to close old one. @@ -697,59 +716,7 @@ FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); fisheryTreeHelper.refreshNode(newSelectNode, false); } - - /** - * Action appelée lors du clic sur un layer (sensitivity). - * - * @param inputContentUI inputContentUI - * @param e l'event initial intersepté par le layer - */ - public void accept(InputContentUI<?> inputContentUI, ActionEvent e) { - // get clicked component info - JComponent source = (JComponent) e.getSource(); - Class<? extends TopiaEntityContextable> sensitivityBeanClass = - (Class<? extends TopiaEntityContextable>)source.getClientProperty("sensitivityBean"); - String sensitivityBeanID = (String)source.getClientProperty("sensitivityBeanID"); - String sensitivityMethod = (String)source.getClientProperty("sensitivityMethod"); - - if (log.isDebugEnabled()) { - log.debug("Event intercepted " + source); - log.debug(" client property (bean) : " + sensitivityBeanClass); - log.debug(" client property (beanID) : " + sensitivityBeanID); - log.debug(" client property (method) : " + sensitivityMethod); - } - - displayFactorWizard(inputContentUI, sensitivityBeanClass, sensitivityBeanID, sensitivityMethod); - } - - public void displayFactorWizard(InputContentUI<?> inputContentUI, Class<? extends TopiaEntityContextable> sensitivityBeanClass, - String sensitivityBeanID, String sensitivityMethod) { - - // get bean for component class info - TopiaEntityContextable bean = null; - if (sensitivityBeanID == null) { - bean = inputContentUI.getSaveVerifier().getEntity(sensitivityBeanClass); - } - else { - bean = inputContentUI.getSaveVerifier().getEntity(sensitivityBeanClass, sensitivityBeanID); - } - - if (bean != null) { - FactorWizardUI factorWizardUI = new FactorWizardUI(inputContentUI); - SensitivityWizardHandler handler = factorWizardUI.getHandler(); - handler.initNewFactor(factorWizardUI, bean, sensitivityMethod); - factorWizardUI.pack(); - factorWizardUI.setLocationRelativeTo(inputContentUI); - factorWizardUI.setVisible(true); - } - else { - if (log.isErrorEnabled()) { - log.error("Can't find bean in current verifier (sensitivityBeanClass = " + sensitivityBeanClass + ", sensitivityBeanID = " + sensitivityBeanID + ")"); - } - } - } - /** * Dans le cas d'une creation de population, on doit la creer dans * une espèce. On doit rechercher celle qui est sélectionnée dans l'arbre. Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric + Copyright (C) 2009 - 2015 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 @@ -48,7 +48,7 @@ java.io.File; fr.ifremer.isisfish.entities.Formule; fr.ifremer.isisfish.entities.Equation; - fr.ifremer.isisfish.ui.input.formule.FormuleComboModel; + fr.ifremer.isisfish.ui.models.common.GenericComboModel; org.apache.commons.lang3.StringUtils; org.nuiton.topia.TopiaContext; javax.swing.event.DocumentListener; @@ -190,7 +190,7 @@ java.util.List<Formule> formules = null; if (formuleCategory != null) { formules = getAction().getFormules(isisContext, formuleCategory); - FormuleComboModel formulesModel = new FormuleComboModel(formules); + GenericComboModel formulesModel = new GenericComboModel(formules); formuleComboBox.setModel(formulesModel); // fix default selection formuleComboBox.setSelectedItem(selectedEquation); @@ -249,7 +249,7 @@ </cell> <cell fill='horizontal' weightx='1.0'> <JComboBox id="formuleComboBox" onActionPerformed='formuleChanged()' enabled='{isActive()}' - renderer="{new fr.ifremer.isisfish.ui.input.formule.FormuleComboRenderer()}" /> + renderer="{new fr.ifremer.isisfish.ui.input.renderer.FormuleComboRenderer()}" /> </cell> </row> <row> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -42,10 +42,9 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; -import jaxx.runtime.JAXXUtil; - -import org.apache.commons.beanutils.MethodUtils; +import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang3.ClassUtils; +import org.apache.commons.lang3.reflect.MethodUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; @@ -57,6 +56,7 @@ import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.ui.SaveVerifier; +import jaxx.runtime.JAXXUtil; /** * InputSaveVerifier. @@ -151,24 +151,24 @@ * package >.*" */ public void delete() { - String msg = ""; try { boolean doDelete; TopiaEntityContextable topiaEntity = inputContentUI.getBean(); List<TopiaEntity> allWillBeRemoved = topiaEntity.getComposite(); + if (allWillBeRemoved.size() > 0) { - String label = t("isisfish.message.delete.object", topiaEntity.toString()); + String label = t("isisfish.message.delete.object", toString(topiaEntity)); String text = ""; for (TopiaEntity e : allWillBeRemoved) { text += ClassUtils.getShortClassName(e.getClass()) + " - " - + e.toString() + "\n"; + + toString(e) + "\n"; } int resp = showTextAreaConfirmationMessage(null, label, text, t("isisfish.message.delete.entities"), JOptionPane.YES_NO_OPTION); doDelete = resp == JOptionPane.YES_OPTION; } else { - String text = t("isisfish.message.confirm.delete.object", topiaEntity.toString()); + String text = t("isisfish.message.confirm.delete.object", toString(topiaEntity)); int resp = JOptionPane.showConfirmDialog(null, text, t("isisfish.message.delete.entity"), JOptionPane.YES_NO_OPTION); @@ -182,10 +182,6 @@ noModif(); InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); inputUI.getHandler().deleteTreeNode(inputUI, topiaEntity.getTopiaId()); - - msg = t("isisfish.message.remove.finished"); - } else { - msg = t("isisfish.message.remove.canceled"); } } catch (TopiaException eee) { throw new IsisFishRuntimeException("Can't remove entity: " + currentEntities.get(0), eee); @@ -193,6 +189,24 @@ } /** + * Try to get toString value from entity using entity name (or toString if name is not defined). + * + * @param e entity + * @return + */ + protected String toString(TopiaEntity e) { + String result = null; + + try { + result = (String)BeanUtils.getProperty(e, "name"); + } catch (Exception ex) { + result = e.toString(); + } + + return result; + } + + /** * Create new {@code type} entity. * * @param type Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2014 Ifremer, Code Lutin, Chatellier Eric + Copyright (C) 2009 - 2015 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 @@ -28,6 +28,12 @@ <Boolean id="regionLoaded" javaBean="false" /> + <script><![CDATA[ + protected void $afterCompleteSetup() { + handler.init(this); + } + ]]></script> + <JMenuBar id="menu" constraints='BorderLayout.NORTH'> <JMenu text="isisfish.common.region" id="menuRegion"> <JMenuItem id="menuRegionImport" text="isisfish.input.menu.importRegion" onActionPerformed="getHandler().importRegion(this)" /> @@ -50,37 +56,35 @@ </JMenuBar> <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> <JPanel layout='{new BorderLayout()}' minimumSize="{new java.awt.Dimension(0,0)}"> - <Table constraints='BorderLayout.NORTH'> + <org.jdesktop.swingx.JXComboBox id="fieldCurrentRegion" constraints='BorderLayout.NORTH' + onItemStateChanged='getHandler().regionChange(this, event)' + model='{new fr.ifremer.isisfish.ui.models.common.GenericComboModel<String>(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'/> + <JPanel id="treePanel" name="treePanel" layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'> + <JScrollPane constraints='BorderLayout.CENTER'> + <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)" /> + </JScrollPane> + </JPanel> + <Table constraints='BorderLayout.SOUTH'> <row> <cell fill='horizontal' weightx='1.0'> <JTextField id="fieldNewRegion" /> </cell> <cell fill='horizontal'> - <JButton id="buttonNewRegion" text="isisfish.input.newRegion" + <JButton id="buttonNewRegion" text="isisfish.input.createNewRegion" onActionPerformed='getHandler().createNewRegion(this)' enabled='{getFieldNewRegion().getText().length() > 0}'/> </cell> </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldCurrentRegion" onItemStateChanged='getHandler().regionChange(this, event)' genericType="String" - model='{new fr.ifremer.isisfish.ui.models.common.GenericComboModel<String>(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'/> - </cell> - </row> </Table> - <JPanel id="treePanel" name="treePanel" layout='{new BorderLayout()}'> - <JScrollPane constraints='BorderLayout.CENTER'> - <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)" /> - </JScrollPane> - </JPanel> </JPanel> <java.awt.CardLayout id='cardlayoutPrincipal'/> <JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}' minimumSize="{new java.awt.Dimension(0,0)}"> <JPanel layout='{new BorderLayout()}' constraints='"none"'> - <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> + <JLabel id='selectRegionLabel' enabled="false" font-style="italic" horizontalAlignment="{JLabel.CENTER}" + text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> </JPanel> <JPanel id="inputPane" layout='{new BorderLayout()}' constraints='"normale"'/> </JPanel> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,248 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> - - <fr.ifremer.isisfish.entities.Species id='species' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.MetierSeasonInfo; - fr.ifremer.isisfish.ui.input.model.MetierSeasonInfoComboModel; - fr.ifremer.isisfish.entities.Equation; - fr.ifremer.isisfish.entities.Metier; - fr.ifremer.isisfish.entities.Species; - fr.ifremer.isisfish.entities.TargetSpecies; - fr.ifremer.isisfish.ui.input.model.MetierSeasonInfoTargetSpeciesTableModel; - fr.ifremer.isisfish.ui.input.model.SpeciesComboModel; - fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - java.util.ArrayList - java.util.List - java.awt.Dimension - </import> - - <BeanValidator id='validator' context="metier" - bean='{getMetierSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.MetierSeasonInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged()}" - valid="{validator.isValid()}" /> - - <script><![CDATA[ - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - setSeasonModel(); - setSpecies(null); - setMetierSeasonInfo(null); - setTargetSpeciesModel(); - setTableTargetSpeciesModel(); - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -protected void setSeasonModel() { - List<MetierSeasonInfo> metierSeasonInfo = null; - - if (getBean() != null) { - metierSeasonInfo = getBean().getMetierSeasonInfo(); - } - MetierSeasonInfoComboModel seasonModel = new MetierSeasonInfoComboModel(metierSeasonInfo); - fieldMetierSeasonInfo.setModel(seasonModel); -} - -protected void metierSeasonInfoChanged() { - MetierSeasonInfo selectedMSI = (MetierSeasonInfo)fieldMetierSeasonInfo.getSelectedItem(); - setMetierSeasonInfo(selectedMSI); - if (selectedMSI != null) { - getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); - setTableTargetSpeciesModel(); - } -} - -protected void setTargetSpeciesModel() { - List<Species> species = getFisheryRegion().getSpecies(); - SpeciesComboModel fieldTargetSpeciesModel = new SpeciesComboModel(species); - fieldTargetSpecies.setModel(fieldTargetSpeciesModel); -} - -protected void speciesChanged() { - Species species = (Species)fieldTargetSpecies.getSelectedItem(); - setSpecies(species); -} - -protected void setTableTargetSpeciesModel() { - List<TargetSpecies> targetSpecies = new ArrayList<TargetSpecies>(); - - if (getBean() != null && getMetierSeasonInfo() != null) { - // SpeciesTargetSpecies can be null durring region creation - if (getMetierSeasonInfo().getSpeciesTargetSpecies() != null) { - // move collection to list - // and add all entity to verifier - for (TargetSpecies oneTargetSpecies : getMetierSeasonInfo().getSpeciesTargetSpecies()) { - targetSpecies.add(oneTargetSpecies); - getSaveVerifier().addCurrentEntity(oneTargetSpecies); - oneTargetSpecies.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - changeModel.setStayChanged(true); - } - }); - } - } - } - - // set table model - MetierSeasonInfoTargetSpeciesTableModel model = new MetierSeasonInfoTargetSpeciesTableModel(targetSpecies); - tableTargetSpecies.setModel(model); - tableTargetSpecies.setDefaultRenderer(Equation.class, model); - tableTargetSpecies.setDefaultEditor(Equation.class, new EquationTableEditor()); -} - -protected void add() { - Species selectedSpecies = (Species)fieldTargetSpecies.getSelectedItem(); - if (selectedSpecies != null) { - // il n'y en a pas a la creation de la base - //Formule selectedFormule = (Formule)targetFactor.getFormuleComboBox().getSelectedItem(); - getContextValue(InputAction.class).addTargetSpecies( - getBean(), - getMetierSeasonInfo(), - selectedSpecies, - targetFactor.getEditor().getText(), - fieldPrimaryCatch.isSelected()); - setTableTargetSpeciesModel(); - } -} - -protected void remove() { - // TODO change delete selected truc from model - Object[] targetSpecies = getMetierSeasonInfo().getSpeciesTargetSpecies().toArray(); - - Object o = targetSpecies[tableTargetSpecies.getSelectedRow()]; - if (o != null) { - TargetSpecies ts = (TargetSpecies)o; - getAction().removeTargetSpecies(getMetierSeasonInfo(), ts); - getSaveVerifier().removeCurrentEntity(ts.getTopiaId()); - setTableTargetSpeciesModel(); - } -} - ]]></script> - <JPanel id="body"> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell fill='horizontal'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldMetierSeasonInfo" onItemStateChanged='metierSeasonInfoChanged()' - renderer="{new fr.ifremer.isisfish.ui.input.renderer.MetierSeasonInfoComboRenderer()}" - enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" - enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldTargetSpecies" onItemStateChanged='speciesChanged()' - enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='targetFactor' constructorParams='this' - active='{isActive() && getMetierSeasonInfo() != null}' - text='isisfish.metierSeasonInfoSpecies.targetFactor' - bean='{getMetierSeasonInfo()}' formuleCategory='TargetFactor' - clazz='{fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class}' - decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" - enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' - enabled='{getMetierSeasonInfo() != null && getSpecies() != null}' 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='{getMetierSeasonInfo() != null}' - decorator='boxed'/> - <ListSelectionModel initializer="tableTargetSpecies.getSelectionModel()" - onValueChanged="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> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);changeModel.setStayChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,316 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Metier; - fr.ifremer.isisfish.entities.MetierSeasonInfo; - fr.ifremer.isisfish.entities.Zone; - fr.ifremer.isisfish.types.Month; - fr.ifremer.isisfish.ui.input.model.MetierSeasonInfoComboModel; - fr.ifremer.isisfish.ui.input.model.ZoneListModel; - fr.ifremer.isisfish.ui.widget.Interval; - fr.ifremer.isisfish.ui.widget.IntervalPanel; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - java.util.ArrayList - java.awt.Dimension - </import> - - <BeanValidator id='validator' context="metier" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validatorSeason' context="metier" - bean='{getMetierSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.MetierSeasonInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" - valid="{validator.isValid() && validatorSeason.isValid()}" /> - - <script><![CDATA[ - - 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())); - } - } - }); - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - - } - if (evt.getNewValue() != null) { - refresh(); - } - } - }); - } - - @Override - public void resetChangeModel() { - changeModel.setStayChanged(false); - } - - protected void save() { - getSaveVerifier().save(); - setMetierSeasonInfoCombo(); - } - - protected void create() { - MetierSeasonInfo newMSI = getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); - setMetierSeasonInfo(newMSI); - setMetierSeasonInfoCombo(); - } - - protected void delete() { - getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); - setMetierSeasonInfo(null); - setMetierSeasonInfoCombo(); - } - - public void refresh() { - - if (log.isDebugEnabled()) { - log.debug("Refresh called in ui : " + this); - } - - setMetierSeasonInfo(null); - - if (getBean() != null) { - // Model instanciation - interval = new Interval(); - interval.setMin(0); - interval.setMax(11); - interval.setFirst(0); - interval.setLast(2); - - setMetierSeasonInfoCombo(); - setSeason(); - setMetierZone(); - - ip.setLabelRenderer(Month.MONTH); - ip.setModel(interval); - } - } - - protected void setSeason() { - if (getMetierSeasonInfo() != null) { - - // register selected item in save verifier - getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); - - try { - if (log.isDebugEnabled()) { - log.debug("Refresh interval : "); - } - Month firstMonth = getMetierSeasonInfo().getFirstMonth(); - if (firstMonth != null) { - interval.setFirst(firstMonth.getMonthNumber()); - if (log.isDebugEnabled()) { - log.debug(" first : " + interval.getFirst()); - } - } else { - interval.setFirst(0); - } - - Month lastMonth = getMetierSeasonInfo().getLastMonth(); - if (lastMonth != null) { - interval.setLast(lastMonth.getMonthNumber()); - if (log.isDebugEnabled()) { - log.debug(" last : " + interval.getLast()); - } - } else { - interval.setLast(3); - } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't display season", e); - } - } - } - } - protected void setMetierZone() { - if (getMetierSeasonInfo() != null) { - ListSelectionListener[] listeners = metierZones.getListSelectionListeners(); - for (ListSelectionListener listener : listeners) { - metierZones.removeListSelectionListener(listener); - } - - List<Zone> allZones = getFisheryRegion().getZone(); - ZoneListModel model = new ZoneListModel(allZones); - metierZones.setModel(model); - // restore selection - if (metierSeasonInfo.getZone() != null) { - for (Zone zone : metierSeasonInfo.getZone()) { - int index = allZones.indexOf(zone); - metierZones.getSelectionModel().addSelectionInterval(index, index); - } - } - - for (ListSelectionListener listener : listeners) { - metierZones.addListSelectionListener(listener); - } - } - } - - protected void setMetierSeasonInfoCombo() { - java.util.List<MetierSeasonInfo> metierSeasonInfoList = getBean().getMetierSeasonInfo(); - MetierSeasonInfoComboModel metierSeasonInfoModel = new MetierSeasonInfoComboModel(metierSeasonInfoList); - metierSeasonInfoCombo.setModel(metierSeasonInfoModel); - metierSeasonInfoModel.setSelectedItem(getMetierSeasonInfo()); - } - - protected void metierZonesChanged() { - Object[] selected = metierZones.getSelectedValues(); - java.util.List<Zone> zones = new ArrayList<Zone>(); - for (Object o : selected){ - zones.add((Zone)o); - } - getMetierSeasonInfo().setZone(zones); - } - - protected void seasonChanged() { - init = true; - setMetierSeasonInfo((MetierSeasonInfo)metierSeasonInfoCombo.getSelectedItem()); - setSeason(); - setMetierZone(); - init = false; - } - ]]></script> - <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" onItemStateChanged='seasonChanged()' enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }' - renderer="{new fr.ifremer.isisfish.ui.input.renderer.MetierSeasonInfoComboRenderer()}" /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{getMetierSeasonInfo() != null}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <IntervalPanel id='ip' enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.zone" enabled='{getMetierSeasonInfo() != null}'/> - </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='{getMetierSeasonInfo() != null}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{getMetierSeasonInfo() != null}'/> - </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='{getMetierSeasonInfo() != null}' 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' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="save();validator.setChanged(false);validatorSeason.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!changeModel.isChanged()}" - onActionPerformed="create()"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{getMetierSeasonInfo() != null}" - onActionPerformed="delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,171 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Gear; - fr.ifremer.isisfish.entities.Metier; - fr.ifremer.isisfish.ui.input.model.GearComboModel; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - java.awt.Dimension - </import> - - <BeanValidator id='validator' context="metier" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldMetierName" /> - </BeanValidator> - - <script><![CDATA[ -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; - GearComboModel model = new GearComboModel(getFisheryRegion().getGear()); - fieldMetierGear.setModel(model); - model.setSelectedItem(bean.getGear()); - init = false; - } - } - }); -} - -/*public void refresh() { - - if (log.isDebugEnabled()) { - log.debug("Refresh called in ui : " + this); - } - - Metier metier = getSaveVerifier().getEntity(Metier.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(metier); -}*/ - -protected void gearChanged() { - if (!init) { - getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); - } -} - ]]></script> - <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'> - <JComboBox id="fieldMetierGear" onItemStateChanged='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' - _sensitivityBean='{Metier.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Metier.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,72 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Metier'> - - <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - </import> - -<script><![CDATA[ -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueTripTypes")); - setNextPath(n("isisfish.input.tree.triptypes")); - - // install change listener - // (depends on sensitivity can't be done on constructor) - installChangeListener(metierTab); -} - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - metierTabUI.setLayer(active); - metierSeasonInfoUI.setLayer(active); - metierSeasonSpeciesUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - metierTabUI.resetChangeModel(); - metierSeasonInfoUI.resetChangeModel(); - metierSeasonSpeciesUI.resetChangeModel(); -} - ]]></script> - <JPanel id="body"> - <JTabbedPane id="metierTab" constraints='BorderLayout.CENTER'> - <tab title='isisfish.metier.title'> - <MetierTabUI id="metierTabUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.metierSeasonInfoZone.title'> - <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.metierSeasonInfoSpecies.title'> - <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/ObservationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/ObservationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/ObservationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,178 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI - superGenericType='fr.ifremer.isisfish.entities.Observation'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Observation - id='bean' javaBean='null' /> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - org.nuiton.math.matrix.gui.MatrixPanelEvent - org.nuiton.math.matrix.MatrixND - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Observation' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldObservationName" /> - </BeanValidator> - - <script><![CDATA[ - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldObservationValue.setMatrix(null); - } - if (evt.getNewValue() != null) { - setObservationValueMatrix(); - } - } - }); -} - -protected void setObservationValueMatrix() { - MatrixND prop = getBean().getValue(); - if (prop != null) { - fieldObservationValue.setMatrix(prop.copy()); - } else { - fieldObservationValue.setMatrix(null); - } -} - -protected void createObservationValueMatrix() { - getAction().createObservationValueMatrix(getBean()); - setObservationValueMatrix(); -} - -protected void observationValueMatrixChanged(MatrixPanelEvent event) { - MatrixND mat = fieldObservationValue.getMatrix(); - if (getBean() != null && mat != null) { - getBean().setValue(mat.copy()); - } -} - - ]]></script> - <JPanel id="body"> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.observation.name" enabled='{isActive()}' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldObservationName" - text='{SwingUtil.getStringValue(getBean().getName())}' - onKeyReleased='getBean().setName(fieldObservationName.getText())' - enabled='{isActive()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.observation.comment" - enabled='{isActive()}' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.2' weightx='1.0'> - <JScrollPane> - <JTextArea id="fieldObservationComment" - text='{SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldObservationComment.getText())' - enabled='{isActive()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.observation.value" - enabled='{isActive()}' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='1' weightx='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor - id="fieldObservationValue" onMatrixChanged="observationValueMatrixChanged(event)" - enabled='{isActive()}' decorator='boxed' - _sensitivityBean='{fr.ifremer.isisfish.entities.Observation.class}' - _sensitivityMethod='"Value"' /> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton text="isisfish.common.newMatrix" onActionPerformed='createObservationValueMatrix()' enabled='{isActive()}' decorator='boxed'/> - </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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);" /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()" /> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Observation.class)" /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()" /> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,295 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2012 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - fr.ifremer.isisfish.entities.Species; - fr.ifremer.isisfish.entities.PopulationGroup; - fr.ifremer.isisfish.entities.Population; - javax.swing.table.DefaultTableModel; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - javax.swing.JOptionPane - javax.swing.JFrame - java.awt.BorderLayout - </import> - - <BeanValidator id='validator' context="basics" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldPopulationBasicsName" /> - </BeanValidator> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldPopulationBasicsName.setText(""); - fieldPopulationBasicsGeographicID.setText(""); - fieldPopulationBasicsNbClasses.setText(""); - fieldPopulationBasicsComment.setText(""); - tableAgeLength.setModel(new DefaultTableModel()); - } - if (evt.getNewValue() != null) { - setTableAgeLengthModel(); - } - } - }); -} - -public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - if (getBean() != null) { - setTableAgeLengthModel(); - } - //getSaveVerifier().addCurrentPanel(growthEquation, growthReverseEquation); -} - -/** - * Open creation classe wizard after confirmation. - */ -protected void createGroups() { - - int response = JOptionPane.showConfirmDialog(this, t("isisfish.populationBasics.confirmCreateGroups"), - t("isisfish.common.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); - - if (response == JOptionPane.YES_OPTION) { - JFrame wizardFrame = new JFrame(); - wizardFrame.setLayout(new BorderLayout()); - WizardGroupCreationUI wizard = new WizardGroupCreationUI(this); - wizard.init(this); - wizardFrame.add(wizard, BorderLayout.CENTER); - wizardFrame.setTitle(t("isisfish.wizardGroupCreation.title")); - Species species = getBean().getSpecies(); - wizard.setAgeType(species.isAgeGroupType()); - if (wizard.isAgeType()) { - wizard.setCard("singleGroupAge"); - } else { - wizard.setCard("beginGroupLength"); - } - wizardFrame.pack(); - wizardFrame.setLocationRelativeTo(this); - wizardFrame.setVisible(true); - } - -} - -protected void setTableAgeLengthModel() { - java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup(); - if (popGroup != null){ - DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1); - model.setValueAt("Age", 0, 0); - model.setValueAt("Lengths", 1, 0); - int cnt = 1; - for (PopulationGroup pg : popGroup){ - model.setValueAt(pg.getAge(), 0, cnt); - model.setValueAt(pg.getLength(), 1, cnt); - cnt++; - } - tableAgeLength.setModel(model); - } -} - -protected void create() { - // find species node - InputUI inputUI = getContextValue(InputUI.class, JAXXUtil.PARENT); - Species species = inputUI.getHandler().findSpecies(inputUI); - // create node and select it - Population population = getContextValue(InputAction.class).createPopulation(getTopiaContext(), species); - inputUI.getHandler().insertTreeNode(inputUI, Population.class, population); - setInfoText(t("isisfish.message.creation.finished")); -} - ]]> - </script> - <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='3' 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='3' 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> - <cell fill='horizontal'> - <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" - toolTipText="isisfish.populationBasics.plusGroupTip" - selected='{getBean().isPlusGroup()}' - onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"PlusGroup"'/> - </cell> - </row> - <row> - <cell anchor='east' insets="0"> - <JLabel text="isisfish.populationBasics.groupMin" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' columns='3' insets="0"> - <Table> - <row> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupMin" text='{String.valueOf(getBean().getGroupMin())}' - onKeyReleased='getBean().setGroupMin(Integer.parseInt(fieldPopulationGroupMin.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MinAge"'/> - </cell> - <cell> - <JLabel text="isisfish.populationBasics.groupMax" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupMax" text='{String.valueOf(getBean().getGroupMax())}' - onKeyReleased='getBean().setGroupMax(Integer.parseInt(fieldPopulationGroupMax.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MaxAge"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns='4' fill='both' weightx='1.0'> - <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='4' 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' _sensitivityBean='{Population.class}' _sensitivityMethod='"Growth"'/> - </cell> - </row> - <row> - <cell columns='4' 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' _sensitivityBean='{Population.class}' _sensitivityMethod='"GrowthReverse"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.population.comments" enabled='{isActive()}'/> - </cell> - <cell columns='3' 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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="create()"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,170 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Population - org.nuiton.math.matrix.gui.MatrixPanelEvent - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - org.nuiton.math.matrix.gui.MatrixPanelListener - java.awt.CardLayout - </import> - - <BeanValidator id='validator' context="capturability" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -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()); - } - refreshHidablePanel(); - } - } - }); -} - -protected void populationCapturabilityMatrixChanged(MatrixPanelEvent event) { - if (getBean() != null && fieldPopulationCapturability.getMatrix() != null) { - getBean().setCapturability(fieldPopulationCapturability.getMatrix().copy()); - } -} - -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - if (getBean() != null){ - if (getBean().getCapturability() != null) { - fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); - } - } -}*/ -protected void useEquationChanged() { - getBean().setCapturabilityEquationUsed(fieldUseCapturabilityEquation.isSelected()); - - // compute matrix again to not diplay values computed by equation - if (!fieldUseCapturabilityEquation.isSelected()) { - if (getBean().getCapturability() != null) { - fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); - } - } - refreshHidablePanel(); -} -protected void refreshHidablePanel() { - if (getBean() != null) { - if (getBean().isCapturabilityEquationUsed()) { - fieldUseCapturabilityEquation.setSelected(true); - ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation"); - } - else { - fieldUseCapturabilityEquation.setSelected(false); - ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix"); - } - } -} - ]]> - </script> - <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='horizontal' weightx='1.0' anchor='east'> - <JCheckBox id="fieldUseCapturabilityEquation" selected='{getBean().isCapturabilityEquationUsed()}' - text="isisfish.populationCapturability.useCapturabilityEquation" onActionPerformed='useEquationChanged()' - enabled='{isActive()}' decorator='boxed'/> - </cell> - - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <JPanel id="hidablePanel" layout='{new CardLayout()}'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' - matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"Capturability"' - onMatrixChanged="populationCapturabilityMatrixChanged(event)" - constraints='"fieldUseMatrix"' /> - <InputOneEquationUI id='capturabilityEquation' constructorParams='this' - text='isisfish.common.capturability' active='{isActive()}' - bean='{getBean()}' formuleCategory='Capturability' beanProperty='CapturabilityEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationCapturabilityEquation.class}' - decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"CapturabilityEquation"' - constraints='"fieldUseEquation"'/> - </JPanel> - </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' - text="isisfish.common.save" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,106 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Population; - </import> - - <BeanValidator id='validator' context="equation" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); -}*/ - ]]> - </script> - <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' _sensitivityBean='{Population.class}' _sensitivityMethod='"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' _sensitivityBean='{Population.class}' _sensitivityMethod='"MeanWeight"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='maturityOgive' constructorParams='this' - text='isisfish.populationEquation.MaturityOgive' active="{isActive()}" - bean='{getBean()}' formuleCategory='MaturityOgive' beanProperty='MaturityOgiveEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationMaturityOgiveEquation.class}' - decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MaturityOgiveEquation"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='reproductionRate' constructorParams='this' - text='isisfish.populationEquation.reproductionRate' active="{isActive()}" - bean='{getBean()}' formuleCategory='ReproductionRate' beanProperty='ReproductionRateEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationReproductionRateEquation.class}' - decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"ReproductionRateEquation"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,262 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<!-- -A terme, cette interface sera appelée à disparaitre. - -La plupart des champs de cette interface sont editable ssi -il n'ont pas d'equation associée. - -Dans le cas contraire, les champs sont désactivés, en lecture -seule, et contiennent les resulats des equations en simple -visualisation. ---> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationGroup id='populationGroup' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.PopulationGroup; - fr.ifremer.isisfish.entities.Population; - org.nuiton.math.matrix.MatrixND; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - - <BeanValidator id='validator' context="group" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validatorGroup' context="population" - bean='{getPopulationGroup()}' beanClass='fr.ifremer.isisfish.entities.PopulationGroup' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI" - parentValidator="{getValidator()}"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged() || validatorGroup.isChanged()}" - valid="{validator.isValid() && validatorGroup.isValid()}" /> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - setPopulationGroup(null); - } - if (evt.getNewValue() != null) { - if (getBean().getPopulationGroup() != null) { - jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), 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); - } - if (evt.getNewValue() != null) { - - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -/*public void refresh() { - //if (!isActive()) { - setPopGroupNotNull(false); - //} - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); -}*/ - -protected void setNaturalDeathRateMatrix() { - try { - Population population = getBean(); - MatrixND naturalDeathRateMatrix = population.getNaturalDeathRateMatrix(); - - // extract only line for this population group - MatrixND naturalDeathRateMatrix2 = naturalDeathRateMatrix.getSubMatrix(0, getPopulationGroup()); - fieldPopulationGroupNaturalDeathRate.setMatrix(naturalDeathRateMatrix2.copy()); - } catch (Exception e) { - // can happen if population has no zone yet - // TODO maybe display a message - if (log.isWarnEnabled()) { - log.warn("No zone defined for this population group", e); - } - } -} - -/** - * Called on PopulationGroup combo box selection. - */ -protected void populationGroupChanged() { - PopulationGroup selectedPopulationGroup = (PopulationGroup)populationGroupPopulationGroupComboBox.getSelectedItem(); - setPopulationGroup(selectedPopulationGroup); - if (selectedPopulationGroup != null) { - getSaveVerifier().addCurrentEntity(selectedPopulationGroup); - setNaturalDeathRateMatrix(); - } -} - ]]> - </script> - <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.naturalDeathRate" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='1'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' - enabled='false' decorator='boxed' /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{getPopulationGroup() != null}'/> - </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.maturityOgive" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupMaturityOgive" text='{String.valueOf(getPopulationGroup().getMaturityOgive())}' - enabled="false" decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupReproductionRate" text='{String.valueOf(getPopulationGroup().getReproductionRate())}' - enabled="false" decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.price" enabled='{getPopulationGroup() != null}'/> - </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.age" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- non editable age field --> - <JTextField id="fieldPopulationGroupAge" text='{String.valueOf(getPopulationGroup().getAge())}' - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.length" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable min length field --> - <JTextField id="fieldPopulationGroupMinLength" text='{String.valueOf(getPopulationGroup().getMinLength())}' - toolTipText="isisfish.populationGroup.minimumLength" - enabled='false' decorator='boxed' /> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable max length field --> - <JTextField id="fieldPopulationGroupMaxLength" text='{String.valueOf(getPopulationGroup().getMaxLength())}' - toolTipText="isisfish.populationGroup.maximumLength" - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.comments" enabled='{getPopulationGroup() != null}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='3'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> - <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' - onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{getPopulationGroup() != null}' 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' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorGroup.setChanged(false)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,186 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <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'/> - - <import> - fr.ifremer.isisfish.entities.Population; - fr.ifremer.isisfish.entities.PopulationGroup; - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Zone; - org.nuiton.math.matrix.MatrixND; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - org.nuiton.math.matrix.gui.MatrixPanelListener; - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - populationMigrationEmigrationTable.setMatrix(null); - } - if (evt.getNewValue() != null) { - refreshPanel(); - } - } - }); -} - -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()); -} - -/*public void refresh(){ - Population population = getSaveVerifier().getEntity(Population.class); - - // setBean(null); useless here - setBean(population); - - refreshPanel(); -}*/ - -public void refreshPanel() { - setFieldPopulationMigrationMigrationGroupChooserModel(); - setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); - setAddButton(); -} - -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 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() { - int row = populationMigrationEmigrationTable.getTable().getSelectedRow(); - if (row != -1) { - Object group = populationMigrationEmigrationTable.getTable().getValueAt(row, 0); - Object arrival = populationMigrationEmigrationTable.getTable().getValueAt(row, 1); - - MatrixND mat = popInfo.getEmigrationMatrix().clone(); - mat.setValue(group, arrival, 0); - popInfo.setEmigrationMatrix(mat); - populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); - } -} -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='false'/> - </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)"/> - </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> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,81 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Population; - </import> - - <script><![CDATA[ -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(populationSeasonInfo); -} - -/*public void refresh() { - getSaveVerifier().addCurrentPanel(immigrationEquation, emigrationEquation, migrationEquation); -}*/ - ]]> - </script> - <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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ImmigrationEquation"'/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,182 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <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'/> - - <import> - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - fr.ifremer.isisfish.entities.Population; - fr.ifremer.isisfish.entities.PopulationGroup; - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Zone; - org.nuiton.math.matrix.MatrixND; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - org.nuiton.math.matrix.gui.MatrixPanelListener; - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - populationMigrationImmigrationTable.setMatrix(null); - } - if (evt.getNewValue() != null) { - refreshPanel(); - } - } - }); -} - -protected void populationMigrationImmigrationMatrixChanged(MatrixPanelEvent event) { - if (getPopInfo() != null){ - getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); - } -} - -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(populationSeasonInfo); - - populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); -} - -/*public void refresh(){ - Population population = getVerifier().getEntity(Population.class); - setBean(population); - - refreshPanel(); -}*/ - -public void refreshPanel(){ - setFieldPopulationMigrationMigrationGroupChooserModel(); - setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); - setAddButton(); -} -protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ - if (getBean() != null && getBean().getPopulationGroup() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationImmigrationGroupChooser, getBean().getPopulationGroup(), null, true); - } -} -protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){ - if (getBean() != null && getBean().getPopulationZone() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationImmigrationArrivalZoneChooser, getBean().getPopulationZone(), null, true); - } -} -protected void add() { - getContextValue(InputAction.class).addImmigration(getPopInfo(), - (PopulationGroup) fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem(), - (Zone) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(), - Double.parseDouble(fieldPopulationMigrationImmigrationCoefficient.getText())); - populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().clone()); -} -protected void remove() { - int row = populationMigrationImmigrationTable.getTable().getSelectedRow(); - if (row != -1) { - Object group = populationMigrationImmigrationTable.getTable().getValueAt(row, 0); - Object departure = populationMigrationImmigrationTable.getTable().getValueAt(row, 1); - - MatrixND mat = getPopInfo().getImmigrationMatrix().clone(); - mat.setValue(group, departure, 0); - getPopInfo().setImmigrationMatrix(mat); - populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); - } -} -protected void groupChanged(){ - setGPopSelected(fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem() != null); - setAddButton(); -} -protected void coefChanged(){ - setCoefNonVide(!fieldPopulationMigrationImmigrationCoefficient.getText().equals("")); - setAddButton(); -} -protected void zoneChanged(){ - setZoneDepartSelected(fieldPopulationMigrationImmigrationArrivalZoneChooser.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="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='false'/> - </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)"/> - </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> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,210 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <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='zoneArrivalSelected' javaBean='false'/> - <Boolean id='coefNonVide' javaBean='false'/> - - <import> - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Population; - fr.ifremer.isisfish.entities.PopulationGroup; - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Zone; - org.nuiton.math.matrix.MatrixND; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - org.nuiton.math.matrix.gui.MatrixPanelListener; - javax.swing.text.Document - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - populationMigrationMigrationTable.setMatrix(null); - } - if (evt.getNewValue() != null) { - refreshPanel(); - } - } - }); -} - -protected void populationMigrationMigrationMatrixChanged(MatrixPanelEvent event) { - if (getPopInfo() != null) { - getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix().clone()); - } -} -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); - - populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); -} - -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - // setBean(null); is useless here - setBean(population); - - refreshPanel(); -}*/ - -public void refreshPanel(){ - setFieldPopulationMigrationMigrationGroupChooserModel(); - setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); - setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); - - //setAddButton(); -} -protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ - if (getBean() != null && getBean().getPopulationGroup() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationGroupChooser,getBean().getPopulationGroup(), null, true); - } -} -protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ - if (getBean() != null && getBean().getPopulationZone() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); - } -} -protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){ - if (getBean() != null && getBean().getPopulationZone() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationArrivalZoneChooser,getBean().getPopulationZone(), null, true); - } -} -protected void add(){ - getAction().addMigration(getPopInfo(), - (PopulationGroup) fieldPopulationMigrationMigrationGroupChooser.getSelectedItem(), - (Zone) fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem(), - (Zone) fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem(), - Double.parseDouble(fieldPopulationMigrationMigrationCoefficient.getText())); - populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().clone()); -} -protected void remove() { - int row = populationMigrationMigrationTable.getTable().getSelectedRow(); - if (row != -1) { - Object group = populationMigrationMigrationTable.getTable().getValueAt(row, 0); - Object departure = populationMigrationMigrationTable.getTable().getValueAt(row, 1); - Object arrival = populationMigrationMigrationTable.getTable().getValueAt(row, 2); - - MatrixND mat = getPopInfo().getMigrationMatrix().clone(); - mat.setValue(group, departure, arrival, 0); - getPopInfo().setMigrationMatrix(mat); - populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); - } -} -/*protected void groupChanged(){ - setGPopSelected(fieldPopulationMigrationMigrationGroupChooser.getSelectedItem() != null); - setAddButton(); -} -protected void coefChanged(){ - setCoefNonVide(!fieldPopulationMigrationMigrationCoefficient.getText().equals("")); - setAddButton(); -} -protected void zoneDepartueChanged(){ - setZoneDepartSelected(fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem() != null); - setAddButton(); -} -protected void zoneArrivalChanged(){ - setZoneArrivalSelected(fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem() != null); - setAddButton(); -}*/ -protected void setAddButton() { - add.setEnabled(isActive() && - fieldPopulationMigrationMigrationGroupChooser.getSelectedItem() != null && - !fieldPopulationMigrationMigrationCoefficient.getText().equals("") && - fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem() != null && - fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem() != null); -} - ]]> - </script> - <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()}' - onItemStateChanged="setAddButton()"/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActive()}'/> - <Document initializer="fieldPopulationMigrationMigrationCoefficient.getDocument()" - onInsertUpdate='setAddButton()' - onRemoveUpdate='setAddButton()' /> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JAXXComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActive()}' - onItemStateChanged="setAddButton()"/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JAXXComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActive()}' - onItemStateChanged="setAddButton()"/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='false'/> - </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)" /> - </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> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,223 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.entities.Population; - fr.ifremer.isisfish.ui.input.model.PopulationSeasonInfoComboModel; - fr.ifremer.isisfish.ui.input.renderer.PopulationSeasonInfoComboRenderer; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - java.awt.CardLayout - </import> - - <BeanValidator id='validator' context="migration" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validatorSeason' context="migration" - bean='{getPopInfo()}' beanClass='fr.ifremer.isisfish.entities.PopulationSeasonInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" - valid="{validator.isValid() && validatorSeason.isValid()}" /> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldPopulationMigrationComment.setText(""); - fieldUseEquationMigration.setSelected(false); - } - if (evt.getNewValue() != null) { - refresh(); - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - //setBean(null); - //setBean(population); - - // refresh psi list in combo box - PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); - if (getBean() != null) { - PopulationSeasonInfo previousSelected = (PopulationSeasonInfo)model.getSelectedItem(); - model.setPopulationSeasonInfos(getBean().getPopulationSeasonInfo()); - - // do this to keep selected after cancel/refresh - if (previousSelected != null) { - for (PopulationSeasonInfo psi : getBean().getPopulationSeasonInfo()) { - if (psi.getTopiaId().equals(previousSelected.getTopiaId())) { - model.setSelectedItem(psi); - } - } - } - - seasonChanged(); - } - else { - model.setPopulationSeasonInfos(null); - } -} - -protected void seasonChanged() { - PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); - PopulationSeasonInfo selectedPSI = (PopulationSeasonInfo)model.getSelectedItem(); - setPopInfo(selectedPSI); - if (getPopInfo() != null) { - getSaveVerifier().addCurrentEntity(getPopInfo()); - populationMigrationEquationUI.init(getPopInfo()); - populationMigrationMigrationUI.init(getPopInfo()); - populationMigrationImmigrationUI.init(getPopInfo()); - populationMigrationEmigrationUI.init(getPopInfo()); - } - refreshHidablePanel(); -} -protected void useEquationChanged() { - getPopInfo().setUseEquationMigration(fieldUseEquationMigration.isSelected()); - refreshHidablePanel(); -} -protected void refreshHidablePanel() { - if (getPopInfo() != null) { - if (getPopInfo().isUseEquationMigration()) { - fieldUseEquationMigration.setSelected(true); - ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation"); - } - else { - fieldUseEquationMigration.setSelected(false); - ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix"); - } - } -} -@Override -public void setLayer(boolean active) { - super.setLayer(active); - populationMigrationEquationUI.setLayer(active); -} - ]]> - </script> - <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().isUseEquationMigration()}' - text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' - enabled='{getPopInfo() != null}' 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='{getPopInfo() != null}'> - <tab title='{t("isisfish.populationMigrationMigration.title")}'> - <PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this' decorator='boxed' - bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" - _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"MigrationMatrix"' /> - </tab> - <tab title='{t("isisfish.populationMigrationImmigration.title")}'> - <PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this' decorator='boxed' - bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" - _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ImmigrationMatrix"' /> - </tab> - <tab title='{t("isisfish.populationMigrationEmigration.title")}'> - <PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this' decorator='boxed' - bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" - _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"EmigrationMatrix"' /> - </tab> - </JTabbedPane> - <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this' - bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" /> - </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' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorSeason.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationPriceUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationPriceUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationPriceUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,79 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Population; - </import> - - <BeanValidator id='validator' context="equation" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); -}*/ - ]]> - </script> - <JPanel id="body"> - <Table> - <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' _sensitivityBean='{Population.class}' _sensitivityMethod='"Price"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,177 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2015 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Population; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - org.nuiton.math.matrix.gui.MatrixPanelListener; - </import> - - <BeanValidator id='validator' context="recruitement" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldPopulationMonthGapBetweenReproRecrutement.setText(""); - fieldPopulationRecruitmentComment.setText(""); - } - if (evt.getNewValue() != null) { - - } - } - }); -} - -protected void populationRecruitmentDistributionMatrixChanged(MatrixPanelEvent event) { - if (getBean() != null){ - if (fieldPopulationRecruitmentDistribution.getMatrix() != null){ - getBean().setRecruitmentDistribution(fieldPopulationRecruitmentDistribution.getMatrix().copy()); - } - } -} - -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - if (getBean() != null && getBean().getRecruitmentDistribution() != null) { - fieldPopulationRecruitmentDistribution.setMatrix(getBean().getRecruitmentDistribution().copy()); - - // chatellier : number editor is not working - //fieldPopulationMonthGapBetweenReproRecrutement.init(); - } - - // TODO add only once - //fieldPopulationRecruitmentDistribution.addMatrixListener(listener); -}*/ - ]]> - </script> - <JPanel id='body'> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1'> - <InputOneEquationUI id='reproductionEquation' constructorParams='this' - active="{isActive()}" text='isisfish.populationEquation.reproductionEquation' - bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' - decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"ReproductionEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActive()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' - bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{PopulationImpl.class}' - _sensitivityMethod='"MonthGapBetweenReproRecrutement"'/--> - <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{String.valueOf(getBean().getMonthGapBetweenReproRecrutement())}' - onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MonthGapBetweenReproRecrutement"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActive()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' - matrix='{getBean() == null ? null : bean.getRecruitmentDistribution().copy()}' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"RecruitmentDistribution"' - onMatrixChanged="populationRecruitmentDistributionMatrixChanged(event)" /> - </cell> - <cell> - <JButton icon="table.png" toolTipText="isisfish.common.newMatrix" - onActionPerformed="getAction().createRecruitmentDistribution(getBean())" - enabled='{isActive()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1'> - <InputOneEquationUI id='recruitmentEquation' constructorParams='this' - active="{isActive()}" text='isisfish.populationEquation.recruitmentEquation' - bean='{getBean()}' formuleCategory='Recruitment' beanProperty='RecruitmentEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationRecruitmentEquation.class}' - decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"RecruitmentEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActive()}'/> - </cell> - <cell columns='2' 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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,160 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> - - <Boolean id='ageGroupType' javaBean='false'/> - - <import> - static org.nuiton.i18n.I18n.t - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.ui.util.ErrorHelper; - org.nuiton.math.matrix.MatrixND; - org.nuiton.math.matrix.gui.MatrixPanelEditor; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - org.nuiton.math.matrix.gui.MatrixPanelListener; - javax.swing.JOptionPane - </import> - - <script><![CDATA[ -protected void populationSeasonLengthMatrixChanged(MatrixPanelEvent event) { - if (getPopulationSeasonInfo() != null && matrixPanelPopulationSeasonLengthChange.getMatrix() != null) { - // must be a copy for fire event - MatrixND lengthChangeMatrix = matrixPanelPopulationSeasonLengthChange.getMatrix().copy(); - getPopulationSeasonInfo().setLengthChangeMatrix(lengthChangeMatrix); - } -} - -/*public void refresh() { - // TODO add only once - //matrixPanelPopulationSeasonLengthChange.addMatrixListener(matrixPanelListener); -}*/ - -/** - * Called on spacialized radio button change. - */ -protected void spacializedActionPerformed() { - PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); - boolean spacializedSelection = radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected(); - popInfo.setSimpleLengthChangeMatrix(spacializedSelection); - try { - MatrixND lengthChangeMatrix = popInfo.getLengthChangeMatrix(); - if (lengthChangeMatrix != null) { - if (popInfo.isSimpleLengthChangeMatrix()) { - lengthChangeMatrix = popInfo.unspacializeLengthChangeMatrix(lengthChangeMatrix); - } else { - lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); - } - popInfo.setLengthChangeMatrix(lengthChangeMatrix); - matrixPanelPopulationSeasonLengthChange.setMatrix(lengthChangeMatrix); - } - } catch(Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't (un)spacialize Matrix Change Of Group", eee); - } - ErrorHelper.showErrorDialog(t("isisfish.error.input.spacializematrix"), eee); - } -} - -protected void computeMatrixChangeOfGroup() { - PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); - MatrixND lengthChangeMatrix = popInfo.computeLengthChangeMatrix(); - if (!popInfo.isSimpleLengthChangeMatrix()){ - lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); - } - popInfo.setLengthChangeMatrix(lengthChangeMatrix); -} - -protected void showSpacializedMatrixChangeOfGroup() { - PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); - MatrixND lengthChangeMatrix = popInfo.getLengthChangeMatrix(); - if (popInfo.isSimpleLengthChangeMatrix()) { - lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); - } - MatrixPanelEditor panel = new MatrixPanelEditor(false, 800, 300); - panel.setMatrix(lengthChangeMatrix); - JOptionPane.showMessageDialog(this, panel, t("isisfish.populationSeasons.spacialized.visualisation"), JOptionPane.INFORMATION_MESSAGE); -} - ]]></script> - - <JPanel id='body'> - <Table> - <row> - <cell> - <Panel/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{getPopulationSeasonInfo().isSimpleLengthChangeMatrix()}' - enabled='{getPopulationSeasonInfo() != null}' - text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{!getPopulationSeasonInfo().isSimpleLengthChangeMatrix()}' - enabled='{getPopulationSeasonInfo() != null}' - text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}' - enabled='{getPopulationSeasonInfo() != null}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' - enabled='{getPopulationSeasonInfo() != null}' onActionPerformed='computeMatrixChangeOfGroup()'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" - enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected() && getPopulationSeasonInfo() != null}' - onActionPerformed='showSpacializedMatrixChangeOfGroup()' - visible='{isAgeGroupType()}' decorator='boxed'/> - </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='{getPopulationSeasonInfo() != null}' - _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"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> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,373 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> - - <import> - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - fr.ifremer.isisfish.ui.input.model.PopulationSeasonInfoComboModel - fr.ifremer.isisfish.entities.PopulationSeasonInfo - fr.ifremer.isisfish.types.Month - fr.ifremer.isisfish.entities.Population - fr.ifremer.isisfish.ui.widget.Interval - org.nuiton.math.matrix.MatrixND - org.nuiton.math.matrix.gui.MatrixPanelEvent - org.nuiton.math.matrix.gui.MatrixPanelListener - </import> - - <BeanValidator id='validator' context="seasons" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validatorSeason' context="population" - bean='{getPopulationSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.PopulationSeasonInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI" - parentValidator="{getValidator()}"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" - valid="{validator.isValid() && validatorSeason.isValid()}" /> - - <script><![CDATA[ -protected Interval seasonInterval; - -protected boolean init = false; - -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(); - } - } - }); - - /* - * 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(); - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -protected void create() { - PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); - setPopulationSeasonInfo(seasonNew); - setPopulationSeasonInfoCombo(); -} - -protected void delete() { - getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); - setPopulationSeasonInfo(null); - setPopulationSeasonInfoCombo(); -} - -protected void save() { - getSaveVerifier().save(); - setPopulationSeasonInfoCombo(); -} - -protected void populationSeasonReproductionDistributionMatrixChanged(MatrixPanelEvent event) { - if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { - MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); - if (log.isDebugEnabled()) { - log.debug("Matrix ReproductionDistribution modified : " + reproductionDistribution); - } - getPopulationSeasonInfo().setReproductionDistribution(reproductionDistribution); - } -} - -public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - //setBean(null); - //setBean(population); - - setPopulationSeasonInfo(null); - - // Model instanciation - seasonInterval = new Interval(); - seasonInterval.setMin(0); - seasonInterval.setMax(11); - seasonInterval.setFirst(0); - seasonInterval.setLast(2); - - setPopulationSeasonInfoCombo(); - setSeasonInterval(); - - seasonIntervalPanel.setLabelRenderer(Month.MONTH); - seasonIntervalPanel.setModel(seasonInterval); - - //fieldPopulationSeasonReproductionDistribution.addMatrixListener(matrixPanelListener); - - /*if(getPopulationSeasonInfo() != null) { - PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); - setPopulationSeasonInfo(null); - setPopulationSeasonInfo(popInfo); - getSaveVerifier().addCurrentEntity(getPopulationSeasonInfo()); - }*/ - //getSaveVerifier().addCurrentPanel(populationSeasonSpecializedUI); -} - -protected void setSeasonInterval() { - if(getPopulationSeasonInfo() != null) { - try { - if (log.isDebugEnabled()) { - log.debug("Updating interval : "); - } - Month firstMonth = getPopulationSeasonInfo().getFirstMonth(); - - if (firstMonth != null) { - seasonInterval.setFirst(firstMonth.getMonthNumber()); - - if (log.isDebugEnabled()) { - log.debug(" first : " + seasonInterval.getFirst()); - } - } else { - seasonInterval.setFirst(0); - } - - Month lastMonth = getPopulationSeasonInfo().getLastMonth(); - if (lastMonth != null) { - seasonInterval.setLast(lastMonth.getMonthNumber()); - if (log.isDebugEnabled()) { - log.debug(" last : " + seasonInterval.getLast()); - } - } else { - seasonInterval.setLast(3); - } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't display interval", e); - } - } - } -} - -protected void setPopulationSeasonInfoCombo() { - if (getBean() != null) { - PopulationSeasonInfoComboModel populationSeasonInfoModel = new PopulationSeasonInfoComboModel(getBean().getPopulationSeasonInfo()); - fieldPopulationSeasonInfoChooser.setModel(populationSeasonInfoModel); - populationSeasonInfoModel.setSelectedItem(getPopulationSeasonInfo()); - } -} - -protected void seasonGroupChanged() { - if (getPopulationSeasonInfo() != null) { - getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected()); - } -} - -protected void seasonChanged() { - init = true; - PopulationSeasonInfo seasonInfoSelected = (PopulationSeasonInfo)fieldPopulationSeasonInfoChooser.getSelectedItem(); - if (log.isDebugEnabled()) { - log.debug("Season changed : " + seasonInfoSelected); - } - setPopulationSeasonInfo(seasonInfoSelected); - if (seasonInfoSelected != null) { - getSaveVerifier().addCurrentEntity(seasonInfoSelected); - } - setSeasonInterval(); - setReproductionDistributionMatrix(); - init = false; -} - -protected void setReproductionDistributionMatrix() { - if (getPopulationSeasonInfo() != null){ - MatrixND reproductionDistribution = getPopulationSeasonInfo().getReproductionDistribution(); - // must be a copy (otherwise, modify current entity matrix) - if (reproductionDistribution != null){ - fieldPopulationSeasonReproductionDistribution.setMatrix(reproductionDistribution.copy()); - } - } -} - -// TODO une methode isXXX ne prend pas de parametre -// et ne fait rien -protected boolean isAgeGroupType(boolean result) { - populationSeasonSpecializedUI.setVisible(result); - return result; -} - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - populationSeasonSpecializedUI.setLayer(active); -} - ]]> - </script> - <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'> - <JComboBox id="fieldPopulationSeasonInfoChooser" - onItemStateChanged='seasonChanged()' enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }' - renderer="{new fr.ifremer.isisfish.ui.input.renderer.PopulationSeasonInfoComboRenderer()}"/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.common.season" enabled='{getPopulationSeasonInfo() != null}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' - enabled='{getPopulationSeasonInfo() != null}' 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().isGroupChange()}' - decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"GroupChange"' - onActionPerformed='seasonGroupChanged()' enabled='{getPopulationSeasonInfo() != null}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().isAgeGroupType())}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> - <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' constructorParams='this' bean='{getBean()}' - populationSeasonInfo='{getPopulationSeasonInfo()}' - ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().isAgeGroupType())}'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().isReproduction()}' - onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' - text="isisfish.populationSeasons.Reproduction" enabled='{getPopulationSeasonInfo() != null}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{getPopulationSeasonInfo() != null}' - visible='{getPopulationSeasonInfo().isReproduction()}'/> - </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='{getPopulationSeasonInfo() != null}' - visible='{getPopulationSeasonInfo().isReproduction()}' - decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ReproductionDistribution"' - onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.comments" enabled='{getPopulationSeasonInfo() != null}'/> - </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='{getPopulationSeasonInfo() != null}' 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' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="save();validator.setChanged(false);validatorSeason.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!changeModel.isChanged()}" - onActionPerformed="create()"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{getPopulationSeasonInfo() != null}" - onActionPerformed="delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,120 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2012 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueGears")); - setNextPath(n("isisfish.input.tree.gears")); - - // install change listener - // (depends on sensitivity can't be done on constructor) - installChangeListener(populationTab); -} - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - populationBasicsUI.setLayer(active); - populationZoneUI.setLayer(active); - populationSeasonsUI.setLayer(active); - populationEquationUI.setLayer(active); - populationRecruitementUI.setLayer(active); - populationGroupUI.setLayer(active); - populationCapturabilityUI.setLayer(active); - populationMigrationUI.setLayer(active); - populationPriceUI.setLayer(active); - variablesUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - populationBasicsUI.resetChangeModel(); - populationZoneUI.resetChangeModel(); - populationSeasonsUI.resetChangeModel(); - populationEquationUI.resetChangeModel(); - populationRecruitementUI.resetChangeModel(); - populationGroupUI.resetChangeModel(); - populationCapturabilityUI.resetChangeModel(); - populationMigrationUI.resetChangeModel(); - populationPriceUI.resetChangeModel(); - variablesUI.resetChangeModel(); -} - ]]> - </script> - <JPanel id='body'> - <JTabbedPane id="populationTab"> - <!-- Saisie des populations --> - <tab title='isisfish.populationBasics.title'> - <PopulationBasicsUI id='populationBasicsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Zones --> - <tab title='isisfish.populationZones.title'> - <PopulationZonesUI id='populationZoneUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Saisons --> - <tab title='isisfish.populationSeasons.title'> - <PopulationSeasonsUI id='populationSeasonsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Saisie des équations --> - <tab title='isisfish.populationEquation.title'> - <PopulationEquationUI id='populationEquationUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Saisie des reproductions --> - <tab title='isisfish.populationRecruitment.title'> - <PopulationRecruitmentUI id='populationRecruitementUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Saisie des groupes de population --> - <tab title='isisfish.populationGroup.title'> - <PopulationGroupUI id='populationGroupUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!--Capturabilité --> - <tab title='isisfish.populationCapturability.title'> - <PopulationCapturabilityUI id='populationCapturabilityUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Migration --> - <tab title='isisfish.populationMigration.title'> - <PopulationMigrationUI id='populationMigrationUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <!-- Price --> - <tab title='isisfish.populationPrice.title'> - <PopulationPriceUI id='populationPriceUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.variables.tabtitle'> - <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI" - bean="{getBean()}" active="{isActive()}" - sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,202 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Zone - fr.ifremer.isisfish.ui.input.model.ZoneListModel - org.nuiton.math.matrix.gui.MatrixPanelEvent - org.nuiton.math.matrix.gui.MatrixPanelListener - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - java.util.List - java.util.ArrayList - java.awt.Dimension - </import> - - <script><![CDATA[ -protected boolean init = false; - -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) { - init = true; - setPopulationZonesPresenceModel(); - setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationMappingZoneReproZoneRecru(); - init = false; - } - } - }); -} - -protected void populationMappingZoneReproZoneRecruMatrixChanged(MatrixPanelEvent event) { - getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().clone()); -} - -/*public void refresh() { - setPopulationZonesPresenceModel(); - setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); - //fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener); - setFieldPopulationMappingZoneReproZoneRecru(); - //fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); -}*/ - -protected void setFieldPopulationMappingZoneReproZoneRecru() { - if (getBean() != null) { - if (getBean().getMappingZoneReproZoneRecru() != null) { - fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy()); - } - } -} -protected void setPopulationZonesPresenceModel() { - if (getBean() != null) { - java.util.List<Zone> zones = getFisheryRegion().getZone(); - setModel(zones, getBean().getPopulationZone(), populationZonesPresence); - } -} -protected void setFieldPopulationZonesReproductionModel(List<Zone> zones) { - if (getBean() != null) { - setModel(zones, getBean().getReproductionZone(), fieldPopulationZonesReproduction); - } -} -protected void setFieldPopulationZonesRecruitmentModel(List<Zone> zones) { - if (getBean() != null) { - setModel(zones, getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment); - } -} - -/** - * Change model of {@code associatedList} with all available zones, but keep - * selection with {@code selectedZones}. - */ -protected void setModel(List<Zone> availableZones, List<Zone> selectedZones, JList associatedList) { - ZoneListModel zoneModel = new ZoneListModel(availableZones); - associatedList.setModel(zoneModel); - - // can be null at population init - if (selectedZones != null) { - for (Zone selectedZone : selectedZones) { - int index = availableZones.indexOf(selectedZone); - associatedList.addSelectionInterval(index, index); - } - } -} - -protected void presenceChanged() { - if (!init) { - getBean().setPopulationZone(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationMappingZoneReproZoneRecru(); - } -} - -protected void reproductionChanged() { - if (!init) { - getBean().setReproductionZone(getSelectedValues(fieldPopulationZonesReproduction)); - setFieldPopulationMappingZoneReproZoneRecru(); - } -} - -protected void recruitementChanged() { - if (!init) { - getBean().setRecruitmentZone(getSelectedValues(fieldPopulationZonesRecruitment)); - setFieldPopulationMappingZoneReproZoneRecru(); - } -} - -/** - * Get selected values for components as list. - */ -protected List<Zone> getSelectedValues(JList component) { - Object[] selectedValues = component.getSelectedValues(); - List<Zone> selectedZone = new ArrayList<Zone>(); - for (Object value : selectedValues) { - selectedZone.add((Zone)value); - } - return selectedZone; -} - ]]> - </script> - <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" onValueChanged='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" onValueChanged='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" onValueChanged='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)" - decorator='boxed' - _sensitivityBean='{fr.ifremer.isisfish.entities.Population.class}' _sensitivityMethod='"MappingZoneReproZoneRecru"' /> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,78 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - - <BeanValidator id='validator' context="zones" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <script><![CDATA[ -/*public void refresh() { - Population population = getSaveVerifier().getEntity(Population.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(population); - - getSaveVerifier().addCurrentPanel(popZones); -}*/ - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - popZones.setLayer(active); -} - ]]> - </script> - <JPanel id='body'> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1'> - <PopulationZonesEditorUI id='popZones' constructorParams='this' - bean='{getBean()}' active='{isActive()}'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,197 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Port'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Port id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - fr.ifremer.isisfish.entities.Port - fr.ifremer.isisfish.entities.Cell - fr.ifremer.isisfish.map.CellSelectionLayer - fr.ifremer.isisfish.map.CopyMapToClipboardListener - fr.ifremer.isisfish.map.OpenMapEvents - com.bbn.openmap.event.SelectMouseMode - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - java.awt.event.MouseEvent - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Port' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldPortName" /> - <field name="cell" component="spPortCell" /> - </BeanValidator> - - <script><![CDATA[ -boolean portChanged = true; - -protected void $afterCompleteSetup() { - - //portMap.init(portMapInfo); - new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - if (getBean() != null) { // impossible de desactiver la carte :( - for (Cell c : portMap.getSelectedCells()) { - if (getBean().getCell() != null) { - if (!getBean().getCell().getTopiaId().equals(c.getTopiaId())){ - portCell.setSelectedValue(c); - return true; - } - } - else { - portCell.setSelectedValue(c); - return true; - } - } - } - return true; - } - }; - - setButtonTitle(t("isisfish.input.continueSpecies")); - setNextPath(n("isisfish.input.tree.species")); - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldPortName.setText(""); - fieldPortComment.setText(""); - } - if (evt.getNewValue() != null) { - fillCellList(); - } - } - }); -} - -/*public void refresh() { - Port port = getSaveVerifier().getEntity(Port.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(port); - // reload region in map - refreshRegionInMap(portMap); -}*/ - -protected void fillCellList() { - if (getBean() != null) { - portChanged = false; - portCell.fillList(getFisheryRegion().getCell(), getBean().getCell()); - portCell.setSelectedValue(getBean().getCell()); - portChanged = true; - } -} - -protected void portChanged() { - if (portChanged) { - getBean().setCell((Cell)portCell.getSelectedValue()); - } -} - ]]></script> - <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 id="spPortCell"> - <JAXXList id="portCell" selectedValue='{getBean().getCell()}' selectionMode="0" - onValueChanged='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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Port.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <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='{getFisheryRegion()}' - selectedCells='{getBean() == null ? null : bean.getCell()}' /> - <com.bbn.openmap.InformationDelegator id="portMapInfo" constraints='BorderLayout.SOUTH' /> - </JPanel> - </JSplitPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,100 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.types.RangeOfValues - fr.ifremer.isisfish.entities.Gear - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener - java.util.ArrayList - </import> - - <script><![CDATA[ -boolean init = false; - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldGearParamPossibleValue.setText(""); - } - if (evt.getNewValue() != null) { - java.util.List<Object> values = new ArrayList<Object>(); - for (String value : RangeOfValues.getPossibleTypes()) { - values.add(value); - } - - init = true; - jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); - init = false; - } - } - }); -} - -/*public void refresh() { - Gear gear = getSaveVerifier().getEntity(Gear.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(gear); - - if (getBean() != null) { - java.util.List<Object> values = new ArrayList<Object>(); - for (String value : RangeOfValues.getPossibleTypes()) { - values.add(value); - } - - init = true; - jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); - init = false; - } -}*/ - -protected void gearParamChanged() { - if (fieldGearParamType.getSelectedItem() != null && !init) { - getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); - } -} - ]]></script> - <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> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,215 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.Population id='population' javaBean='null'/> - - <BeanValidator id='validator' context="selectivity" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator.isChanged()}" - valid="{validator.isValid()}" /> - - <import> - fr.ifremer.isisfish.entities.Equation - fr.ifremer.isisfish.entities.Gear - fr.ifremer.isisfish.entities.Population - fr.ifremer.isisfish.entities.Selectivity - fr.ifremer.isisfish.entities.Species - fr.ifremer.isisfish.ui.input.model.GearPopulationSelectivityModel - fr.ifremer.isisfish.ui.input.model.PopulationComboModel - fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - java.util.ArrayList - javax.swing.DefaultComboBoxModel - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - setPopulation(null); - selectivityTable.setModel(new GearPopulationSelectivityModel()); - } - if (evt.getNewValue() != null) { - refresh(); - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -public void refresh() { - - Gear gear = (Gear)getSaveVerifier().getEntity(Gear.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - //setBean(null); - //setBean(gear); - - if (getBean() != null) { - setSelectivityTableModel(); - fieldSelectivityPopulation.setModel(getSelectivityPopulationModel()); - } -} - -protected void setSelectivityTableModel() { - - java.util.List<Selectivity> selectivitiesList = new ArrayList<Selectivity>(); - - // set model even if no selectivity - // to clear data - if (getBean().getPopulationSelectivity() != null) { - // move collection to list - // and add all entity to verifier - for (Selectivity oneSelectivity : getBean().getPopulationSelectivity()) { - getSaveVerifier().addCurrentEntity(oneSelectivity); - selectivitiesList.add(oneSelectivity); - - // hack to enable save button :( - oneSelectivity.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - changeModel.setStayChanged(true); - } - }); - } - } - - // set table model - GearPopulationSelectivityModel model = new GearPopulationSelectivityModel(selectivitiesList); - selectivityTable.setModel(model); - selectivityTable.setDefaultRenderer(Equation.class, model); - selectivityTable.setDefaultEditor(Equation.class, new EquationTableEditor()); -} - -protected void addSelectivity() { - getAction().addSelectivity(getPopulation(), selectivityEquation.getEditor().getText(), getBean()); - setSelectivityTableModel(); -} - -protected void removeSelectivity() { - GearPopulationSelectivityModel model = (GearPopulationSelectivityModel)selectivityTable.getModel(); - Selectivity selectedSelectivity = model.getSelectivities().get(selectivityTable.getSelectedRow()); - getAction().removeSelectivity(getBean(), selectedSelectivity); - getSaveVerifier().removeCurrentEntity(selectedSelectivity.getTopiaId()); - setSelectivityTableModel(); - removeSelectivityButton.setEnabled(false); -} - -protected DefaultComboBoxModel getSelectivityPopulationModel() { - java.util.List<Species> species = getFisheryRegion().getSpecies(); - java.util.List<Population> populations = new ArrayList<Population>(); - if (species != null) { - for (Species s : species) { - if (s.getPopulation() != null) { - populations.addAll(s.getPopulation()); - } - } - } - PopulationComboModel selectivityPopulationModel = new PopulationComboModel(populations); - return selectivityPopulationModel; -} - -protected void selectivityChanged() { - setPopulation((Population)fieldSelectivityPopulation.getSelectedItem()); -} - ]]></script> - <JPanel id='body'> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> - <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" onItemStateChanged='selectivityChanged()' - enabled='{isActive()}' 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' active='{getPopulation() != null}' - 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='{getPopulation() != null}' 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' /> - <ListSelectionModel initializer='selectivityTable.getSelectionModel()' - onValueChanged="removeSelectivityButton.setEnabled(isActive() && selectivityTable.getSelectedRow() != -1)" /> - </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 fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);changeModel.setStayChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,223 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Port - fr.ifremer.isisfish.entities.VesselType - fr.ifremer.isisfish.entities.SetOfVessels - fr.ifremer.isisfish.ui.input.model.PortComboModel - fr.ifremer.isisfish.ui.input.model.VesselTypeComboModel - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - </import> - - <BeanValidator id='validator' context="basics" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldSetOfVesselsName" /> - </BeanValidator> - - <script><![CDATA[ -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; - - PortComboModel modelPort = new PortComboModel(getFisheryRegion().getPort()); - fieldSetOfVesselsPort.setModel(modelPort); - fieldSetOfVesselsPort.setSelectedItem(getBean().getPort()); - - VesselTypeComboModel modelVessel = new VesselTypeComboModel(getFisheryRegion().getVesselType()); - fieldSetOfVesselsVesselType.setModel(modelVessel); - fieldSetOfVesselsVesselType.setSelectedItem(getBean().getVesselType()); - - init=false; - } - } - }); -} - -/*public void refresh() { - SetOfVessels setOfVessels = (SetOfVessels)getSaveVerifier().getEntity(SetOfVessels.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(setOfVessels); - - if (getBean() != null) { - init = true; - jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsPort,getFisheryRegion().getPort(), getBean().getPort(), true); - jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsVesselType,getFisheryRegion().getVesselType(), getBean().getVesselType(), true); - init=false; - getSaveVerifier().addCurrentPanel(technicalEfficiency); - - // NumberEditor is not working - //fieldSetOfVesselsNumberOfVessels.init(); - //fieldSetOfVesselsFixedCosts.init(); - } -}*/ - -protected void portChanged() { - if (!init) { - getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem()); - } -} -protected void vesselTypeChanged() { - if (!init) { - getBean().setVesselType((VesselType)fieldSetOfVesselsVesselType.getSelectedItem()); - } -} - ]]> - </script> - <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'> - <JComboBox id="fieldSetOfVesselsPort" onItemStateChanged='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'> - <JComboBox id="fieldSetOfVesselsVesselType" onItemStateChanged='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' - _sensitivityBean='{SetOfVesselsImpl.class}' _sensitivityMethod='"NumberOfVessels"'/--> - <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{String.valueOf(getBean().getNumberOfVessels())}' - onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"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' - _sensitivityBean='{SetOfVesselsImpl.class}' _sensitivityMethod='"FixedCosts"'/--> - <JTextField id="fieldSetOfVesselsFixedCosts" text='{String.valueOf(getBean().getFixedCosts())}' - onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"FixedCosts"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='technicalEfficiency' constructorParams='this' - text='isisfish.setOfVessels.technicalEfficiency' active='{isActive()}' - bean='{getBean()}' formuleCategory='TechnicalEfficiency' beanProperty='TechnicalEfficiencyEquation' - clazz='{fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class}' - decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(SetOfVessels.class)"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,76 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.SetOfVessels'> - - <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - </import> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueStrategies")); - setNextPath(n("isisfish.input.tree.strategies")); - - // install change listener - // (depends on sensitivity can't be done on constructor) - installChangeListener(setOfVesselsTab); -} - -/*public void refresh() { - getSaveVerifier().addCurrentPanel(setOfVesselsBasicsUI, effortDescriptionUI, effortParametersUI); -}*/ - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - setOfVesselsBasicsUI.setLayer(active); - effortDescriptionUI.setLayer(active); - effortParametersUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - setOfVesselsBasicsUI.resetChangeModel(); - effortDescriptionUI.resetChangeModel(); - effortParametersUI.resetChangeModel(); -} - ]]></script> - <JPanel id="body"> - <JTabbedPane id="setOfVesselsTab"> - <tab title='isisfish.setOfVessels.title'> - <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.effortDescription.title'> - <EffortDescriptionUI id='effortDescriptionUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.effortDescription.parametersTitle'> - <EffortDescriptionParametersUI id='effortParametersUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,51 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> - - <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> - - <script><![CDATA[ - protected void dynamicChanged() { - if (getBean() != null) { - getBean().setAgeGroupType(fieldSpeciesDynamicAge.isSelected()); - } - } - ]]> - </script> - <JPanel id='body'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().isAgeGroupType()}' - buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActive()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().isAgeGroupType()}' - buttonGroup="structuredGroup" enabled='{isActive()}'/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,203 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - fr.ifremer.isisfish.entities.Species; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Species' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldSpeciesName" /> - </BeanValidator> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - setButtonTitle(t("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) { - - } - } - }); -} - -@Override -protected void goTo() { - // FIXME il ne faut pas appeler le parent - // on ne sais jamais de quel type est le parent - InputUI inputUI = getParentContainer(InputUI.class); - if (inputUI != null) { - if (getBean() == null) { - inputUI.getHandler().setTreeSelection(this, n("isisfish.input.tree.species"), n("isisfish.input.tree.populations")); - } - else { - inputUI.getHandler().setTreeSelection(this, getBean().getTopiaId(), n("isisfish.input.tree.populations")); - } - } -} - -/*public void refresh() { - Species species = (Species)getSaveVerifier().getEntity(Species.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(species); - - if (getBean() != null) { - setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations"); - // Number Editor is not working - //fieldSpeciesCEE.init(); - } -}*/ - ]]> - </script> - <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' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' _sensitivityBean='{SpeciesImpl.class}' - useSign='true' _sensitivityMethod='"CodeCEE"'/--> - <JTextField id="fieldSpeciesCEE" text='{String.valueOf(getBean().getCodeCEE())}' - onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' - _sensitivityBean='{Species.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Species.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,279 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> - - <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo0' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo1' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo2' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo3' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo4' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo5' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo6' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo7' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo8' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo9' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo10' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo11' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - org.apache.commons.lang3.StringUtils - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - static org.nuiton.i18n.I18n.t - org.nuiton.math.matrix.gui.MatrixPanelEvent - org.nuiton.math.matrix.MatrixND - </import> - - <BeanValidator id='validator' context="month" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <BeanValidator id='validator0' context="month" - bean='{getStrategyMonthInfo0()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator1' context="month" - bean='{getStrategyMonthInfo1()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator2' context="month" - bean='{getStrategyMonthInfo2()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator3' context="month" - bean='{getStrategyMonthInfo3()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator4' context="month" - bean='{getStrategyMonthInfo4()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator5' context="month" - bean='{getStrategyMonthInfo5()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator6' context="month" - bean='{getStrategyMonthInfo6()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator7' context="month" - bean='{getStrategyMonthInfo7()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator8' context="month" - bean='{getStrategyMonthInfo8()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator9' context="month" - bean='{getStrategyMonthInfo9()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator10' context="month" - bean='{getStrategyMonthInfo10()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - <BeanValidator id='validator11' context="month" - bean='{getStrategyMonthInfo11()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - </BeanValidator> - - <ChangeModel id="changeModel" changed="{validator0.isChanged() || validator1.isChanged() || validator2.isChanged() || validator3.isChanged() || validator4.isChanged() || validator5.isChanged() || validator6.isChanged() || validator7.isChanged() || validator8.isChanged() || validator9.isChanged() || validator10.isChanged() || validator11.isChanged()}" - valid="{validator0.isValid() && validator1.isValid() && validator2.isValid() && validator3.isValid() && validator4.isValid() && validator5.isValid() && validator6.isValid() && validator7.isValid() && validator8.isValid() && validator9.isValid() && validator10.isValid() && validator11.isValid()}" /> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - setStrategyMonthInfo0(null); - setStrategyMonthInfo1(null); - setStrategyMonthInfo2(null); - setStrategyMonthInfo3(null); - setStrategyMonthInfo4(null); - setStrategyMonthInfo5(null); - setStrategyMonthInfo6(null); - setStrategyMonthInfo7(null); - setStrategyMonthInfo8(null); - setStrategyMonthInfo9(null); - setStrategyMonthInfo10(null); - setStrategyMonthInfo11(null); - fieldStrategyProportion.setMatrix(null); - } - if (evt.getNewValue() != null) { - setStrategyMonthInfo0(getBean().getStrategyMonthInfo().get(0)); - setStrategyMonthInfo1(getBean().getStrategyMonthInfo().get(1)); - setStrategyMonthInfo2(getBean().getStrategyMonthInfo().get(2)); - setStrategyMonthInfo3(getBean().getStrategyMonthInfo().get(3)); - setStrategyMonthInfo4(getBean().getStrategyMonthInfo().get(4)); - setStrategyMonthInfo5(getBean().getStrategyMonthInfo().get(5)); - setStrategyMonthInfo6(getBean().getStrategyMonthInfo().get(6)); - setStrategyMonthInfo7(getBean().getStrategyMonthInfo().get(7)); - setStrategyMonthInfo8(getBean().getStrategyMonthInfo().get(8)); - setStrategyMonthInfo9(getBean().getStrategyMonthInfo().get(9)); - setStrategyMonthInfo10(getBean().getStrategyMonthInfo().get(10)); - setStrategyMonthInfo11(getBean().getStrategyMonthInfo().get(11)); - setProportionMetierMatrix(); - } - } - }); -} - -@Override -public void resetChangeModel() { - changeModel.setStayChanged(false); -} - -/*@Override -public void refresh() { - //getSaveVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, - // strategyApril, strategyMay, strategyJune, - // strategyJuly, strategyAugust, strategySeptember, - // strategyOctober, strategyNovember, strategyDecember); -}*/ - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - strategyJanuary.setLayer(active); - strategyFebuary.setLayer(active); - strategyMarch.setLayer(active); - strategyApril.setLayer(active); - strategyMay.setLayer(active); - strategyJune.setLayer(active); - strategyJuly.setLayer(active); - strategyAugust.setLayer(active); - strategySeptember.setLayer(active); - strategyOctober.setLayer(active); - strategyNovember.setLayer(active); - strategyDecember.setLayer(active); -} -protected void setProportionMetierMatrix() { - MatrixND prop = getBean().getProportionMetier(); - if (prop != null) { - fieldStrategyProportion.setMatrix(prop.copy()); - } - else { - fieldStrategyProportion.setMatrix(null); - } -} -protected void strategyProportionMatrixChanged(MatrixPanelEvent event) { - MatrixND mat = fieldStrategyProportion.getMatrix(); - if (getBean() != null && mat != null) { - getBean().setProportionMetier(mat.copy()); - } -} - ]]></script> - <JPanel id='body'> - <Table constraints='BorderLayout.CENTER'> - <row> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJanuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo0()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.january"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyFebuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo1()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.february"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMarch' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo2()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.march"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyApril' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo3()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.april"))}' /> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMay' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo4()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.may"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJune' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo5()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.june"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJuly' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo6()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.july"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyAugust' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo7()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.august"))}' /> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategySeptember' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo8()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.september"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyOctober' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo9()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.october"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyNovember' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo10()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.november"))}' /> - </cell> - <cell fill='horizontal' weightx='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyDecember' bean="{getBean()}" active="{isActive()}" constructorParams='this' - strategyMonthInfo="{getStrategyMonthInfo11()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.december"))}' /> - </cell> - </row> - <row> - <cell fill='horizontal' columns="4"> - <JLabel text="isisfish.strategy.proportionMetierLabel" /> - </cell> - </row> - <row> - <cell fill='both' weightx='1' weighty='1' columns="4"> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyProportion" - onMatrixChanged="strategyProportionMatrixChanged(event)" - enabled='{isActive()}' decorator='boxed' - _sensitivityBean='{fr.ifremer.isisfish.entities.Strategy.class}' _sensitivityMethod='"ProportionMetier"'/> - </cell> - </row> - </Table> - <Table constraints='BorderLayout.SOUTH'> - <row> - <cell fill='horizontal' weightx='1'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{changeModel.isValid() && changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validator0.setChanged(false);validator1.setChanged(false);validator2.setChanged(false);validator3.setChanged(false);validator4.setChanged(false);validator5.setChanged(false);validator6.setChanged(false);validator7.setChanged(false);validator8.setChanged(false);validator9.setChanged(false);validator10.setChanged(false);validator11.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='1'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{changeModel.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,119 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> - - <String id="strategieMonthText" javaBean='null'/> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Strategy - fr.ifremer.isisfish.entities.StrategyMonthInfo - fr.ifremer.isisfish.entities.TripType - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - fr.ifremer.isisfish.ui.input.model.TripTypeComboModel - </import> - - <script><![CDATA[ -protected boolean init; - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_STRATEGY_MONTH_INFO, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - - } - if (evt.getNewValue() != null) { - init = true; - refresh(); - init = false; - } - } - }); -} - -public void refresh() { - if (getStrategyMonthInfo() != null) { - numberOfTrips.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); - fieldStrategyMonthInfoMinInactivityDays.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); - - TripTypeComboModel model = new TripTypeComboModel(getFisheryRegion().getTripType()); - fieldStrategyMonthInfoTripType.setModel(model); - fieldStrategyMonthInfoTripType.setSelectedItem(getStrategyMonthInfo().getTripType()); - } - else { - // don't put in addPropertyChangeListener - // if called after, remove content :( - numberOfTrips.setText(""); - fieldStrategyMonthInfoMinInactivityDays.setText(""); - } -} - - ]]></script> - <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'> - <JComboBox id="fieldStrategyMonthInfoTripType" - onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' - renderer='{new fr.ifremer.isisfish.ui.input.renderer.TripTypeListRenderer(true)}' - 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' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"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' - _sensitivityBean='{StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/--> - <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{String.valueOf(getStrategyMonthInfo().getMinInactivityDays())}' - onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,211 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - - <import> - fr.ifremer.isisfish.entities.Strategy - fr.ifremer.isisfish.entities.SetOfVessels - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - fr.ifremer.isisfish.ui.input.model.SetOfVesselsComboModel - </import> - - <BeanValidator id='validator' context="basics" - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldStrategyName" /> - </BeanValidator> - - <script><![CDATA[ -protected boolean init; - -protected void $afterCompleteSetup() { - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldStrategyName.setText(""); - fieldStrategyProportionSetOfVessels.setText(""); - fieldStrategyComment.setText(""); - } - if (evt.getNewValue() != null) { - init = true; - setSetOfVesselsModel(); - init = false; - } - } - }); -} - -/*public void refresh() { - //Strategy strategy = (Strategy)getSaveVerifier().getEntity(Strategy.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - //setBean(null); - //setBean(strategy); - - if (getBean() != null) { - setSetOfVesselsModel(); - //fieldStrategyProportionSetOfVessels.init(); - - // code to replace bindings : - strategyInactivity.setActive(isActive() && getBean().isInactivityEquationUsed()); - - //getSaveVerifier().addCurrentPanel(strategyInactivity); - } - else { - // listener seam to be called after refresh and remove content :( - fieldStrategyName.setText(""); - //fieldStrategyProportionSetOfVessels.setModelText("0.0"); - fieldStrategyProportionSetOfVessels.setText("0.0"); - fieldStrategyComment.setText(""); - - // code to replace bindings : - strategyInactivity.setActive(isActive()); - } -}*/ - -protected void setSetOfVesselsModel() { - SetOfVesselsComboModel modelVessel = new SetOfVesselsComboModel(getFisheryRegion().getSetOfVessels()); - fieldStrategySetOfVessels.setModel(modelVessel); - fieldStrategySetOfVessels.setSelectedItem(getBean().getSetOfVessels()); -} - -protected void setOfVesselsChanged() { - if (!init) { - getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem()); - } -} - ]]></script> - <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'> - <JComboBox id="fieldStrategySetOfVessels" - onItemStateChanged='setOfVesselsChanged()' - 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' - _sensitivityBean='{StrategyImpl.class}' _sensitivityMethod='"ProportionSetOfVessels"'/--> - <JTextField id="fieldStrategyProportionSetOfVessels" text='{String.valueOf(getBean().getProportionSetOfVessels())}' - onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Strategy.class}' _sensitivityMethod='"ProportionSetOfVessels"'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().isInactivityEquationUsed()}' - text="isisfish.strategy.inactivityEquationUsed" - onActionPerformed='getBean().setInactivityEquationUsed(fieldUseEquationInactivity.isSelected())' 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' - active="{isActive() && getBean() != null && bean.isInactivityEquationUsed()}" - bean='{getBean()}' formuleCategory='Inactivity' beanProperty='InactivityEquation' - clazz='{fr.ifremer.isisfish.equation.StrategyInactivityEquation.class}' - decorator='boxed' _sensitivityBean='{Strategy.class}' _sensitivityMethod='"Inactivity"'/> <!-- bindings not work well actif='{getBean().isInactivityEquationUsed()}' --> - </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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Strategy.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,63 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> - - <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - // install change listener - // (depends on sensitivity can't be done on constructor) - installChangeListener(strategyTab); -} - -/*public void refresh() { - getSaveVerifier().addCurrentPanel(strategyMonthInfoUI, strategyTabUI); -}*/ - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - strategyTabUI.setLayer(active); - strategyMonthInfoUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - strategyTabUI.resetChangeModel(); - strategyMonthInfoUI.resetChangeModel(); -} - ]]></script> - <JPanel id="body"> - <JTabbedPane id="strategyTab"> - <tab title='isisfish.strategy.title'> - <StrategyTabUI id='strategyTabUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - <tab title='isisfish.strategyMonthInfo.title'> - <StrategyMonthInfoUI id='strategyMonthInfoUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,161 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='TripType'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.TripType id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - fr.ifremer.isisfish.entities.TripType - fr.ifremer.isisfish.types.TimeUnit - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.TripType' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldTripTypeName" /> - </BeanValidator> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueVesselTypes")); - setNextPath(n("isisfish.input.tree.vesseltypes")); - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldTripTypeName.setText(""); - fieldTripTypeDuration.setText(""); - fieldTripTypeMinTimeBetweenTrip.setText(""); - fieldTripTypeComment.setText(""); - } - if (evt.getNewValue() != null) { - - } - } - }); -} - -/*public void refresh() { - TripType tripType = (TripType)getSaveVerifier().getEntity(TripType.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(tripType); -}*/ - ]]> - </script> - <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' _sensitivityBean='{TripType.class}' _sensitivityMethod='"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' _sensitivityBean='{TripType.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(TripType.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> - Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,276 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='VesselType'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.VesselType id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - fr.ifremer.isisfish.entities.VesselType - fr.ifremer.isisfish.entities.TripType - fr.ifremer.isisfish.types.TimeUnit - fr.ifremer.isisfish.ui.input.model.TripTypeListModel - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.VesselType' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldVesselTypeName" /> - </BeanValidator> - - <script><![CDATA[ -protected boolean init; - -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continueSetOfVessels")); - setNextPath(n("isisfish.input.tree.setofvessels")); - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldVesselTypeName.setText(""); - fieldVesselTypeLength.setText(""); - fieldVesselTypeSpeed.setText(""); - fieldVesselTypeMaxTripDuration.setText(""); - fieldVesselTypeActivityRange.setText(""); - fieldVesselTypeMinCrewSize.setText(""); - fieldVesselTypeSpeed.setText(""); - fieldVesselTypeUnitFuelCostOfTravel.setText(""); - fieldVesselTypeComment.setText(""); - } - if (evt.getNewValue() != null) { - setTripTypeListModel(); - } - } - }); -} - -/*public void refresh() { - VesselType vesselType = getSaveVerifier().getEntity(VesselType.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean(vesselType); - - if (getBean() != null) { - setListModel(); - - // NumberEditor is not working - //fieldVesselTypeLength.init(); - //fieldVesselTypeLength.init(); - //fieldVesselTypeSpeed.init(); - //fieldVesselTypeActivityRange.init(); - //fieldVesselTypeMinCrewSize.init(); - //fieldVesselTypeSpeed.init(); - //fieldVesselTypeUnitFuelCostOfTravel.init(); - } -}*/ - -protected void setTripTypeListModel() { - init = true; - List<TripType> tripTypes = getFisheryRegion().getTripType(); - TripTypeListModel tripTypeModel = new TripTypeListModel(tripTypes); - vesselTypeTripType.setModel(tripTypeModel); - - if (getBean() != null && getBean().getTripType() != null) { - for (TripType tripType : getBean().getTripType()) { - int index = tripTypes.indexOf(tripType); - vesselTypeTripType.addSelectionInterval(index, index); - } - } - init = false; -} -protected void tripTypeChanged() { - if (!init) { - java.util.List<TripType> tripTypes = new java.util.ArrayList<TripType>(); - for (Object o : vesselTypeTripType.getSelectedValues()) { - tripTypes.add((TripType)o); - } - getBean().setTripType(tripTypes); - } -} - ]]></script> - <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' - _sensitivityBean='{VesselType.class}' _sensitivityMethod='"Length"'/--> - <JTextField id="fieldVesselTypeLength" text='{String.valueOf(getBean().getLength())}' enabled='{isActive()}' - onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))' - decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' - _sensitivityBean='{VesselType.class}' _sensitivityMethod='"Speed"'/--> - <JTextField id="fieldVesselTypeSpeed" text='{String.valueOf(getBean().getSpeed())}' enabled='{isActive()}' - onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))' - decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' - _sensitivityBean='{VesselType.class}' _sensitivityMethod='"ActivityRange"'/--> - <JTextField id="fieldVesselTypeActivityRange" text='{String.valueOf(getBean().getActivityRange())}' enabled='{isActive()}' - onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))' - decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' _sensitivityBean='{VesselType.class}' - _sensitivityMethod='"MinCrewSize"'/--> - <JTextField id="fieldVesselTypeMinCrewSize" text='{String.valueOf(getBean().getMinCrewSize())}' enabled='{isActive()}' - onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))' - decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' - _sensitivityBean='{VesselType.class}' _sensitivityMethod='"UnitFuelCostOfTravel"'/--> - <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{String.valueOf(getBean().getUnitFuelCostOfTravel())}' - onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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> - <JList id="vesselTypeTripType" onValueChanged='tripTypeChanged()' - cellRenderer="{new fr.ifremer.isisfish.ui.input.renderer.TripTypeListRenderer()}" - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(VesselType.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,582 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - 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 - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id="wizardGroup" layout='{new BorderLayout()}'> - <import> - org.nuiton.topia.TopiaContext - fr.ifremer.isisfish.IsisFishDAOHelper - fr.ifremer.isisfish.entities.Equation - fr.ifremer.isisfish.entities.Population - fr.ifremer.isisfish.entities.PopulationGroup - fr.ifremer.isisfish.entities.PopulationGroupDAO - java.awt.CardLayout - javax.swing.JFrame - </import> - - <script><![CDATA[ - - protected String current = null; - protected boolean ageType = false; - protected boolean inputType = false; - protected boolean sameSizeType = false; - protected boolean growthCurveType = false; - - protected double first = 0; - protected double last = 0; - - protected String maxLength = ""; - protected int numberOfGroup = 0; - protected double groupSize = 0; - - protected double step = 1; - protected PopulationBasicsUI popBasic; - - public void init(PopulationBasicsUI popBasic) { - this.popBasic = popBasic; - } - - /** - * @return Returns the ageType. - */ - public boolean isAgeType() { - return this.ageType; - } - - /** - * @param ageType The ageType to set. - */ - public void setAgeType(boolean ageType) { - this.ageType = ageType; - } - - /** - * @return Returns the inputType. - */ - public boolean isInputType() { - return this.inputType; - } - - /** - * @param inputType The inputType to set. - */ - public void setInputType(boolean inputType) { - this.inputType = inputType; - } - - /** - * @return Returns the sameSizeType. - */ - public boolean isSameSizeType() { - return this.sameSizeType; - } - - /** - * @param sameSizeType The sameSizeType to set. - */ - public void setSameSizeType(boolean sameSizeType) { - this.sameSizeType = sameSizeType; - } - - /** - * @return Returns the growthCurveType. - */ - public boolean isGrowthCurveType() { - return this.growthCurveType; - } - - /** - * @param growthCurveType The growthCurveType to set. - */ - public void setGrowthCurveType(boolean growthCurveType) { - this.growthCurveType = growthCurveType; - } - - /** - * @return Returns the first. - */ - public double getFirst() { - return this.first; - } - - /** - * @param first The first to set. - */ - public void setFirst(double first) { - this.first = first; - } - - /** - * @return Returns the last. - */ - public double getLast() { - return this.last; - } - - /** - * @param last The last to set. - */ - public void setLast(double last) { - this.last = last; - } - - /** - * @return Returns the maxLength. - */ - public String getMaxLength() { - return this.maxLength; - } - - /** - * @param maxLength The maxLength to set. - */ - public void setMaxLength(String maxLength) { - this.maxLength = maxLength; - } - - /** - * @return Returns the numberOfGroup. - */ - public int getNumberOfGroup() { - return this.numberOfGroup; - } - - /** - * @param numberOfGroup The numberOfGroup to set. - */ - public void setNumberOfGroup(int numberOfGroup) { - this.numberOfGroup = numberOfGroup; - } - - /** - * @return Returns the groupSize. - */ - public double getGroupSize() { - return this.groupSize; - } - - /** - * @param groupSize The groupSize to set. - */ - public void setGroupSize(double groupSize) { - this.groupSize = groupSize; - } - - /** - * @return Returns the step. - */ - public double getStep() { - return this.step; - } - - /** - * @param step The step to set. - */ - public void setStep(double step) { - this.step = step; - } - - public void setCard(String name){ - current = name; - ((CardLayout) wizardPanels.getLayout()).show(wizardPanels, name); - } - protected void prev(){ - if (isAgeType()) { - // do nothing only one panel - } else { - setCard("beginGroupLength"); - } - prev.setEnabled(false); - next.setEnabled(true); - finish.setEnabled(false); - } - protected void next(){ - if (isAgeType()) { - // do nothing only one panel - } else if (isInputType()) { - setCard("endInputGroupLength"); - } else if (isSameSizeType()) { - setCard("endSameSizeGroupLength"); - } else if (isGrowthCurveType()) { - setCard("endGrowthCurveGroupLength"); - } - prev.setEnabled(true); - next.setEnabled(false); - finish.setEnabled(true); - } - protected void finish() { - if (log.isDebugEnabled()) { - log.debug("wizardGroupFinish called"); - } - - try { - Population pop = popBasic.getBean(); - // remove all old group - pop.clearPopulationGroup(); - - TopiaContext isisContext = pop.getTopiaContext(); - PopulationGroupDAO populationGroupDAO = IsisFishDAOHelper.getPopulationGroupDAO(isisContext); - - if (isAgeType()) { - double ageFirst = getFirst(); - double ageLast = getLast(); - for (int id=0; id + ageFirst <= ageLast; id++) { - PopulationGroup group = populationGroupDAO.create(); - group.setId(id); - group.setPopulation(pop); - group.setAge(ageFirst + id); - pop.addPopulationGroup(group); - populationGroupDAO.update(group); - } - } else if (isInputType()) { - double minLength = getFirst(); - String [] values = getMaxLength().split(";"); - for(int i=0; i<values.length; i++){ - if (!"".equals(values[i])) { - double length = Double.parseDouble(values[i]); - PopulationGroup group = populationGroupDAO.create(); - group.setId(i); - group.setPopulation(pop); - group.setMinLength(minLength); - group.setMaxLength(length); - pop.addPopulationGroup(group); - populationGroupDAO.update(group); - minLength = length; - } - } - - } else if (isSameSizeType()) { - double minLength = getFirst(); - int numberOfGroup = getNumberOfGroup(); - double step = getGroupSize(); - if (numberOfGroup < 0){ -// return new OutputView("Error.xml", "error", t("isisfish.error.number.classes.upper.zero")); - } - if (step == 0){ -// return new OutputView("Error.xml", "error", t"isisfish.error.no.null.time.step")); - } - - double maxLength = minLength; - for(int i=0; i<numberOfGroup; i++){ - maxLength = minLength + step; - PopulationGroup group = populationGroupDAO.create(); - group.setId(i); - group.setPopulation(pop); - group.setMinLength(minLength); - group.setMaxLength(maxLength); - pop.addPopulationGroup(group); - populationGroupDAO.update(group); - minLength = maxLength; - } - } else if (isGrowthCurveType()) { - double minLength = getFirst(); - int numberOfGroup = getNumberOfGroup(); - int step = (int)getStep(); - - Equation equation = pop.getGrowth(); - if(equation == null){ -// return new OutputView("Error.xml", "error", t("isisfish.error.growth.equation.before.create.group.population")); - } - double deltat = -1; - double Lmin = minLength; - for(int i=0; i<numberOfGroup; i++){ - // on creer la classe avec une valeur Lmax fausses ... - PopulationGroup group = populationGroupDAO.create(); - group.setId(i); - group.setPopulation(pop); - group.setMinLength(Lmin); - group.setMaxLength(Lmin); - pop.addPopulationGroup(group); - - if(deltat < 0) { - // premier passage, recuperation de l'age minimum - deltat = pop.getAge(minLength, group); - } - // incrementation pour calculer la longueur max de la classe - deltat += step; - - // ... pour pouvoir avoir la classe pour l'equation - double Lmax = pop.getLength(deltat, group); - group.setMaxLength(Lmax); - Lmin = Lmax; - } - } - popBasic.refresh(); - cancel(); - } - catch(Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't create PopulationGroup", e); - } - } - - } - protected void cancel(){ - getParentContainer(JFrame.class).dispose(); - } - protected void refreshChoice(){ - setInputType(beginGroupLengthTypeInput.isSelected()); - setSameSizeType(beginGroupLengthTypeSameSize.isSelected()); - setGrowthCurveType(beginGroupLengthTypeGrowthCurve.isSelected()); - } - protected void stepChanged(){ - if (!fieldStep.getText().equals("")){ - setStep(Double.parseDouble(fieldStep.getText())); - } - } - protected void firstAgeChanged(){ - if (!firstAge.getText().equals("")){ - setFirst(Double.parseDouble(firstAge.getText())); - } - } - protected void lastAgeChanged(){ - if(!lastAge.getText().equals("")){ - setLast(Double.parseDouble(lastAge.getText())); - } - } - protected void firstInputLengthChanged(){ - if(!firstInputLength.getText().equals("")){ - setFirst(Double.parseDouble(firstInputLength.getText())); - } - } - protected void maximalGroupsLengthChanged(){ - if(!maximalGroupsLength.getText().equals("")){ - setMaxLength(maximalGroupsLength.getText()); - } - } - protected void firstSizeLengthChanged(){ - if(!firstSizeLength.getText().equals("")){ - setFirst(Double.parseDouble(firstSizeLength.getText())); - } - } - protected void sameSizeNumberOfGroupChanged(){ - if(!sameSizeNumberOfGroup.getText().equals("")){ - setNumberOfGroup(Integer.parseInt(sameSizeNumberOfGroup.getText())); - } - } - protected void groupWidthChanged(){ - if(!groupWidth.getText().equals("")){ - setGroupSize(Double.parseDouble(groupWidth.getText())); - } - } - protected void growthCurveFirstGroupChanged(){ - if(!growthCurveFirstGroup.getText().equals("")){ - setFirst(Double.parseDouble(growthCurveFirstGroup.getText())); - } - } - protected void fieldNumberOfGroupChanged(){ - if(!fieldNumberOfGroup.getText().equals("")){ - setNumberOfGroup(Integer.parseInt(fieldNumberOfGroup.getText())); - } - } - ]]> - </script> - <JPanel id="wizardPanels" layout='{new CardLayout()}' constraints='BorderLayout.CENTER'> - <Table constraints='"beginGroupLength"'> - <row> - <cell fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.selectGroupLengthType" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeInput" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allValues" onActionPerformed='refreshChoice()'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeSameSize" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allGroupsSameSize" onActionPerformed='refreshChoice()'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JRadioButton id="beginGroupLengthTypeGrowthCurve" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.computedGrowthCurve" onActionPerformed='refreshChoice()'/> - </cell> - </row> - </Table> - <Table constraints='"singleGroupAge"'> - <row> - <cell fill='horizontal' weightx='1.0' columns='2'> - <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.firstAge"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstAge" onFocusLost='firstAgeChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.lastAge"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="lastAge" onFocusLost='lastAgeChanged()'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.firstAgeHelp'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.lastAgeHelp'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.gapBetweenGroupsHelp'/> - </cell> - </row> - </Table> - <Table constraints='"endInputGroupLength"'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.firstLength"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstInputLength" onFocusLost='firstInputLengthChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.maxGroupsLength"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="maximalGroupsLength" onFocusLost='maximalGroupsLengthChanged()'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.maxGroupsLengthHelp"/> - </cell> - </row> - </Table> - <Table constraints='"endSameSizeGroupLength"'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.firstLength"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="firstSizeLength" onFocusLost='firstSizeLengthChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.numberGroup"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="sameSizeNumberOfGroup" onFocusLost='sameSizeNumberOfGroupChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.groupWidth"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="groupWidth" onFocusLost='groupWidthChanged()'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.firstLengthHelp'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.numberGroupHelp'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text='isisfish.wizardGroupCreation.groupWidthHelp'/> - </cell> - </row> - </Table> - <Table constraints='"endGrowthCurveGroupLength"'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.firstGroup"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="growthCurveFirstGroup" onFocusLost='growthCurveFirstGroupChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.numberGroups"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldNumberOfGroup" onFocusLost='fieldNumberOfGroupChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.wizardGroupCreation.timeStep"/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldStep" onFocusLost='stepChanged()'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.wizardGroupCreation.undefinedGrowthEquation"/> - </cell> - </row> - </Table> - </JPanel> - <Table id="navButton" constraints='BorderLayout.SOUTH'> - <row> - <cell fill='horizontal' weightx='0.2'> - <JButton id='prev' enabled='false' text="isisfish.common.prev" onActionPerformed='prev()'/> - </cell> - <cell fill='horizontal' weightx='0.2'> - <JButton id='next' text="isisfish.common.next" onActionPerformed='next()'/> - </cell> - <cell fill='horizontal' weightx='0.2'> - <JButton id='finish' enabled='false' text="isisfish.common.finish" onActionPerformed='finish()'/> - </cell> - <cell fill='horizontal' weightx='0.2'> - <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()'/> - </cell> - </row> - </Table> -</JPanel> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,195 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2012 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> - - <import> - javax.swing.event.ListSelectionEvent - fr.ifremer.isisfish.entities.Cell - fr.ifremer.isisfish.entities.Zone - fr.ifremer.isisfish.map.CellSelectionLayer - fr.ifremer.isisfish.map.CopyMapToClipboardListener - fr.ifremer.isisfish.map.OpenMapEvents - fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel - com.bbn.openmap.event.SelectMouseMode - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - java.awt.event.MouseEvent - java.util.ArrayList - </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldZoneName" /> - <field name="cell" component="spZoneCells" /> - </BeanValidator> - - <script><![CDATA[ -protected void $afterCompleteSetup() { - - //zoneMap.init(zoneMapInfo); - new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - boolean result = false; - if (getBean() != null) { // impossible de desactiver la carte :( - getBean().setCell(zoneMap.getSelectedCells()); - setZoneCells(); - } - return result; - } - }; - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldZoneName.setText(""); - fieldZoneComment.setText(""); - zoneMap.setSelectedCells(); - } - if (evt.getNewValue() != null) { - setZoneCells(); - } - } - }); -} - -protected void setZoneCells() { - if (getBean() != null) { - List<Cell> cells = getFisheryRegion().getCell(); - TopiaEntityListModel model = new TopiaEntityListModel(cells); - zoneCells.setModel(model); - if (getBean().getCell() != null) { - for (Cell selectedCell : getBean().getCell()) { - int index = cells.indexOf(selectedCell); - zoneCells.addSelectionInterval(index, index); - } - } - } -} - -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 (isActive()) { - java.util.List<Cell> cells = new ArrayList<Cell>(); - for (Object o : zoneCells.getSelectedValues()) { - cells.add((Cell) o); - } - getBean().setCell(cells); - } - } -} -]]> - </script> - <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 id="spZoneCells"> - <JList id="zoneCells" enabled='{isActive()}' - 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' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Zone.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' - javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' - selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" - fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}' - decorator='boxed' constraints='BorderLayout.CENTER'/> - <com.bbn.openmap.InformationDelegator id="zoneMapInfo" constraints='BorderLayout.SOUTH' /> - </JPanel> - </JSplitPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,70 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2012 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 - 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% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Zone'> - - <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> - - <import> - static org.nuiton.i18n.I18n.t - static org.nuiton.i18n.I18n.n - </import> - <script><![CDATA[ - -protected void $afterCompleteSetup() { - setButtonTitle(t("isisfish.input.continuePorts")); - setNextPath(n("isisfish.input.tree.ports")); - - // install change listener - // (depends on sensitivity can't be done on constructor) - installChangeListener(zoneTab); -} - -@Override -public void setLayer(boolean active) { - super.setLayer(active); - zoneBasicsUI.setLayer(active); - variablesUI.setLayer(active); -} - -@Override -public void resetChangeModel() { - zoneBasicsUI.resetChangeModel(); - variablesUI.resetChangeModel(); -} - ]]></script> - <JPanel id="body"> - <JTabbedPane constraints='BorderLayout.CENTER' id="zoneTab"> - <tab title='isisfish.zone.title'> - <ZoneBasicsUI id="zoneBasicsUI" bean="{getBean()}" active="{isActive()}" - sensitivity="{isSensitivity()}" constructorParams='this' /> - </tab> - <tab title='isisfish.variables.tabtitle'> - <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI" - bean="{getBean()}" active="{isActive()}" - sensitivity="{isSensitivity()}" constructorParams='this'/> - </tab> - </JTabbedPane> - </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> Added: trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellHandler.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,125 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 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.cell; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +import java.awt.event.ItemEvent; +import java.awt.event.MouseEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.bbn.openmap.event.SelectMouseMode; + +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.map.CellSelectionLayer; +import fr.ifremer.isisfish.map.OpenMapEvents; +import fr.ifremer.isisfish.ui.input.InputContentHandler; +import fr.ifremer.isisfish.ui.input.InputUI; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; + +/** + * Cell handler. + */ +public class CellHandler extends InputContentHandler<CellUI> { + + /** Class logger. */ + private static final Log log = LogFactory.getLog(CellHandler.class); + + protected boolean cellChanged; + + protected void init(final CellUI cellUI) { + super.init(cellUI); + + cellUI.setButtonTitle(t("isisfish.input.continueZones")); + cellUI.setNextPath(n("isisfish.input.tree.zones")); + + //cellMap.init(cellMapInfo); + new OpenMapEvents(cellUI.getCellMap(), 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) { + if (cellUI.getBean() != null) { // impossible de desactiver la carte :( + for (Cell c : cellUI.getCellMap().getSelectedCells()) { + if (!c.getTopiaId().equals(cellUI.getBean().getTopiaId())) { + cellUI.getFieldCell().setSelectedItem(c); + result = true; + } + } + } + //} + return result; + } + }; + + cellUI.addPropertyChangeListener(CellUI.PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + cellUI.fieldCellName.setText(""); + cellUI.fieldCellLatitude.setText(""); + cellUI.fieldCellLongitude.setText(""); + cellUI.fieldCellComment.setText(""); + cellUI.fieldCellLand.setSelected(false); + } + if (evt.getNewValue() != null) { + cellChanged = false; + jaxx.runtime.SwingUtil.fillComboBox(cellUI.fieldCell, cellUI.getFisheryRegion().getCell(), cellUI.getBean()); + cellChanged = true; + } + } + }); + } + + protected void fieldCellChanged(ItemEvent event) { + if (cellChanged && event.getStateChange() == ItemEvent.SELECTED) { + Cell c = (Cell)inputContentUI.fieldCell.getSelectedItem(); + if (c==null) { + return; + } + Cell oldC = inputContentUI.getBean(); + if (oldC != null && c.getTopiaId().equals(oldC.getTopiaId())) { + // avoid reentrant code + return; + } + + // FIXME il ne faut pas appeler le parent + // on ne sais jamais de quel type est le parent + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + if (inputUI != null) { + inputUI.getHandler().setTreeSelection(this.inputContentUI, c.getTopiaId()); + } + else { + SensitivityTabUI sensitivityTabUI = inputContentUI.getParentContainer(SensitivityTabUI.class); + sensitivityTabUI.getHandler().setTreeSelection(this.inputContentUI, c.getTopiaId()); + } + } + } +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellHandler.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/cell/CellUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,122 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2015 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Cell'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Cell id='bean' javaBean='null'/> + + <CellHandler id="handler" /> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Cell' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldCellName" /> + </BeanValidator> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + handler.init(this); + } + ]]></script> + + <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" onItemStateChanged='handler.fieldCellChanged(event)' + model='{new javax.swing.DefaultComboBoxModel()}' enabled='{getBean() != null}'/> + </cell> + </row> + <row> + <cell> + <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='{isActive()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.cell.latitude" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldCellLatitude" text='{String.valueOf(getBean().getLatitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.cell.longitude" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldCellLongitude" text='{String.valueOf(getBean().getLongitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.cell.land" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActive()}' selected='{getBean().isLand()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal'> + <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='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" + fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()}' + constraints='BorderLayout.CENTER' decorator='boxed' enabled='{getBean() != null}'/> + <com.bbn.openmap.InformationDelegator id="cellMapInfo" constraints='BorderLayout.SOUTH' /> + </JPanel> + </JSplitPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Added: trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionHandler.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,138 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 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.fisheryregion; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.DefaultListModel; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.ui.input.InputAction; +import fr.ifremer.isisfish.ui.input.InputContentHandler; +import fr.ifremer.isisfish.ui.input.InputUI; + +/** + * FisheryRegion handler. + */ +public class FisheryRegionHandler extends InputContentHandler<FisheryRegionUI> { + + /** Class logger. */ + private static final Log log = LogFactory.getLog(FisheryRegionHandler.class); + + protected void init(final FisheryRegionUI fisheryRegionUI) { + super.init(fisheryRegionUI); + + //cellMap.init(cellMapInfo); + + fisheryRegionUI.setButtonTitle(t("isisfish.input.continueCells")); + fisheryRegionUI.setNextPath(n("isisfish.input.tree.cells")); + + fisheryRegionUI.addPropertyChangeListener(FisheryRegionUI.PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + setFieldMapfilesModel(fisheryRegionUI.getBean()); + /* numberEditor is not working + fieldLatMin.init(); + fieldLatMax.init(); + fieldLongMin.init(); + fieldLongMax.init(); + fieldCellLengthLatitude.init(); + fieldCellLengthLongitude.init();*/ + } + } + }); + } + + public void refresh() { + FisheryRegion region = inputContentUI.getSaveVerifier().getEntity(FisheryRegion.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + inputContentUI.setBean(null); + inputContentUI.setBean(region); + } + + protected InputAction getInputAction() { + return inputContentUI.getContextValue(InputAction.class); + } + + protected void setFieldMapfilesModel(FisheryRegion region) { + DefaultListModel model = new DefaultListModel(); + java.util.List<String> mapList = region.getMapFileList(); + if (mapList != null) { + int cnt = 0; + for (String map : mapList) { + model.add(cnt, map); + cnt++; + } + } + inputContentUI.fieldMapfiles.setModel(model); + } + + protected void addMap() { + getInputAction().addMap(inputContentUI.getBean()); + setFieldMapfilesModel(inputContentUI.getBean()); + } + + protected void delMap() { + getInputAction().removeMap(inputContentUI.getBean(), inputContentUI.fieldMapfiles.getSelectedValues()); + setFieldMapfilesModel(inputContentUI.getBean()); + } + + /*protected void cellFile() { + getInputAction().loadCellFile(fieldCellFile.getText()); + }*/ + + protected void check() { + inputContentUI.getContextValue(InputAction.class).checkFisheryRegion(inputContentUI.getBean()); + inputContentUI.setInfoText(t("isisfish.message.check.finished")); + } + + protected void save() { + inputContentUI.setInfoText(t("isisfish.message.checking.cell")); + + // this make save done by verifier instead of saveFisheryRegion + // and refresh tree is not working + inputContentUI.getSaveVerifier().reset(); + + // save generating cells + getInputAction().saveFisheryRegion(inputContentUI.getBean()); + + // reload tree + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().reloadFisheryTree(inputUI); + + inputContentUI.setInfoText(t("isisfish.message.save.finished")); + } +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionHandler.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/fisheryregion/FisheryRegionUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,207 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2015 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='FisheryRegion'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.FisheryRegion id='bean' javaBean='null'/> + + <FisheryRegionHandler id="handler" /> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.FisheryRegion' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldRegion" /> + </BeanValidator> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + handler.init(this); + } + ]]></script> + + <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='handler.addMap()' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonRemoveMap" text="isisfish.fisheryRegion.delMap" onActionPerformed='handler.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 fill='horizontal' weightx='0.3'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="handler.save();validator.setChanged(false)"/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='check' text="isisfish.common.check" onActionPerformed='handler.check()' decorator='boxed'/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <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'/> + <com.bbn.openmap.InformationDelegator id="cellMapInfo" constraints='BorderLayout.SOUTH' /> + </JPanel> + </JSplitPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/GearPopulationSelectivityModel.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearPopulationSelectivityModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,261 @@ +/* + * #%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 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.gear; + +import static org.nuiton.i18n.I18n.t; + +import java.awt.Component; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellRenderer; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Selectivity; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel; + +/** + * Table model for {@link Gear}#{@link Selectivity}. + * + * Columns : + * <ul> + * <li>selectivity population name</li> + * <li>selectivity equation</li> + * </ul> + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class GearPopulationSelectivityModel extends AbstractTableModel implements TableCellRenderer, SensitivityTableModel { + + /** Log. */ + private static Log log = LogFactory.getLog(GearPopulationSelectivityModel.class); + + /** serialVersionUID. */ + private static final long serialVersionUID = 3169786638868209920L; + + /** Columns names. */ + public final static String[] COLUMN_NAMES = { + t("isisfish.common.population"), + t("isisfish.common.equation") + }; + + protected List<Selectivity> selectivities; + + /** + * Empty constructor. + */ + public GearPopulationSelectivityModel() { + this(null); + } + + /** + * Constructor with data. + * + * @param selectivities initial selectivities + */ + public GearPopulationSelectivityModel( + List<Selectivity> selectivities) { + this.selectivities = selectivities; + } + + /** + * Set target species list. + * + * @param selectivities the selectivities to set + */ + public void setSelectivities(List<Selectivity> selectivities) { + this.selectivities = selectivities; + } + + /** + * Get selectivity list. + * + * @return selectivity list + */ + public List<Selectivity> getSelectivities() { + return this.selectivities; + } + + /* + * @see javax.swing.table.TableModel#getColumnCount() + */ + @Override + public int getColumnCount() { + return COLUMN_NAMES.length; + } + + /* + * @see javax.swing.table.TableModel#getRowCount() + */ + @Override + public int getRowCount() { + int rows = 0; + if (selectivities != null) { + rows = selectivities.size(); + } + return rows; + } + + /* + * @see javax.swing.table.TableModel#getValueAt(int, int) + */ + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + + Object result = null; + + Selectivity selectivity = selectivities.get(rowIndex); + switch (columnIndex) { + case 0: + result = selectivity.getPopulation().getName(); + break; + case 1: + result = selectivity.getEquation(); + break; + default: + throw new IndexOutOfBoundsException("No such column " + columnIndex); + } + + return result; + } + + /* + * @see javax.swing.table.TableModel#getColumnClass(int) + */ + @Override + public Class<?> getColumnClass(int columnIndex) { + + Class<?> result = null; + + switch (columnIndex) { + case 0: + result = String.class; + break; + case 1: + result = Equation.class; + break; + default: + throw new IndexOutOfBoundsException("No such column " + columnIndex); + } + + return result; + } + + /* + * @see javax.swing.table.TableModel#getColumnName(int) + */ + @Override + public String getColumnName(int columnIndex) { + return COLUMN_NAMES[columnIndex]; + } + + /* + * @see javax.swing.table.TableModel#isCellEditable(int, int) + */ + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex > 0; + } + + /* + * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) + */ + @Override + public void setValueAt(Object value, int rowIndex, int columnIndex) { + + if (log.isDebugEnabled()) { + log.debug("Cell edition (column " + columnIndex + ") = " + value); + } + + Selectivity selectivity = selectivities.get(rowIndex); + switch (columnIndex) { + case 1: + Equation eq = (Equation)value; + // two events for event to be fired + selectivity.setEquation(null); + selectivity.setEquation(eq); + break; + default: + throw new IndexOutOfBoundsException("Can't edit column " + columnIndex); + } + + } + + /* + * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) + */ + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + Component c = null; + switch (column) { + case 0: + c = new JLabel(value.toString()); + break; + case 1: + Equation equation = (Equation)value; + c = new JButton(equation.getName() + "(" + equation.getCategory() + ")"); + break; + default: + throw new IndexOutOfBoundsException("No such column " + column); + } + return c; + } + + /* + * @see fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel#getPropertyAtColumn(int) + */ + @Override + public String getPropertyAtColumn(int column) { + String result = null; + if (column == 1) { + result = "equation"; + } + return result; + } + + /* + * @see fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel#getBeanAtRow(int) + */ + @Override + public Object getBeanAtRow(int rowIndex) { + Object result = null; + result = selectivities.get(rowIndex); + return result; + } +} Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearTabUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearTabUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,182 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Gear; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + </import> + + <BeanValidator id='validator' context="gear" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldGearName" /> + <field name="effortUnit" component="fieldGearEffortUnit" /> + </BeanValidator> + + <script><![CDATA[ + +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) { + + } + } + }); +} + +/*public void refresh() { + Gear gear = getSaveVerifier().getEntity(Gear.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(gear); + + getVerifier().addCurrentPanel(rangeOfValues); + + // chatellier commented since number editor is not working + //if (getBean() != null) { + // fieldGearStandardisationFactor.init(); + //} +}*/ + ]]></script> + <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' _sensitivityBean='{Gear.class}' + _sensitivityMethod='"StandardisationFactor"' useSign='true'/--> + <JTextField id="fieldGearStandardisationFactor" text='{String.valueOf(getBean().getStandardisationFactor())}' + onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Gear.class}' _sensitivityMethod='"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" bean="{getBean()}" active='{isActive()}' constructorParams='this' + decorator='boxed' _sensitivityBean='{Gear.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Gear.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/GearUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,84 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Gear'> + + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + </import> + <script><![CDATA[ + +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueMetiers")); + setNextPath(n("isisfish.input.tree.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); +} + +/*public void refresh() { + //getVerifier().addCurrentPanel(gearTabUI, selectivityUI); +}*/ + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + gearTabUI.setLayer(active); + selectivityUI.setLayer(active); +} + +@Override +public void resetChangeModel() { + gearTabUI.resetChangeModel(); + selectivityUI.resetChangeModel(); +} + ]]></script> + <JPanel id="body"> + <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab"> + <tab title='isisfish.gear.title'> + <GearTabUI id="gearTabUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this' /> + </tab> + <tab title='isisfish.selectivity.title'> + <SelectivityUI id="selectivityUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/RangeOfValuesUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/RangeOfValuesUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/RangeOfValuesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,100 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.types.RangeOfValues + fr.ifremer.isisfish.entities.Gear + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener + java.util.ArrayList + </import> + + <script><![CDATA[ +boolean init = false; + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldGearParamPossibleValue.setText(""); + } + if (evt.getNewValue() != null) { + java.util.List<Object> values = new ArrayList<Object>(); + for (String value : RangeOfValues.getPossibleTypes()) { + values.add(value); + } + + init = true; + jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); + init = false; + } + } + }); +} + +/*public void refresh() { + Gear gear = getSaveVerifier().getEntity(Gear.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(gear); + + if (getBean() != null) { + java.util.List<Object> values = new ArrayList<Object>(); + for (String value : RangeOfValues.getPossibleTypes()) { + values.add(value); + } + + init = true; + jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); + init = false; + } +}*/ + +protected void gearParamChanged() { + if (fieldGearParamType.getSelectedItem() != null && !init) { + getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); + } +} + ]]></script> + <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> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/SelectivityUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/SelectivityUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/SelectivityUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,214 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.Population id='population' javaBean='null'/> + + <BeanValidator id='validator' context="selectivity" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged()}" + valid="{validator.isValid()}" /> + + <import> + fr.ifremer.isisfish.entities.Equation + fr.ifremer.isisfish.entities.Gear + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.entities.Selectivity + fr.ifremer.isisfish.entities.Species + fr.ifremer.isisfish.ui.models.common.GenericComboModel + fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.util.ArrayList + javax.swing.DefaultComboBoxModel + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setPopulation(null); + selectivityTable.setModel(new GearPopulationSelectivityModel()); + } + if (evt.getNewValue() != null) { + refresh(); + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +public void refresh() { + + Gear gear = (Gear)getSaveVerifier().getEntity(Gear.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + //setBean(null); + //setBean(gear); + + if (getBean() != null) { + setSelectivityTableModel(); + fieldSelectivityPopulation.setModel(getSelectivityPopulationModel()); + } +} + +protected void setSelectivityTableModel() { + + List<Selectivity> selectivitiesList = new ArrayList<Selectivity>(); + + // set model even if no selectivity + // to clear data + if (getBean().getPopulationSelectivity() != null) { + // move collection to list + // and add all entity to verifier + for (Selectivity oneSelectivity : getBean().getPopulationSelectivity()) { + getSaveVerifier().addCurrentEntity(oneSelectivity); + selectivitiesList.add(oneSelectivity); + + // hack to enable save button :( + oneSelectivity.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + changeModel.setStayChanged(true); + } + }); + } + } + + // set table model + GearPopulationSelectivityModel model = new GearPopulationSelectivityModel(selectivitiesList); + selectivityTable.setModel(model); + selectivityTable.setDefaultRenderer(Equation.class, model); + selectivityTable.setDefaultEditor(Equation.class, new EquationTableEditor()); +} + +protected void addSelectivity() { + getAction().addSelectivity(getPopulation(), selectivityEquation.getEditor().getText(), getBean()); + setSelectivityTableModel(); +} + +protected void removeSelectivity() { + GearPopulationSelectivityModel model = (GearPopulationSelectivityModel)selectivityTable.getModel(); + Selectivity selectedSelectivity = model.getSelectivities().get(selectivityTable.getSelectedRow()); + getAction().removeSelectivity(getBean(), selectedSelectivity); + getSaveVerifier().removeCurrentEntity(selectedSelectivity.getTopiaId()); + setSelectivityTableModel(); + removeSelectivityButton.setEnabled(false); +} + +protected DefaultComboBoxModel getSelectivityPopulationModel() { + List<Species> species = getFisheryRegion().getSpecies(); + List<Population> populations = new ArrayList<Population>(); + if (species != null) { + for (Species s : species) { + if (s.getPopulation() != null) { + populations.addAll(s.getPopulation()); + } + } + } + GenericComboModel<Population> selectivityPopulationModel = new GenericComboModel<>(populations); + return selectivityPopulationModel; +} + +protected void selectivityChanged() { + setPopulation((Population)fieldSelectivityPopulation.getSelectedItem()); +} + ]]></script> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> + <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" onItemStateChanged='selectivityChanged()' + enabled='{isActive()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0' insets="0"> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='selectivityEquation' constructorParams='this' + text='isisfish.selectivity.equation' + bean='{getBean()}' formuleCategory='Selectivity' active='{getPopulation() != null}' + 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='{getPopulation() != null}' 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' /> + <ListSelectionModel initializer='selectivityTable.getSelectionModel()' + onValueChanged="removeSelectivityButton.setEnabled(isActive() && selectivityTable.getSelectedRow() != -1)" /> + </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 fill='horizontal' weightx='1.0'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);changeModel.setStayChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoSpeciesUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoSpeciesUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoSpeciesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,248 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> + + <fr.ifremer.isisfish.entities.Species id='species' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.MetierSeasonInfo + fr.ifremer.isisfish.ui.models.common.GenericListModel + fr.ifremer.isisfish.ui.models.common.GenericComboModel + fr.ifremer.isisfish.entities.Equation + fr.ifremer.isisfish.entities.Metier + fr.ifremer.isisfish.entities.Species + fr.ifremer.isisfish.entities.TargetSpecies + fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.util.ArrayList + java.util.List + java.awt.Dimension + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <BeanValidator id='validator' context="metier" + bean='{getMetierSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.MetierSeasonInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged()}" + valid="{validator.isValid()}" /> + + <script><![CDATA[ + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + setSeasonModel(); + setSpecies(null); + setMetierSeasonInfo(null); + setTargetSpeciesModel(); + setTableTargetSpeciesModel(); + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +protected void setSeasonModel() { + List<MetierSeasonInfo> metierSeasonInfo = null; + + if (getBean() != null) { + metierSeasonInfo = getBean().getMetierSeasonInfo(); + } + GenericComboModel<MetierSeasonInfo> seasonModel = new GenericComboModel(metierSeasonInfo); + fieldMetierSeasonInfo.setModel(seasonModel); +} + +protected void metierSeasonInfoChanged() { + MetierSeasonInfo selectedMSI = (MetierSeasonInfo)fieldMetierSeasonInfo.getSelectedItem(); + setMetierSeasonInfo(selectedMSI); + if (selectedMSI != null) { + getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); + setTableTargetSpeciesModel(); + } +} + +protected void setTargetSpeciesModel() { + List<Species> species = getFisheryRegion().getSpecies(); + GenericComboModel<Species> fieldTargetSpeciesModel = new GenericComboModel<>(species); + fieldTargetSpecies.setModel(fieldTargetSpeciesModel); +} + +protected void speciesChanged() { + Species species = (Species)fieldTargetSpecies.getSelectedItem(); + setSpecies(species); +} + +protected void setTableTargetSpeciesModel() { + List<TargetSpecies> targetSpecies = new ArrayList<TargetSpecies>(); + + if (getBean() != null && getMetierSeasonInfo() != null) { + // SpeciesTargetSpecies can be null durring region creation + if (getMetierSeasonInfo().getSpeciesTargetSpecies() != null) { + // move collection to list + // and add all entity to verifier + for (TargetSpecies oneTargetSpecies : getMetierSeasonInfo().getSpeciesTargetSpecies()) { + targetSpecies.add(oneTargetSpecies); + getSaveVerifier().addCurrentEntity(oneTargetSpecies); + oneTargetSpecies.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + changeModel.setStayChanged(true); + } + }); + } + } + } + + // set table model + MetierSeasonInfoTargetSpeciesTableModel model = new MetierSeasonInfoTargetSpeciesTableModel(targetSpecies); + tableTargetSpecies.setModel(model); + tableTargetSpecies.setDefaultRenderer(Equation.class, model); + tableTargetSpecies.setDefaultEditor(Equation.class, new EquationTableEditor()); +} + +protected void add() { + Species selectedSpecies = (Species)fieldTargetSpecies.getSelectedItem(); + if (selectedSpecies != null) { + // il n'y en a pas a la creation de la base + //Formule selectedFormule = (Formule)targetFactor.getFormuleComboBox().getSelectedItem(); + getContextValue(InputAction.class).addTargetSpecies( + getBean(), + getMetierSeasonInfo(), + selectedSpecies, + targetFactor.getEditor().getText(), + fieldPrimaryCatch.isSelected()); + setTableTargetSpeciesModel(); + } +} + +protected void remove() { + // TODO change delete selected truc from model + Object[] targetSpecies = getMetierSeasonInfo().getSpeciesTargetSpecies().toArray(); + + Object o = targetSpecies[tableTargetSpecies.getSelectedRow()]; + if (o != null) { + TargetSpecies ts = (TargetSpecies)o; + getAction().removeTargetSpecies(getMetierSeasonInfo(), ts); + getSaveVerifier().removeCurrentEntity(ts.getTopiaId()); + setTableTargetSpeciesModel(); + } +} + ]]></script> + <JPanel id="body"> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> + <Table> + <row> + <cell fill='horizontal'> + <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldMetierSeasonInfo" onItemStateChanged='metierSeasonInfoChanged()' + renderer="{new fr.ifremer.isisfish.ui.input.renderer.MetierSeasonInfoComboRenderer()}" + enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" + enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldTargetSpecies" onItemStateChanged='speciesChanged()' + enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='targetFactor' constructorParams='this' + active='{isActive() && getMetierSeasonInfo() != null}' + text='isisfish.metierSeasonInfoSpecies.targetFactor' + bean='{getMetierSeasonInfo()}' formuleCategory='TargetFactor' + clazz='{fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class}' + decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" + enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' + enabled='{getMetierSeasonInfo() != null && getSpecies() != null}' 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='{getMetierSeasonInfo() != null}' + decorator='boxed'/> + <ListSelectionModel initializer="tableTargetSpecies.getSelectionModel()" + onValueChanged="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> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);changeModel.setStayChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesTableModel.java (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/MetierSeasonInfoTargetSpeciesTableModel.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesTableModel.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoTargetSpeciesTableModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,269 @@ +/* + * #%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 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.metier; + +import static org.nuiton.i18n.I18n.t; + +import java.awt.Component; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellRenderer; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.MetierSeasonInfo; +import fr.ifremer.isisfish.entities.TargetSpecies; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel; + +/** + * Table model for {@link MetierSeasonInfo}#{@link TargetSpecies}. + * + * Columns : + * <ul> + * <li>target species name</li> + * <li>target species equation</li> + * <li>target species primaryCatch</li> + * </ul> + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MetierSeasonInfoTargetSpeciesTableModel extends AbstractTableModel implements TableCellRenderer, SensitivityTableModel { + + /** Log. */ + private static Log log = LogFactory.getLog(MetierSeasonInfoTargetSpeciesTableModel.class); + + /** serialVersionUID. */ + private static final long serialVersionUID = 3169786638868209920L; + + /** Columns names. */ + public final static String[] COLUMN_NAMES = { + t("isisfish.metierSeasonInfoSpecies.species"), + t("isisfish.metierSeasonInfoSpecies.targetFactor"), + t("isisfish.metierSeasonInfoSpecies.mainSpecies") }; + + protected List<TargetSpecies> targetSpeciesList; + + /** + * Empty constructor. + */ + public MetierSeasonInfoTargetSpeciesTableModel() { + this(null); + } + + /** + * Constructor with data. + * + * @param targetSpeciesList initial target species + */ + public MetierSeasonInfoTargetSpeciesTableModel( + List<TargetSpecies> targetSpeciesList) { + this.targetSpeciesList = targetSpeciesList; + } + + /** + * Set target species list. + * + * @param targetSpeciesList the targetSpecies to set + */ + public void setTargetSpecies(List<TargetSpecies> targetSpeciesList) { + this.targetSpeciesList = targetSpeciesList; + } + + /* + * @see javax.swing.table.TableModel#getColumnCount() + */ + @Override + public int getColumnCount() { + return COLUMN_NAMES.length; + } + + /* + * @see javax.swing.table.TableModel#getRowCount() + */ + @Override + public int getRowCount() { + int rows = 0; + if (targetSpeciesList != null) { + rows = targetSpeciesList.size(); + } + return rows; + } + + /* + * @see javax.swing.table.TableModel#getValueAt(int, int) + */ + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + + Object result = null; + + TargetSpecies targetSpecies = targetSpeciesList.get(rowIndex); + switch (columnIndex) { + case 0: + result = targetSpecies.getSpecies().getName(); + break; + case 1: + result = targetSpecies.getTargetFactorEquation(); + break; + case 2: + result = targetSpecies.isPrimaryCatch(); + break; + default: + throw new IndexOutOfBoundsException("No such column " + columnIndex); + } + + return result; + } + + /* + * @see javax.swing.table.TableModel#getColumnClass(int) + */ + @Override + public Class<?> getColumnClass(int columnIndex) { + + Class<?> result = null; + + switch (columnIndex) { + case 0: + result = String.class; + break; + case 1: + result = Equation.class; + break; + case 2: + result = Boolean.class; + break; + default: + throw new IndexOutOfBoundsException("No such column " + columnIndex); + } + + return result; + } + + /* + * @see javax.swing.table.TableModel#getColumnName(int) + */ + @Override + public String getColumnName(int columnIndex) { + return COLUMN_NAMES[columnIndex]; + } + + /* + * @see javax.swing.table.TableModel#isCellEditable(int, int) + */ + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex > 0; + } + + /* + * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) + */ + @Override + public void setValueAt(Object value, int rowIndex, int columnIndex) { + + if (log.isDebugEnabled()) { + log.debug("Cell edition (column " + columnIndex + ") = " + value); + } + + TargetSpecies targetSpecies = targetSpeciesList.get(rowIndex); + switch (columnIndex) { + case 1: + Equation eq = (Equation)value; + // two events for event to be fired + targetSpecies.setTargetFactorEquation(null); + targetSpecies.setTargetFactorEquation(eq); + break; + case 2: + Boolean bValue = (Boolean)value; + targetSpecies.setPrimaryCatch(bValue); + break; + default: + throw new IndexOutOfBoundsException("Can't edit column " + columnIndex); + } + + } + + /* + * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) + */ + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + Component c = null; + switch (column) { + case 0: + c = new JLabel(value.toString()); + break; + case 1: + Equation equation = (Equation)value; + c = new JButton(equation.getName() + "(" + equation.getCategory() + ")"); + break; + case 2: + Boolean bValue = (Boolean)value; + c = new JCheckBox(); + ((JCheckBox)c).setSelected(bValue); + break; + default: + throw new IndexOutOfBoundsException("No such column " + column); + } + return c; + } + + /* + * @see fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel#getPropertyAtColumn(int) + */ + @Override + public String getPropertyAtColumn(int column) { + String property = null; + if (column == 1) { + property = "targetFactorEquation"; + } + return property; + } + + /* + * @see fr.ifremer.isisfish.ui.sensitivity.SensitivityTableModel#getBeanAtRow(int) + */ + @Override + public Object getBeanAtRow(int rowIndex) { + Object value = null; + value = targetSpeciesList.get(rowIndex); + return value; + } +} Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoZoneUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoZoneUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoZoneUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,317 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Metier + fr.ifremer.isisfish.entities.MetierSeasonInfo + fr.ifremer.isisfish.entities.Zone + fr.ifremer.isisfish.types.Month + fr.ifremer.isisfish.ui.models.common.GenericComboModel + fr.ifremer.isisfish.ui.models.common.GenericListModel + fr.ifremer.isisfish.ui.widget.Interval + fr.ifremer.isisfish.ui.widget.IntervalPanel + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.util.ArrayList + java.awt.Dimension + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <BeanValidator id='validator' context="metier" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validatorSeason' context="metier" + bean='{getMetierSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.MetierSeasonInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" + valid="{validator.isValid() && validatorSeason.isValid()}" /> + + <script><![CDATA[ + + 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())); + } + } + }); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + refresh(); + } + } + }); + } + + @Override + public void resetChangeModel() { + changeModel.setStayChanged(false); + } + + protected void save() { + getSaveVerifier().save(); + setMetierSeasonInfoCombo(); + } + + protected void create() { + MetierSeasonInfo newMSI = getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); + setMetierSeasonInfo(newMSI); + setMetierSeasonInfoCombo(); + } + + protected void delete() { + getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); + setMetierSeasonInfo(null); + setMetierSeasonInfoCombo(); + } + + public void refresh() { + + if (log.isDebugEnabled()) { + log.debug("Refresh called in ui : " + this); + } + + setMetierSeasonInfo(null); + + if (getBean() != null) { + // Model instanciation + interval = new Interval(); + interval.setMin(0); + interval.setMax(11); + interval.setFirst(0); + interval.setLast(2); + + setMetierSeasonInfoCombo(); + setSeason(); + setMetierZone(); + + ip.setLabelRenderer(Month.MONTH); + ip.setModel(interval); + } + } + + protected void setSeason() { + if (getMetierSeasonInfo() != null) { + + // register selected item in save verifier + getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); + + try { + if (log.isDebugEnabled()) { + log.debug("Refresh interval : "); + } + Month firstMonth = getMetierSeasonInfo().getFirstMonth(); + if (firstMonth != null) { + interval.setFirst(firstMonth.getMonthNumber()); + if (log.isDebugEnabled()) { + log.debug(" first : " + interval.getFirst()); + } + } else { + interval.setFirst(0); + } + + Month lastMonth = getMetierSeasonInfo().getLastMonth(); + if (lastMonth != null) { + interval.setLast(lastMonth.getMonthNumber()); + if (log.isDebugEnabled()) { + log.debug(" last : " + interval.getLast()); + } + } else { + interval.setLast(3); + } + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't display season", e); + } + } + } + } + protected void setMetierZone() { + if (getMetierSeasonInfo() != null) { + ListSelectionListener[] listeners = metierZones.getListSelectionListeners(); + for (ListSelectionListener listener : listeners) { + metierZones.removeListSelectionListener(listener); + } + + List<Zone> allZones = getFisheryRegion().getZone(); + GenericListModel<Zone> model = new GenericListModel<>(allZones); + metierZones.setModel(model); + // restore selection + if (metierSeasonInfo.getZone() != null) { + for (Zone zone : metierSeasonInfo.getZone()) { + int index = allZones.indexOf(zone); + metierZones.getSelectionModel().addSelectionInterval(index, index); + } + } + + for (ListSelectionListener listener : listeners) { + metierZones.addListSelectionListener(listener); + } + } + } + + protected void setMetierSeasonInfoCombo() { + List<MetierSeasonInfo> metierSeasonInfoList = getBean().getMetierSeasonInfo(); + GenericComboModel<MetierSeasonInfo> metierSeasonInfoModel = new GenericComboModel<>(metierSeasonInfoList); + metierSeasonInfoCombo.setModel(metierSeasonInfoModel); + metierSeasonInfoModel.setSelectedItem(getMetierSeasonInfo()); + } + + protected void metierZonesChanged() { + Object[] selected = metierZones.getSelectedValues(); + List<Zone> zones = new ArrayList<Zone>(); + for (Object o : selected){ + zones.add((Zone)o); + } + getMetierSeasonInfo().setZone(zones); + } + + protected void seasonChanged() { + init = true; + setMetierSeasonInfo((MetierSeasonInfo)metierSeasonInfoCombo.getSelectedItem()); + setSeason(); + setMetierZone(); + init = false; + } + ]]></script> + <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" onItemStateChanged='seasonChanged()' enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }' + renderer="{new fr.ifremer.isisfish.ui.input.renderer.MetierSeasonInfoComboRenderer()}" /> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{getMetierSeasonInfo() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <IntervalPanel id='ip' enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.zone" enabled='{getMetierSeasonInfo() != null}'/> + </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='{getMetierSeasonInfo() != null}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{getMetierSeasonInfo() != null}'/> + </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='{getMetierSeasonInfo() != null}' 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' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="save();validator.setChanged(false);validatorSeason.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!changeModel.isChanged()}" + onActionPerformed="create()"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{getMetierSeasonInfo() != null}" + onActionPerformed="delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierTabUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierTabUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,171 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Gear + fr.ifremer.isisfish.entities.Metier + fr.ifremer.isisfish.ui.models.common.GenericComboModel + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.awt.Dimension + </import> + + <BeanValidator id='validator' context="metier" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldMetierName" /> + </BeanValidator> + + <script><![CDATA[ +protected boolean init = false; + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + GenericComboModel<Gear> model = new GenericComboModel<>(getFisheryRegion().getGear()); + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + init = true; + model.setSelectedItem(bean.getGear()); + init = false; + } + fieldMetierGear.setModel(model); + } + }); +} + +/*public void refresh() { + + if (log.isDebugEnabled()) { + log.debug("Refresh called in ui : " + this); + } + + Metier metier = getSaveVerifier().getEntity(Metier.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(metier); +}*/ + +protected void gearChanged() { + if (!init) { + getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); + } +} + ]]></script> + <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'> + <JComboBox id="fieldMetierGear" onItemStateChanged='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' + _sensitivityBean='{Metier.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Metier.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,72 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Metier'> + + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + </import> + +<script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueTripTypes")); + setNextPath(n("isisfish.input.tree.triptypes")); + + // install change listener + // (depends on sensitivity can't be done on constructor) + installChangeListener(metierTab); +} + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + metierTabUI.setLayer(active); + metierSeasonInfoUI.setLayer(active); + metierSeasonSpeciesUI.setLayer(active); +} + +@Override +public void resetChangeModel() { + metierTabUI.resetChangeModel(); + metierSeasonInfoUI.resetChangeModel(); + metierSeasonSpeciesUI.resetChangeModel(); +} + ]]></script> + <JPanel id="body"> + <JTabbedPane id="metierTab" constraints='BorderLayout.CENTER'> + <tab title='isisfish.metier.title'> + <MetierTabUI id="metierTabUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.metierSeasonInfoZone.title'> + <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.metierSeasonInfoSpecies.title'> + <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/observation/ObservationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/ObservationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/observation/ObservationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/observation/ObservationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,178 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2014 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI + superGenericType='fr.ifremer.isisfish.entities.Observation'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Observation + id='bean' javaBean='null' /> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.MatrixND + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Observation' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldObservationName" /> + </BeanValidator> + + <script><![CDATA[ + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldObservationValue.setMatrix(null); + } + if (evt.getNewValue() != null) { + setObservationValueMatrix(); + } + } + }); +} + +protected void setObservationValueMatrix() { + MatrixND prop = getBean().getValue(); + if (prop != null) { + fieldObservationValue.setMatrix(prop.copy()); + } else { + fieldObservationValue.setMatrix(null); + } +} + +protected void createObservationValueMatrix() { + getAction().createObservationValueMatrix(getBean()); + setObservationValueMatrix(); +} + +protected void observationValueMatrixChanged(MatrixPanelEvent event) { + MatrixND mat = fieldObservationValue.getMatrix(); + if (getBean() != null && mat != null) { + getBean().setValue(mat.copy()); + } +} + + ]]></script> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.observation.name" enabled='{isActive()}' /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldObservationName" + text='{SwingUtil.getStringValue(getBean().getName())}' + onKeyReleased='getBean().setName(fieldObservationName.getText())' + enabled='{isActive()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.observation.comment" + enabled='{isActive()}' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.2' weightx='1.0'> + <JScrollPane> + <JTextArea id="fieldObservationComment" + text='{SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldObservationComment.getText())' + enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.observation.value" + enabled='{isActive()}' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='1' weightx='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor + id="fieldObservationValue" onMatrixChanged="observationValueMatrixChanged(event)" + enabled='{isActive()}' decorator='boxed' + _sensitivityBean='{fr.ifremer.isisfish.entities.Observation.class}' + _sensitivityMethod='"Value"' /> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton text="isisfish.common.newMatrix" onActionPerformed='createObservationValueMatrix()' enabled='{isActive()}' decorator='boxed'/> + </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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);" /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()" /> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Observation.class)" /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()" /> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationBasicsUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationBasicsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,297 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + fr.ifremer.isisfish.entities.Species; + fr.ifremer.isisfish.entities.PopulationGroup; + fr.ifremer.isisfish.entities.Population; + javax.swing.table.DefaultTableModel; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + javax.swing.JOptionPane + javax.swing.JFrame + java.awt.BorderLayout + fr.ifremer.isisfish.ui.input.InputUI + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <BeanValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldPopulationBasicsName" /> + </BeanValidator> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationBasicsName.setText(""); + fieldPopulationBasicsGeographicID.setText(""); + fieldPopulationBasicsNbClasses.setText(""); + fieldPopulationBasicsComment.setText(""); + tableAgeLength.setModel(new DefaultTableModel()); + } + if (evt.getNewValue() != null) { + setTableAgeLengthModel(); + } + } + }); +} + +public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + if (getBean() != null) { + setTableAgeLengthModel(); + } + //getSaveVerifier().addCurrentPanel(growthEquation, growthReverseEquation); +} + +/** + * Open creation classe wizard after confirmation. + */ +protected void createGroups() { + + int response = JOptionPane.showConfirmDialog(this, t("isisfish.populationBasics.confirmCreateGroups"), + t("isisfish.common.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + + if (response == JOptionPane.YES_OPTION) { + JFrame wizardFrame = new JFrame(); + wizardFrame.setLayout(new BorderLayout()); + WizardGroupCreationUI wizard = new WizardGroupCreationUI(this); + wizard.init(this); + wizardFrame.add(wizard, BorderLayout.CENTER); + wizardFrame.setTitle(t("isisfish.wizardGroupCreation.title")); + Species species = getBean().getSpecies(); + wizard.setAgeType(species.isAgeGroupType()); + if (wizard.isAgeType()) { + wizard.setCard("singleGroupAge"); + } else { + wizard.setCard("beginGroupLength"); + } + wizardFrame.pack(); + wizardFrame.setLocationRelativeTo(this); + wizardFrame.setVisible(true); + } + +} + +protected void setTableAgeLengthModel() { + java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup(); + if (popGroup != null){ + DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1); + model.setValueAt("Age", 0, 0); + model.setValueAt("Lengths", 1, 0); + int cnt = 1; + for (PopulationGroup pg : popGroup){ + model.setValueAt(pg.getAge(), 0, cnt); + model.setValueAt(pg.getLength(), 1, cnt); + cnt++; + } + tableAgeLength.setModel(model); + } +} + +protected void create() { + // find species node + InputUI inputUI = getContextValue(InputUI.class, JAXXUtil.PARENT); + Species species = inputUI.getHandler().findSpecies(inputUI); + // create node and select it + Population population = getContextValue(InputAction.class).createPopulation(getTopiaContext(), species); + inputUI.getHandler().insertTreeNode(inputUI, Population.class, population); + setInfoText(t("isisfish.message.creation.finished")); +} + ]]> + </script> + <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='3' 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='3' 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> + <cell fill='horizontal'> + <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" + toolTipText="isisfish.populationBasics.plusGroupTip" + selected='{getBean().isPlusGroup()}' + onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"PlusGroup"'/> + </cell> + </row> + <row> + <cell anchor='east' insets="0"> + <JLabel text="isisfish.populationBasics.groupMin" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='3' insets="0"> + <Table> + <row> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupMin" text='{String.valueOf(getBean().getGroupMin())}' + onKeyReleased='getBean().setGroupMin(Integer.parseInt(fieldPopulationGroupMin.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MinAge"'/> + </cell> + <cell> + <JLabel text="isisfish.populationBasics.groupMax" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupMax" text='{String.valueOf(getBean().getGroupMax())}' + onKeyReleased='getBean().setGroupMax(Integer.parseInt(fieldPopulationGroupMax.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MaxAge"'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell columns='4' fill='both' weightx='1.0'> + <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='4' fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{Population.class}' _sensitivityMethod='"Growth"'/> + </cell> + </row> + <row> + <cell columns='4' fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{Population.class}' _sensitivityMethod='"GrowthReverse"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.population.comments" enabled='{isActive()}'/> + </cell> + <cell columns='3' 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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="create()"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationCapturabilityUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationCapturabilityUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationCapturabilityUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,170 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Population + org.nuiton.math.matrix.gui.MatrixPanelEvent + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + org.nuiton.math.matrix.gui.MatrixPanelListener + java.awt.CardLayout + </import> + + <BeanValidator id='validator' context="capturability" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +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()); + } + refreshHidablePanel(); + } + } + }); +} + +protected void populationCapturabilityMatrixChanged(MatrixPanelEvent event) { + if (getBean() != null && fieldPopulationCapturability.getMatrix() != null) { + getBean().setCapturability(fieldPopulationCapturability.getMatrix().copy()); + } +} + +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + if (getBean() != null){ + if (getBean().getCapturability() != null) { + fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); + } + } +}*/ +protected void useEquationChanged() { + getBean().setCapturabilityEquationUsed(fieldUseCapturabilityEquation.isSelected()); + + // compute matrix again to not diplay values computed by equation + if (!fieldUseCapturabilityEquation.isSelected()) { + if (getBean().getCapturability() != null) { + fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); + } + } + refreshHidablePanel(); +} +protected void refreshHidablePanel() { + if (getBean() != null) { + if (getBean().isCapturabilityEquationUsed()) { + fieldUseCapturabilityEquation.setSelected(true); + ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation"); + } + else { + fieldUseCapturabilityEquation.setSelected(false); + ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix"); + } + } +} + ]]> + </script> + <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='horizontal' weightx='1.0' anchor='east'> + <JCheckBox id="fieldUseCapturabilityEquation" selected='{getBean().isCapturabilityEquationUsed()}' + text="isisfish.populationCapturability.useCapturabilityEquation" onActionPerformed='useEquationChanged()' + enabled='{isActive()}' decorator='boxed'/> + </cell> + + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <JPanel id="hidablePanel" layout='{new CardLayout()}'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' + matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"Capturability"' + onMatrixChanged="populationCapturabilityMatrixChanged(event)" + constraints='"fieldUseMatrix"' /> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='capturabilityEquation' constructorParams='this' + text='isisfish.common.capturability' active='{isActive()}' + bean='{getBean()}' formuleCategory='Capturability' beanProperty='CapturabilityEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationCapturabilityEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"CapturabilityEquation"' + constraints='"fieldUseEquation"'/> + </JPanel> + </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' + text="isisfish.common.save" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationEquationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationEquationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationEquationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,106 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Population; + </import> + + <BeanValidator id='validator' context="equation" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); +}*/ + ]]> + </script> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='0.5' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{Population.class}' _sensitivityMethod='"NaturalDeathRate"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{Population.class}' _sensitivityMethod='"MeanWeight"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='maturityOgive' constructorParams='this' + text='isisfish.populationEquation.MaturityOgive' active="{isActive()}" + bean='{getBean()}' formuleCategory='MaturityOgive' beanProperty='MaturityOgiveEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationMaturityOgiveEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MaturityOgiveEquation"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='reproductionRate' constructorParams='this' + text='isisfish.populationEquation.reproductionRate' active="{isActive()}" + bean='{getBean()}' formuleCategory='ReproductionRate' beanProperty='ReproductionRateEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationReproductionRateEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"ReproductionRateEquation"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationGroupUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationGroupUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationGroupUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,262 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<!-- +A terme, cette interface sera appelée à disparaitre. + +La plupart des champs de cette interface sont editable ssi +il n'ont pas d'equation associée. + +Dans le cas contraire, les champs sont désactivés, en lecture +seule, et contiennent les resulats des equations en simple +visualisation. +--> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.PopulationGroup id='populationGroup' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.PopulationGroup; + fr.ifremer.isisfish.entities.Population; + org.nuiton.math.matrix.MatrixND; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + </import> + + <BeanValidator id='validator' context="group" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validatorGroup' context="population" + bean='{getPopulationGroup()}' beanClass='fr.ifremer.isisfish.entities.PopulationGroup' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI" + parentValidator="{getValidator()}"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged() || validatorGroup.isChanged()}" + valid="{validator.isValid() && validatorGroup.isValid()}" /> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setPopulationGroup(null); + } + if (evt.getNewValue() != null) { + if (getBean().getPopulationGroup() != null) { + jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), 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); + } + if (evt.getNewValue() != null) { + + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +/*public void refresh() { + //if (!isActive()) { + setPopGroupNotNull(false); + //} + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); +}*/ + +protected void setNaturalDeathRateMatrix() { + try { + Population population = getBean(); + MatrixND naturalDeathRateMatrix = population.getNaturalDeathRateMatrix(); + + // extract only line for this population group + MatrixND naturalDeathRateMatrix2 = naturalDeathRateMatrix.getSubMatrix(0, getPopulationGroup()); + fieldPopulationGroupNaturalDeathRate.setMatrix(naturalDeathRateMatrix2.copy()); + } catch (Exception e) { + // can happen if population has no zone yet + // TODO maybe display a message + if (log.isWarnEnabled()) { + log.warn("No zone defined for this population group", e); + } + } +} + +/** + * Called on PopulationGroup combo box selection. + */ +protected void populationGroupChanged() { + PopulationGroup selectedPopulationGroup = (PopulationGroup)populationGroupPopulationGroupComboBox.getSelectedItem(); + setPopulationGroup(selectedPopulationGroup); + if (selectedPopulationGroup != null) { + getSaveVerifier().addCurrentEntity(selectedPopulationGroup); + setNaturalDeathRateMatrix(); + } +} + ]]> + </script> + <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.naturalDeathRate" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='1'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' + enabled='false' decorator='boxed' /> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{getPopulationGroup() != null}'/> + </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.maturityOgive" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupMaturityOgive" text='{String.valueOf(getPopulationGroup().getMaturityOgive())}' + enabled="false" decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupReproductionRate" text='{String.valueOf(getPopulationGroup().getReproductionRate())}' + enabled="false" decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.price" enabled='{getPopulationGroup() != null}'/> + </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.age" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- non editable age field --> + <JTextField id="fieldPopulationGroupAge" text='{String.valueOf(getPopulationGroup().getAge())}' + enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.length" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell fill='both' weightx='0.5'> + <!-- non editable min length field --> + <JTextField id="fieldPopulationGroupMinLength" text='{String.valueOf(getPopulationGroup().getMinLength())}' + toolTipText="isisfish.populationGroup.minimumLength" + enabled='false' decorator='boxed' /> + </cell> + <cell fill='both' weightx='0.5'> + <!-- non editable max length field --> + <JTextField id="fieldPopulationGroupMaxLength" text='{String.valueOf(getPopulationGroup().getMaxLength())}' + toolTipText="isisfish.populationGroup.maximumLength" + enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.comments" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='3'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> + <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' + onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{getPopulationGroup() != null}' 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' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorGroup.setChanged(false)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEmigrationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEmigrationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEmigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,187 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <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'/> + + <import> + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.entities.PopulationGroup + fr.ifremer.isisfish.entities.PopulationSeasonInfo + fr.ifremer.isisfish.entities.Zone + org.nuiton.math.matrix.MatrixND + org.nuiton.math.matrix.gui.MatrixPanelEvent + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + org.nuiton.math.matrix.gui.MatrixPanelListener + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + populationMigrationEmigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + refreshPanel(); + } + } + }); +} + +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()); +} + +/*public void refresh(){ + Population population = getSaveVerifier().getEntity(Population.class); + + // setBean(null); useless here + setBean(population); + + refreshPanel(); +}*/ + +public void refreshPanel() { + setFieldPopulationMigrationMigrationGroupChooserModel(); + setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); + setAddButton(); +} + +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 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() { + int row = populationMigrationEmigrationTable.getTable().getSelectedRow(); + if (row != -1) { + Object group = populationMigrationEmigrationTable.getTable().getValueAt(row, 0); + Object arrival = populationMigrationEmigrationTable.getTable().getValueAt(row, 1); + + MatrixND mat = popInfo.getEmigrationMatrix().clone(); + mat.setValue(group, arrival, 0); + popInfo.setEmigrationMatrix(mat); + populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); + } +} +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='false'/> + </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)"/> + </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> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEquationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEquationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationEquationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,81 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.PopulationSeasonInfo; + fr.ifremer.isisfish.entities.Population; + </import> + + <script><![CDATA[ +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(populationSeasonInfo); +} + +/*public void refresh() { + getSaveVerifier().addCurrentPanel(immigrationEquation, emigrationEquation, migrationEquation); +}*/ + ]]> + </script> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"MigrationEquation"'/> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"EmigrationEquation"'/> + </cell> + </row> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ImmigrationEquation"'/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationImmigrationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationImmigrationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationImmigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,183 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <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'/> + + <import> + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.entities.PopulationGroup + fr.ifremer.isisfish.entities.PopulationSeasonInfo + fr.ifremer.isisfish.entities.Zone + org.nuiton.math.matrix.MatrixND + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.gui.MatrixPanelListener + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + populationMigrationImmigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + refreshPanel(); + } + } + }); +} + +protected void populationMigrationImmigrationMatrixChanged(MatrixPanelEvent event) { + if (getPopInfo() != null){ + getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); + } +} + +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(populationSeasonInfo); + + populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); +} + +/*public void refresh(){ + Population population = getVerifier().getEntity(Population.class); + setBean(population); + + refreshPanel(); +}*/ + +public void refreshPanel(){ + setFieldPopulationMigrationMigrationGroupChooserModel(); + setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); + setAddButton(); +} +protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ + if (getBean() != null && getBean().getPopulationGroup() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationImmigrationGroupChooser, getBean().getPopulationGroup(), null, true); + } +} +protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){ + if (getBean() != null && getBean().getPopulationZone() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationImmigrationArrivalZoneChooser, getBean().getPopulationZone(), null, true); + } +} +protected void add() { + getContextValue(InputAction.class).addImmigration(getPopInfo(), + (PopulationGroup) fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem(), + (Zone) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(), + Double.parseDouble(fieldPopulationMigrationImmigrationCoefficient.getText())); + populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().clone()); +} +protected void remove() { + int row = populationMigrationImmigrationTable.getTable().getSelectedRow(); + if (row != -1) { + Object group = populationMigrationImmigrationTable.getTable().getValueAt(row, 0); + Object departure = populationMigrationImmigrationTable.getTable().getValueAt(row, 1); + + MatrixND mat = getPopInfo().getImmigrationMatrix().clone(); + mat.setValue(group, departure, 0); + getPopInfo().setImmigrationMatrix(mat); + populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); + } +} +protected void groupChanged(){ + setGPopSelected(fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem() != null); + setAddButton(); +} +protected void coefChanged(){ + setCoefNonVide(!fieldPopulationMigrationImmigrationCoefficient.getText().equals("")); + setAddButton(); +} +protected void zoneChanged(){ + setZoneDepartSelected(fieldPopulationMigrationImmigrationArrivalZoneChooser.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="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='false'/> + </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)"/> + </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> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationMigrationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationMigrationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationMigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,210 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <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='zoneArrivalSelected' javaBean='false'/> + <Boolean id='coefNonVide' javaBean='false'/> + + <import> + fr.ifremer.isisfish.entities.PopulationSeasonInfo; + fr.ifremer.isisfish.entities.Population; + fr.ifremer.isisfish.entities.PopulationGroup; + fr.ifremer.isisfish.entities.PopulationSeasonInfo; + fr.ifremer.isisfish.entities.Zone; + org.nuiton.math.matrix.MatrixND; + org.nuiton.math.matrix.gui.MatrixPanelEvent; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + org.nuiton.math.matrix.gui.MatrixPanelListener; + javax.swing.text.Document + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + populationMigrationMigrationTable.setMatrix(null); + } + if (evt.getNewValue() != null) { + refreshPanel(); + } + } + }); +} + +protected void populationMigrationMigrationMatrixChanged(MatrixPanelEvent event) { + if (getPopInfo() != null) { + getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix().clone()); + } +} +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); + + populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); +} + +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + // setBean(null); is useless here + setBean(population); + + refreshPanel(); +}*/ + +public void refreshPanel(){ + setFieldPopulationMigrationMigrationGroupChooserModel(); + setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); + setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); + + //setAddButton(); +} +protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ + if (getBean() != null && getBean().getPopulationGroup() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationGroupChooser,getBean().getPopulationGroup(), null, true); + } +} +protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ + if (getBean() != null && getBean().getPopulationZone() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); + } +} +protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){ + if (getBean() != null && getBean().getPopulationZone() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationMigrationArrivalZoneChooser,getBean().getPopulationZone(), null, true); + } +} +protected void add(){ + getAction().addMigration(getPopInfo(), + (PopulationGroup) fieldPopulationMigrationMigrationGroupChooser.getSelectedItem(), + (Zone) fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem(), + (Zone) fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem(), + Double.parseDouble(fieldPopulationMigrationMigrationCoefficient.getText())); + populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().clone()); +} +protected void remove() { + int row = populationMigrationMigrationTable.getTable().getSelectedRow(); + if (row != -1) { + Object group = populationMigrationMigrationTable.getTable().getValueAt(row, 0); + Object departure = populationMigrationMigrationTable.getTable().getValueAt(row, 1); + Object arrival = populationMigrationMigrationTable.getTable().getValueAt(row, 2); + + MatrixND mat = getPopInfo().getMigrationMatrix().clone(); + mat.setValue(group, departure, arrival, 0); + getPopInfo().setMigrationMatrix(mat); + populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); + } +} +/*protected void groupChanged(){ + setGPopSelected(fieldPopulationMigrationMigrationGroupChooser.getSelectedItem() != null); + setAddButton(); +} +protected void coefChanged(){ + setCoefNonVide(!fieldPopulationMigrationMigrationCoefficient.getText().equals("")); + setAddButton(); +} +protected void zoneDepartueChanged(){ + setZoneDepartSelected(fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem() != null); + setAddButton(); +} +protected void zoneArrivalChanged(){ + setZoneArrivalSelected(fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem() != null); + setAddButton(); +}*/ +protected void setAddButton() { + add.setEnabled(isActive() && + fieldPopulationMigrationMigrationGroupChooser.getSelectedItem() != null && + !fieldPopulationMigrationMigrationCoefficient.getText().equals("") && + fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem() != null && + fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem() != null); +} + ]]> + </script> + <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()}' + onItemStateChanged="setAddButton()"/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActive()}'/> + <Document initializer="fieldPopulationMigrationMigrationCoefficient.getDocument()" + onInsertUpdate='setAddButton()' + onRemoveUpdate='setAddButton()' /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActive()}' + onItemStateChanged="setAddButton()"/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActive()}' + onItemStateChanged="setAddButton()"/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='false'/> + </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)" /> + </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> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationMigrationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,224 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + fr.ifremer.isisfish.entities.PopulationSeasonInfo; + fr.ifremer.isisfish.entities.Population; + fr.ifremer.isisfish.ui.models.common.GenericComboModel; + fr.ifremer.isisfish.ui.input.renderer.PopulationSeasonInfoComboRenderer; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + java.awt.CardLayout + </import> + + <BeanValidator id='validator' context="migration" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validatorSeason' context="migration" + bean='{getPopInfo()}' beanClass='fr.ifremer.isisfish.entities.PopulationSeasonInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" + valid="{validator.isValid() && validatorSeason.isValid()}" /> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationMigrationComment.setText(""); + fieldUseEquationMigration.setSelected(false); + } + if (evt.getNewValue() != null) { + refresh(); + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + //setBean(null); + //setBean(population); + + // refresh psi list in combo box + GenericComboModel<PopulationSeasonInfo> model = (GenericComboModel<PopulationSeasonInfo>)fieldPopulationMigrationSeasonChooser.getModel(); + if (getBean() != null) { + PopulationSeasonInfo previousSelected = (PopulationSeasonInfo)model.getSelectedItem(); + model.setElementList(getBean().getPopulationSeasonInfo()); + + // do this to keep selected after cancel/refresh + if (previousSelected != null) { + for (PopulationSeasonInfo psi : getBean().getPopulationSeasonInfo()) { + if (psi.getTopiaId().equals(previousSelected.getTopiaId())) { + model.setSelectedItem(psi); + } + } + } + + seasonChanged(); + } + else { + model.setElementList(null); + } +} + +protected void seasonChanged() { + GenericComboModel<PopulationSeasonInfo> model = (GenericComboModel<PopulationSeasonInfo>)fieldPopulationMigrationSeasonChooser.getModel(); + PopulationSeasonInfo selectedPSI = (PopulationSeasonInfo)model.getSelectedItem(); + setPopInfo(selectedPSI); + if (getPopInfo() != null) { + getSaveVerifier().addCurrentEntity(getPopInfo()); + populationMigrationEquationUI.init(getPopInfo()); + populationMigrationMigrationUI.init(getPopInfo()); + populationMigrationImmigrationUI.init(getPopInfo()); + populationMigrationEmigrationUI.init(getPopInfo()); + } + refreshHidablePanel(); +} +protected void useEquationChanged() { + getPopInfo().setUseEquationMigration(fieldUseEquationMigration.isSelected()); + refreshHidablePanel(); +} +protected void refreshHidablePanel() { + if (getPopInfo() != null) { + if (getPopInfo().isUseEquationMigration()) { + fieldUseEquationMigration.setSelected(true); + ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation"); + } + else { + fieldUseEquationMigration.setSelected(false); + ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix"); + } + } +} +@Override +public void setLayer(boolean active) { + super.setLayer(active); + populationMigrationEquationUI.setLayer(active); +} + ]]> + </script> + <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" + genericType="PopulationSeasonInfo" + model='{new GenericComboModel<PopulationSeasonInfo>()}' + renderer="{new PopulationSeasonInfoComboRenderer()}" + onActionPerformed='seasonChanged()' + enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' anchor='west'> + <JCheckBox id="fieldUseEquationMigration" selected='{getPopInfo().isUseEquationMigration()}' + text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' + enabled='{getPopInfo() != null}' 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='{getPopInfo() != null}'> + <tab title='{t("isisfish.populationMigrationMigration.title")}'> + <PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this' decorator='boxed' + bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" + _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"MigrationMatrix"' /> + </tab> + <tab title='{t("isisfish.populationMigrationImmigration.title")}'> + <PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this' decorator='boxed' + bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" + _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ImmigrationMatrix"' /> + </tab> + <tab title='{t("isisfish.populationMigrationEmigration.title")}'> + <PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this' decorator='boxed' + bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" + _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"EmigrationMatrix"' /> + </tab> + </JTabbedPane> + <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this' + bean="{getBean()}" popInfo="{getPopInfo()}" active="{isActive() && getPopInfo() != null}" /> + </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' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorSeason.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationPriceUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationPriceUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationPriceUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationPriceUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,79 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Population; + </import> + + <BeanValidator id='validator' context="equation" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); +}*/ + ]]> + </script> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.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' _sensitivityBean='{Population.class}' _sensitivityMethod='"Price"'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationRecruitmentUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationRecruitmentUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationRecruitmentUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,177 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2015 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Population; + org.nuiton.math.matrix.gui.MatrixPanelEvent; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + org.nuiton.math.matrix.gui.MatrixPanelListener; + </import> + + <BeanValidator id='validator' context="recruitement" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationMonthGapBetweenReproRecrutement.setText(""); + fieldPopulationRecruitmentComment.setText(""); + } + if (evt.getNewValue() != null) { + + } + } + }); +} + +protected void populationRecruitmentDistributionMatrixChanged(MatrixPanelEvent event) { + if (getBean() != null){ + if (fieldPopulationRecruitmentDistribution.getMatrix() != null){ + getBean().setRecruitmentDistribution(fieldPopulationRecruitmentDistribution.getMatrix().copy()); + } + } +} + +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + if (getBean() != null && getBean().getRecruitmentDistribution() != null) { + fieldPopulationRecruitmentDistribution.setMatrix(getBean().getRecruitmentDistribution().copy()); + + // chatellier : number editor is not working + //fieldPopulationMonthGapBetweenReproRecrutement.init(); + } + + // TODO add only once + //fieldPopulationRecruitmentDistribution.addMatrixListener(listener); +}*/ + ]]> + </script> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='reproductionEquation' constructorParams='this' + active="{isActive()}" text='isisfish.populationEquation.reproductionEquation' + bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"ReproductionEquation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' + bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{PopulationImpl.class}' + _sensitivityMethod='"MonthGapBetweenReproRecrutement"'/--> + <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{String.valueOf(getBean().getMonthGapBetweenReproRecrutement())}' + onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"MonthGapBetweenReproRecrutement"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' + matrix='{getBean() == null ? null : bean.getRecruitmentDistribution().copy()}' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"RecruitmentDistribution"' + onMatrixChanged="populationRecruitmentDistributionMatrixChanged(event)" /> + </cell> + <cell> + <JButton icon="table.png" toolTipText="isisfish.common.newMatrix" + onActionPerformed="getAction().createRecruitmentDistribution(getBean())" + enabled='{isActive()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='recruitmentEquation' constructorParams='this' + active="{isActive()}" text='isisfish.populationEquation.recruitmentEquation' + bean='{getBean()}' formuleCategory='Recruitment' beanProperty='RecruitmentEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationRecruitmentEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"RecruitmentEquation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActive()}'/> + </cell> + <cell columns='2' 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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonSpacializedUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonSpacializedUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonSpacializedUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,160 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> + + <Boolean id='ageGroupType' javaBean='false'/> + + <import> + static org.nuiton.i18n.I18n.t + fr.ifremer.isisfish.entities.PopulationSeasonInfo; + fr.ifremer.isisfish.ui.util.ErrorHelper; + org.nuiton.math.matrix.MatrixND; + org.nuiton.math.matrix.gui.MatrixPanelEditor; + org.nuiton.math.matrix.gui.MatrixPanelEvent; + org.nuiton.math.matrix.gui.MatrixPanelListener; + javax.swing.JOptionPane + </import> + + <script><![CDATA[ +protected void populationSeasonLengthMatrixChanged(MatrixPanelEvent event) { + if (getPopulationSeasonInfo() != null && matrixPanelPopulationSeasonLengthChange.getMatrix() != null) { + // must be a copy for fire event + MatrixND lengthChangeMatrix = matrixPanelPopulationSeasonLengthChange.getMatrix().copy(); + getPopulationSeasonInfo().setLengthChangeMatrix(lengthChangeMatrix); + } +} + +/*public void refresh() { + // TODO add only once + //matrixPanelPopulationSeasonLengthChange.addMatrixListener(matrixPanelListener); +}*/ + +/** + * Called on spacialized radio button change. + */ +protected void spacializedActionPerformed() { + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); + boolean spacializedSelection = radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected(); + popInfo.setSimpleLengthChangeMatrix(spacializedSelection); + try { + MatrixND lengthChangeMatrix = popInfo.getLengthChangeMatrix(); + if (lengthChangeMatrix != null) { + if (popInfo.isSimpleLengthChangeMatrix()) { + lengthChangeMatrix = popInfo.unspacializeLengthChangeMatrix(lengthChangeMatrix); + } else { + lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); + } + popInfo.setLengthChangeMatrix(lengthChangeMatrix); + matrixPanelPopulationSeasonLengthChange.setMatrix(lengthChangeMatrix); + } + } catch(Exception eee) { + if (log.isErrorEnabled()) { + log.error("Can't (un)spacialize Matrix Change Of Group", eee); + } + ErrorHelper.showErrorDialog(t("isisfish.error.input.spacializematrix"), eee); + } +} + +protected void computeMatrixChangeOfGroup() { + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); + MatrixND lengthChangeMatrix = popInfo.computeLengthChangeMatrix(); + if (!popInfo.isSimpleLengthChangeMatrix()){ + lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); + } + popInfo.setLengthChangeMatrix(lengthChangeMatrix); +} + +protected void showSpacializedMatrixChangeOfGroup() { + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); + MatrixND lengthChangeMatrix = popInfo.getLengthChangeMatrix(); + if (popInfo.isSimpleLengthChangeMatrix()) { + lengthChangeMatrix = popInfo.spacializeLengthChangeMatrix(lengthChangeMatrix); + } + MatrixPanelEditor panel = new MatrixPanelEditor(false, 800, 300); + panel.setMatrix(lengthChangeMatrix); + JOptionPane.showMessageDialog(this, panel, t("isisfish.populationSeasons.spacialized.visualisation"), JOptionPane.INFORMATION_MESSAGE); +} + ]]></script> + + <JPanel id='body'> + <Table> + <row> + <cell> + <Panel/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" + buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" + selected='{getPopulationSeasonInfo().isSimpleLengthChangeMatrix()}' + enabled='{getPopulationSeasonInfo() != null}' + text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' + visible='{isAgeGroupType()}' decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" + buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" + selected='{!getPopulationSeasonInfo().isSimpleLengthChangeMatrix()}' + enabled='{getPopulationSeasonInfo() != null}' + text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' + visible='{isAgeGroupType()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}' + enabled='{getPopulationSeasonInfo() != null}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' + enabled='{getPopulationSeasonInfo() != null}' onActionPerformed='computeMatrixChangeOfGroup()'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" + enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected() && getPopulationSeasonInfo() != null}' + onActionPerformed='showSpacializedMatrixChangeOfGroup()' + visible='{isAgeGroupType()}' decorator='boxed'/> + </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='{getPopulationSeasonInfo() != null}' + _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"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> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonsUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,375 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> + + <import> + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.models.common.GenericComboModel + fr.ifremer.isisfish.entities.PopulationSeasonInfo + fr.ifremer.isisfish.types.Month + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.ui.widget.Interval + org.nuiton.math.matrix.MatrixND + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.gui.MatrixPanelListener + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <BeanValidator id='validator' context="seasons" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validatorSeason' context="population" + bean='{getPopulationSeasonInfo()}' beanClass='fr.ifremer.isisfish.entities.PopulationSeasonInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI" + parentValidator="{getValidator()}"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged() || validatorSeason.isChanged()}" + valid="{validator.isValid() && validatorSeason.isValid()}" /> + + <script><![CDATA[ +protected Interval seasonInterval; + +protected boolean init = false; + +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(); + } + } + }); + + /* + * 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(); + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +protected void create() { + PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); + setPopulationSeasonInfo(seasonNew); + setPopulationSeasonInfoCombo(); +} + +protected void delete() { + getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); + setPopulationSeasonInfo(null); + setPopulationSeasonInfoCombo(); +} + +protected void save() { + getSaveVerifier().save(); + setPopulationSeasonInfoCombo(); +} + +protected void populationSeasonReproductionDistributionMatrixChanged(MatrixPanelEvent event) { + if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { + MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); + if (log.isDebugEnabled()) { + log.debug("Matrix ReproductionDistribution modified : " + reproductionDistribution); + } + getPopulationSeasonInfo().setReproductionDistribution(reproductionDistribution); + } +} + +public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + //setBean(null); + //setBean(population); + + setPopulationSeasonInfo(null); + + // Model instanciation + seasonInterval = new Interval(); + seasonInterval.setMin(0); + seasonInterval.setMax(11); + seasonInterval.setFirst(0); + seasonInterval.setLast(2); + + setPopulationSeasonInfoCombo(); + setSeasonInterval(); + + seasonIntervalPanel.setLabelRenderer(Month.MONTH); + seasonIntervalPanel.setModel(seasonInterval); + + //fieldPopulationSeasonReproductionDistribution.addMatrixListener(matrixPanelListener); + + /*if(getPopulationSeasonInfo() != null) { + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); + setPopulationSeasonInfo(null); + setPopulationSeasonInfo(popInfo); + getSaveVerifier().addCurrentEntity(getPopulationSeasonInfo()); + }*/ + //getSaveVerifier().addCurrentPanel(populationSeasonSpecializedUI); +} + +protected void setSeasonInterval() { + if(getPopulationSeasonInfo() != null) { + try { + if (log.isDebugEnabled()) { + log.debug("Updating interval : "); + } + Month firstMonth = getPopulationSeasonInfo().getFirstMonth(); + + if (firstMonth != null) { + seasonInterval.setFirst(firstMonth.getMonthNumber()); + + if (log.isDebugEnabled()) { + log.debug(" first : " + seasonInterval.getFirst()); + } + } else { + seasonInterval.setFirst(0); + } + + Month lastMonth = getPopulationSeasonInfo().getLastMonth(); + if (lastMonth != null) { + seasonInterval.setLast(lastMonth.getMonthNumber()); + if (log.isDebugEnabled()) { + log.debug(" last : " + seasonInterval.getLast()); + } + } else { + seasonInterval.setLast(3); + } + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't display interval", e); + } + } + } +} + +protected void setPopulationSeasonInfoCombo() { + if (getBean() != null) { + GenericComboModel<PopulationSeasonInfo> populationSeasonInfoModel = new GenericComboModel<>(getBean().getPopulationSeasonInfo()); + fieldPopulationSeasonInfoChooser.setModel(populationSeasonInfoModel); + populationSeasonInfoModel.setSelectedItem(getPopulationSeasonInfo()); + } +} + +protected void seasonGroupChanged() { + if (getPopulationSeasonInfo() != null) { + getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected()); + } +} + +protected void seasonChanged() { + init = true; + PopulationSeasonInfo seasonInfoSelected = (PopulationSeasonInfo)fieldPopulationSeasonInfoChooser.getSelectedItem(); + if (log.isDebugEnabled()) { + log.debug("Season changed : " + seasonInfoSelected); + } + setPopulationSeasonInfo(seasonInfoSelected); + if (seasonInfoSelected != null) { + getSaveVerifier().addCurrentEntity(seasonInfoSelected); + } + setSeasonInterval(); + setReproductionDistributionMatrix(); + init = false; +} + +protected void setReproductionDistributionMatrix() { + if (getPopulationSeasonInfo() != null){ + MatrixND reproductionDistribution = getPopulationSeasonInfo().getReproductionDistribution(); + // must be a copy (otherwise, modify current entity matrix) + if (reproductionDistribution != null){ + fieldPopulationSeasonReproductionDistribution.setMatrix(reproductionDistribution.copy()); + } + } +} + +// TODO une methode isXXX ne prend pas de parametre +// et ne fait rien +protected boolean isAgeGroupType(boolean result) { + populationSeasonSpecializedUI.setVisible(result); + return result; +} + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + populationSeasonSpecializedUI.setLayer(active); +} + ]]> + </script> + <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'> + <JComboBox id="fieldPopulationSeasonInfoChooser" + genericType="PopulationSeasonInfo" + onItemStateChanged='seasonChanged()' enabled='{isActive() && (isSensitivity() || !changeModel.isChanged() ) }' + renderer="{new fr.ifremer.isisfish.ui.input.renderer.PopulationSeasonInfoComboRenderer()}"/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.common.season" enabled='{getPopulationSeasonInfo() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' + enabled='{getPopulationSeasonInfo() != null}' 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().isGroupChange()}' + decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"GroupChange"' + onActionPerformed='seasonGroupChanged()' enabled='{getPopulationSeasonInfo() != null}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().isAgeGroupType())}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> + <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' constructorParams='this' bean='{getBean()}' + populationSeasonInfo='{getPopulationSeasonInfo()}' + ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().isAgeGroupType())}'/> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().isReproduction()}' + onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' + text="isisfish.populationSeasons.Reproduction" enabled='{getPopulationSeasonInfo() != null}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{getPopulationSeasonInfo() != null}' + visible='{getPopulationSeasonInfo().isReproduction()}'/> + </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='{getPopulationSeasonInfo() != null}' + visible='{getPopulationSeasonInfo().isReproduction()}' + decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ReproductionDistribution"' + onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.comments" enabled='{getPopulationSeasonInfo() != null}'/> + </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='{getPopulationSeasonInfo() != null}' 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' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="save();validator.setChanged(false);validatorSeason.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!changeModel.isChanged()}" + onActionPerformed="create()"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{getPopulationSeasonInfo() != null}" + onActionPerformed="delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,120 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueGears")); + setNextPath(n("isisfish.input.tree.gears")); + + // install change listener + // (depends on sensitivity can't be done on constructor) + installChangeListener(populationTab); +} + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + populationBasicsUI.setLayer(active); + populationZoneUI.setLayer(active); + populationSeasonsUI.setLayer(active); + populationEquationUI.setLayer(active); + populationRecruitementUI.setLayer(active); + populationGroupUI.setLayer(active); + populationCapturabilityUI.setLayer(active); + populationMigrationUI.setLayer(active); + populationPriceUI.setLayer(active); + variablesUI.setLayer(active); +} + +@Override +public void resetChangeModel() { + populationBasicsUI.resetChangeModel(); + populationZoneUI.resetChangeModel(); + populationSeasonsUI.resetChangeModel(); + populationEquationUI.resetChangeModel(); + populationRecruitementUI.resetChangeModel(); + populationGroupUI.resetChangeModel(); + populationCapturabilityUI.resetChangeModel(); + populationMigrationUI.resetChangeModel(); + populationPriceUI.resetChangeModel(); + variablesUI.resetChangeModel(); +} + ]]> + </script> + <JPanel id='body'> + <JTabbedPane id="populationTab"> + <!-- Saisie des populations --> + <tab title='isisfish.populationBasics.title'> + <PopulationBasicsUI id='populationBasicsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Zones --> + <tab title='isisfish.populationZones.title'> + <PopulationZonesUI id='populationZoneUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Saisons --> + <tab title='isisfish.populationSeasons.title'> + <PopulationSeasonsUI id='populationSeasonsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Saisie des équations --> + <tab title='isisfish.populationEquation.title'> + <PopulationEquationUI id='populationEquationUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Saisie des reproductions --> + <tab title='isisfish.populationRecruitment.title'> + <PopulationRecruitmentUI id='populationRecruitementUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Saisie des groupes de population --> + <tab title='isisfish.populationGroup.title'> + <PopulationGroupUI id='populationGroupUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!--Capturabilité --> + <tab title='isisfish.populationCapturability.title'> + <PopulationCapturabilityUI id='populationCapturabilityUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Migration --> + <tab title='isisfish.populationMigration.title'> + <PopulationMigrationUI id='populationMigrationUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <!-- Price --> + <tab title='isisfish.populationPrice.title'> + <PopulationPriceUI id='populationPriceUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.variables.tabtitle'> + <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI" + bean="{getBean()}" active="{isActive()}" + sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesEditorUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesEditorUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesEditorUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,202 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Zone + fr.ifremer.isisfish.ui.models.common.GenericListModel + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.gui.MatrixPanelListener + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.util.List + java.util.ArrayList + java.awt.Dimension + </import> + + <script><![CDATA[ +protected boolean init = false; + +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) { + init = true; + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + init = false; + } + } + }); +} + +protected void populationMappingZoneReproZoneRecruMatrixChanged(MatrixPanelEvent event) { + getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().clone()); +} + +/*public void refresh() { + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + //fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener); + setFieldPopulationMappingZoneReproZoneRecru(); + //fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); +}*/ + +protected void setFieldPopulationMappingZoneReproZoneRecru() { + if (getBean() != null) { + if (getBean().getMappingZoneReproZoneRecru() != null) { + fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy()); + } + } +} +protected void setPopulationZonesPresenceModel() { + if (getBean() != null) { + java.util.List<Zone> zones = getFisheryRegion().getZone(); + setModel(zones, getBean().getPopulationZone(), populationZonesPresence); + } +} +protected void setFieldPopulationZonesReproductionModel(List<Zone> zones) { + if (getBean() != null) { + setModel(zones, getBean().getReproductionZone(), fieldPopulationZonesReproduction); + } +} +protected void setFieldPopulationZonesRecruitmentModel(List<Zone> zones) { + if (getBean() != null) { + setModel(zones, getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment); + } +} + +/** + * Change model of {@code associatedList} with all available zones, but keep + * selection with {@code selectedZones}. + */ +protected void setModel(List<Zone> availableZones, List<Zone> selectedZones, JList associatedList) { + GenericListModel<Zone> zoneModel = new GenericListModel<>(availableZones); + associatedList.setModel(zoneModel); + + // can be null at population init + if (selectedZones != null) { + for (Zone selectedZone : selectedZones) { + int index = availableZones.indexOf(selectedZone); + associatedList.addSelectionInterval(index, index); + } + } +} + +protected void presenceChanged() { + if (!init) { + getBean().setPopulationZone(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + } +} + +protected void reproductionChanged() { + if (!init) { + getBean().setReproductionZone(getSelectedValues(fieldPopulationZonesReproduction)); + setFieldPopulationMappingZoneReproZoneRecru(); + } +} + +protected void recruitementChanged() { + if (!init) { + getBean().setRecruitmentZone(getSelectedValues(fieldPopulationZonesRecruitment)); + setFieldPopulationMappingZoneReproZoneRecru(); + } +} + +/** + * Get selected values for components as list. + */ +protected List<Zone> getSelectedValues(JList component) { + Object[] selectedValues = component.getSelectedValues(); + List<Zone> selectedZone = new ArrayList<Zone>(); + for (Object value : selectedValues) { + selectedZone.add((Zone)value); + } + return selectedZone; +} + ]]> + </script> + <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" onValueChanged='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" onValueChanged='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" onValueChanged='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)" + decorator='boxed' + _sensitivityBean='{fr.ifremer.isisfish.entities.Population.class}' _sensitivityMethod='"MappingZoneReproZoneRecru"' /> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationZonesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,78 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + + <BeanValidator id='validator' context="zones" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(population); + + getSaveVerifier().addCurrentPanel(popZones); +}*/ + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + popZones.setLayer(active); +} + ]]> + </script> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1'> + <PopulationZonesEditorUI id='popZones' constructorParams='this' + bean='{getBean()}' active='{isActive()}'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/WizardGroupCreationUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/WizardGroupCreationUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/WizardGroupCreationUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,582 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JPanel id="wizardGroup" layout='{new BorderLayout()}'> + <import> + org.nuiton.topia.TopiaContext + fr.ifremer.isisfish.IsisFishDAOHelper + fr.ifremer.isisfish.entities.Equation + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.entities.PopulationGroup + fr.ifremer.isisfish.entities.PopulationGroupDAO + java.awt.CardLayout + javax.swing.JFrame + </import> + + <script><![CDATA[ + + protected String current = null; + protected boolean ageType = false; + protected boolean inputType = false; + protected boolean sameSizeType = false; + protected boolean growthCurveType = false; + + protected double first = 0; + protected double last = 0; + + protected String maxLength = ""; + protected int numberOfGroup = 0; + protected double groupSize = 0; + + protected double step = 1; + protected PopulationBasicsUI popBasic; + + public void init(PopulationBasicsUI popBasic) { + this.popBasic = popBasic; + } + + /** + * @return Returns the ageType. + */ + public boolean isAgeType() { + return this.ageType; + } + + /** + * @param ageType The ageType to set. + */ + public void setAgeType(boolean ageType) { + this.ageType = ageType; + } + + /** + * @return Returns the inputType. + */ + public boolean isInputType() { + return this.inputType; + } + + /** + * @param inputType The inputType to set. + */ + public void setInputType(boolean inputType) { + this.inputType = inputType; + } + + /** + * @return Returns the sameSizeType. + */ + public boolean isSameSizeType() { + return this.sameSizeType; + } + + /** + * @param sameSizeType The sameSizeType to set. + */ + public void setSameSizeType(boolean sameSizeType) { + this.sameSizeType = sameSizeType; + } + + /** + * @return Returns the growthCurveType. + */ + public boolean isGrowthCurveType() { + return this.growthCurveType; + } + + /** + * @param growthCurveType The growthCurveType to set. + */ + public void setGrowthCurveType(boolean growthCurveType) { + this.growthCurveType = growthCurveType; + } + + /** + * @return Returns the first. + */ + public double getFirst() { + return this.first; + } + + /** + * @param first The first to set. + */ + public void setFirst(double first) { + this.first = first; + } + + /** + * @return Returns the last. + */ + public double getLast() { + return this.last; + } + + /** + * @param last The last to set. + */ + public void setLast(double last) { + this.last = last; + } + + /** + * @return Returns the maxLength. + */ + public String getMaxLength() { + return this.maxLength; + } + + /** + * @param maxLength The maxLength to set. + */ + public void setMaxLength(String maxLength) { + this.maxLength = maxLength; + } + + /** + * @return Returns the numberOfGroup. + */ + public int getNumberOfGroup() { + return this.numberOfGroup; + } + + /** + * @param numberOfGroup The numberOfGroup to set. + */ + public void setNumberOfGroup(int numberOfGroup) { + this.numberOfGroup = numberOfGroup; + } + + /** + * @return Returns the groupSize. + */ + public double getGroupSize() { + return this.groupSize; + } + + /** + * @param groupSize The groupSize to set. + */ + public void setGroupSize(double groupSize) { + this.groupSize = groupSize; + } + + /** + * @return Returns the step. + */ + public double getStep() { + return this.step; + } + + /** + * @param step The step to set. + */ + public void setStep(double step) { + this.step = step; + } + + public void setCard(String name){ + current = name; + ((CardLayout) wizardPanels.getLayout()).show(wizardPanels, name); + } + protected void prev(){ + if (isAgeType()) { + // do nothing only one panel + } else { + setCard("beginGroupLength"); + } + prev.setEnabled(false); + next.setEnabled(true); + finish.setEnabled(false); + } + protected void next(){ + if (isAgeType()) { + // do nothing only one panel + } else if (isInputType()) { + setCard("endInputGroupLength"); + } else if (isSameSizeType()) { + setCard("endSameSizeGroupLength"); + } else if (isGrowthCurveType()) { + setCard("endGrowthCurveGroupLength"); + } + prev.setEnabled(true); + next.setEnabled(false); + finish.setEnabled(true); + } + protected void finish() { + if (log.isDebugEnabled()) { + log.debug("wizardGroupFinish called"); + } + + try { + Population pop = popBasic.getBean(); + // remove all old group + pop.clearPopulationGroup(); + + TopiaContext isisContext = pop.getTopiaContext(); + PopulationGroupDAO populationGroupDAO = IsisFishDAOHelper.getPopulationGroupDAO(isisContext); + + if (isAgeType()) { + double ageFirst = getFirst(); + double ageLast = getLast(); + for (int id=0; id + ageFirst <= ageLast; id++) { + PopulationGroup group = populationGroupDAO.create(); + group.setId(id); + group.setPopulation(pop); + group.setAge(ageFirst + id); + pop.addPopulationGroup(group); + populationGroupDAO.update(group); + } + } else if (isInputType()) { + double minLength = getFirst(); + String [] values = getMaxLength().split(";"); + for(int i=0; i<values.length; i++){ + if (!"".equals(values[i])) { + double length = Double.parseDouble(values[i]); + PopulationGroup group = populationGroupDAO.create(); + group.setId(i); + group.setPopulation(pop); + group.setMinLength(minLength); + group.setMaxLength(length); + pop.addPopulationGroup(group); + populationGroupDAO.update(group); + minLength = length; + } + } + + } else if (isSameSizeType()) { + double minLength = getFirst(); + int numberOfGroup = getNumberOfGroup(); + double step = getGroupSize(); + if (numberOfGroup < 0){ +// return new OutputView("Error.xml", "error", t("isisfish.error.number.classes.upper.zero")); + } + if (step == 0){ +// return new OutputView("Error.xml", "error", t"isisfish.error.no.null.time.step")); + } + + double maxLength = minLength; + for(int i=0; i<numberOfGroup; i++){ + maxLength = minLength + step; + PopulationGroup group = populationGroupDAO.create(); + group.setId(i); + group.setPopulation(pop); + group.setMinLength(minLength); + group.setMaxLength(maxLength); + pop.addPopulationGroup(group); + populationGroupDAO.update(group); + minLength = maxLength; + } + } else if (isGrowthCurveType()) { + double minLength = getFirst(); + int numberOfGroup = getNumberOfGroup(); + int step = (int)getStep(); + + Equation equation = pop.getGrowth(); + if(equation == null){ +// return new OutputView("Error.xml", "error", t("isisfish.error.growth.equation.before.create.group.population")); + } + double deltat = -1; + double Lmin = minLength; + for(int i=0; i<numberOfGroup; i++){ + // on creer la classe avec une valeur Lmax fausses ... + PopulationGroup group = populationGroupDAO.create(); + group.setId(i); + group.setPopulation(pop); + group.setMinLength(Lmin); + group.setMaxLength(Lmin); + pop.addPopulationGroup(group); + + if(deltat < 0) { + // premier passage, recuperation de l'age minimum + deltat = pop.getAge(minLength, group); + } + // incrementation pour calculer la longueur max de la classe + deltat += step; + + // ... pour pouvoir avoir la classe pour l'equation + double Lmax = pop.getLength(deltat, group); + group.setMaxLength(Lmax); + Lmin = Lmax; + } + } + popBasic.refresh(); + cancel(); + } + catch(Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't create PopulationGroup", e); + } + } + + } + protected void cancel(){ + getParentContainer(JFrame.class).dispose(); + } + protected void refreshChoice(){ + setInputType(beginGroupLengthTypeInput.isSelected()); + setSameSizeType(beginGroupLengthTypeSameSize.isSelected()); + setGrowthCurveType(beginGroupLengthTypeGrowthCurve.isSelected()); + } + protected void stepChanged(){ + if (!fieldStep.getText().equals("")){ + setStep(Double.parseDouble(fieldStep.getText())); + } + } + protected void firstAgeChanged(){ + if (!firstAge.getText().equals("")){ + setFirst(Double.parseDouble(firstAge.getText())); + } + } + protected void lastAgeChanged(){ + if(!lastAge.getText().equals("")){ + setLast(Double.parseDouble(lastAge.getText())); + } + } + protected void firstInputLengthChanged(){ + if(!firstInputLength.getText().equals("")){ + setFirst(Double.parseDouble(firstInputLength.getText())); + } + } + protected void maximalGroupsLengthChanged(){ + if(!maximalGroupsLength.getText().equals("")){ + setMaxLength(maximalGroupsLength.getText()); + } + } + protected void firstSizeLengthChanged(){ + if(!firstSizeLength.getText().equals("")){ + setFirst(Double.parseDouble(firstSizeLength.getText())); + } + } + protected void sameSizeNumberOfGroupChanged(){ + if(!sameSizeNumberOfGroup.getText().equals("")){ + setNumberOfGroup(Integer.parseInt(sameSizeNumberOfGroup.getText())); + } + } + protected void groupWidthChanged(){ + if(!groupWidth.getText().equals("")){ + setGroupSize(Double.parseDouble(groupWidth.getText())); + } + } + protected void growthCurveFirstGroupChanged(){ + if(!growthCurveFirstGroup.getText().equals("")){ + setFirst(Double.parseDouble(growthCurveFirstGroup.getText())); + } + } + protected void fieldNumberOfGroupChanged(){ + if(!fieldNumberOfGroup.getText().equals("")){ + setNumberOfGroup(Integer.parseInt(fieldNumberOfGroup.getText())); + } + } + ]]> + </script> + <JPanel id="wizardPanels" layout='{new CardLayout()}' constraints='BorderLayout.CENTER'> + <Table constraints='"beginGroupLength"'> + <row> + <cell fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.selectGroupLengthType" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeInput" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allValues" onActionPerformed='refreshChoice()'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeSameSize" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.allGroupsSameSize" onActionPerformed='refreshChoice()'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JRadioButton id="beginGroupLengthTypeGrowthCurve" buttonGroup="groupLengthType" text="isisfish.wizardGroupCreation.computedGrowthCurve" onActionPerformed='refreshChoice()'/> + </cell> + </row> + </Table> + <Table constraints='"singleGroupAge"'> + <row> + <cell fill='horizontal' weightx='1.0' columns='2'> + <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.firstAge"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="firstAge" onFocusLost='firstAgeChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.lastAge"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="lastAge" onFocusLost='lastAgeChanged()'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.firstAgeHelp'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.lastAgeHelp'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.gapBetweenGroupsHelp'/> + </cell> + </row> + </Table> + <Table constraints='"endInputGroupLength"'> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.firstLength"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="firstInputLength" onFocusLost='firstInputLengthChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.maxGroupsLength"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="maximalGroupsLength" onFocusLost='maximalGroupsLengthChanged()'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.maxGroupsLengthHelp"/> + </cell> + </row> + </Table> + <Table constraints='"endSameSizeGroupLength"'> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.firstLength"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="firstSizeLength" onFocusLost='firstSizeLengthChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.numberGroup"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="sameSizeNumberOfGroup" onFocusLost='sameSizeNumberOfGroupChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.groupWidth"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="groupWidth" onFocusLost='groupWidthChanged()'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.firstLengthHelp'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.numberGroupHelp'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text='isisfish.wizardGroupCreation.groupWidthHelp'/> + </cell> + </row> + </Table> + <Table constraints='"endGrowthCurveGroupLength"'> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.firstGroup"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="growthCurveFirstGroup" onFocusLost='growthCurveFirstGroupChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.numberGroups"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldNumberOfGroup" onFocusLost='fieldNumberOfGroupChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.wizardGroupCreation.timeStep"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldStep" onFocusLost='stepChanged()'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel text="isisfish.wizardGroupCreation.undefinedGrowthEquation"/> + </cell> + </row> + </Table> + </JPanel> + <Table id="navButton" constraints='BorderLayout.SOUTH'> + <row> + <cell fill='horizontal' weightx='0.2'> + <JButton id='prev' enabled='false' text="isisfish.common.prev" onActionPerformed='prev()'/> + </cell> + <cell fill='horizontal' weightx='0.2'> + <JButton id='next' text="isisfish.common.next" onActionPerformed='next()'/> + </cell> + <cell fill='horizontal' weightx='0.2'> + <JButton id='finish' enabled='false' text="isisfish.common.finish" onActionPerformed='finish()'/> + </cell> + <cell fill='horizontal' weightx='0.2'> + <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()'/> + </cell> + </row> + </Table> +</JPanel> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/port/PortUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/port/PortUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/port/PortUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,197 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Port'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Port id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + fr.ifremer.isisfish.entities.Port + fr.ifremer.isisfish.entities.Cell + fr.ifremer.isisfish.map.CellSelectionLayer + fr.ifremer.isisfish.map.CopyMapToClipboardListener + fr.ifremer.isisfish.map.OpenMapEvents + com.bbn.openmap.event.SelectMouseMode + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.awt.event.MouseEvent + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Port' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldPortName" /> + <field name="cell" component="spPortCell" /> + </BeanValidator> + + <script><![CDATA[ +boolean portChanged = true; + +protected void $afterCompleteSetup() { + + //portMap.init(portMapInfo); + new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + if (getBean() != null) { // impossible de desactiver la carte :( + for (Cell c : portMap.getSelectedCells()) { + if (getBean().getCell() != null) { + if (!getBean().getCell().getTopiaId().equals(c.getTopiaId())){ + portCell.setSelectedValue(c); + return true; + } + } + else { + portCell.setSelectedValue(c); + return true; + } + } + } + return true; + } + }; + + setButtonTitle(t("isisfish.input.continueSpecies")); + setNextPath(n("isisfish.input.tree.species")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPortName.setText(""); + fieldPortComment.setText(""); + } + if (evt.getNewValue() != null) { + fillCellList(); + } + } + }); +} + +/*public void refresh() { + Port port = getSaveVerifier().getEntity(Port.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(port); + // reload region in map + refreshRegionInMap(portMap); +}*/ + +protected void fillCellList() { + if (getBean() != null) { + portChanged = false; + portCell.fillList(getFisheryRegion().getCell(), getBean().getCell()); + portCell.setSelectedValue(getBean().getCell()); + portChanged = true; + } +} + +protected void portChanged() { + if (portChanged) { + getBean().setCell((Cell)portCell.getSelectedValue()); + } +} + ]]></script> + <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 id="spPortCell"> + <JAXXList id="portCell" selectedValue='{getBean().getCell()}' selectionMode="0" + onValueChanged='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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Port.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <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='{getFisheryRegion()}' + selectedCells='{getBean() == null ? null : bean.getCell()}' /> + <com.bbn.openmap.InformationDelegator id="portMapInfo" constraints='BorderLayout.SOUTH' /> + </JPanel> + </JSplitPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/FormuleComboRenderer.java (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/FormuleComboRenderer.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/FormuleComboRenderer.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,69 @@ +/* + * #%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 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.renderer; + +import java.awt.Component; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; +import javax.swing.JList; + +import fr.ifremer.isisfish.entities.Formule; + +/** + * Renderer pour la combo des {@link Formule}. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FormuleComboRenderer extends DefaultListCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID = -8277883340386163087L; + + /* + * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) + */ + @Override + public Component getListCellRendererComponent(JList<?> list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + + // this must be used to have alterned highlight rows and default + // selection color + JLabel c = (JLabel) super.getListCellRendererComponent(list, value, + index, isSelected, cellHasFocus); + + // there is no default selection + if (value != null) { + Formule formule = (Formule) value; + c.setText(formule.getName()); + } + return c; + } +} Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionParametersUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionParametersUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionParametersUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,330 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2015 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.EffortDescription id='effortDescription' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + java.util.ArrayList; + fr.ifremer.isisfish.entities.EffortDescription; + fr.ifremer.isisfish.entities.SetOfVessels; + fr.ifremer.isisfish.types.TimeUnit; + fr.ifremer.isisfish.ui.models.common.GenericListModel; + fr.ifremer.isisfish.ui.input.renderer.EffortDescriptionListRenderer; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + </import> + + <BeanValidator id='validator' context="effortdescriptionparameters" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validatorEffort' context="setofvessels" + bean='{getEffortDescription()}' beanClass='fr.ifremer.isisfish.entities.EffortDescription' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator.isChanged() || validatorEffort.isChanged()}" + valid="{validator.isValid() && validatorEffort.isValid()}"/> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setEffortDescription(null); + } + if (evt.getNewValue() != null) { + GenericListModel<EffortDescription> model = new GenericListModel<>(); + // getBean().getPossibleMetiers() can be null at region creation + if (getBean() != null && getBean().getPossibleMetiers() != null) { + List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); + model.setElementList(effortDescriptions); + } + fieldEffortDescriptionEffortDescriptionList.setModel(model); + } + } + }); + addPropertyChangeListener(PROPERTY_EFFORT_DESCRIPTION, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (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) { + // FIX non working binding in jaxx 2.4.1 + if (getEffortDescription().getFishingOperationDuration() == null) { + fieldEffortDescriptionFishingOperationDuration.setText(""); + } + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +/*public void refresh() { + SetOfVessels setOfVessels = getSaveVerifier().getEntity(SetOfVessels.class); + + // twice event for jaxx bindings detection + setBean(null); + setBean(setOfVessels); +}*/ + +protected void effortDescriptionSelectionChanged() { + EffortDescription selectedEffort = (EffortDescription)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); + setEffortDescription(selectedEffort); + + if (getEffortDescription() != null) { + getSaveVerifier().addCurrentEntity(getEffortDescription()); + selectedEffort.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + changeModel.setStayChanged(true); + } + }); + + /* NumberEditor is not working + fieldEffortDescriptionFishingOperation.init(); + fieldEffortDescriptionGearsNumberPerOperation.init(); + fieldEffortDescriptionCrewSize.init(); + fieldEffortDescriptionUnitCostOfFishing.init(); + fieldEffortDescriptionFixedCrewSalary.init(); + fieldEffortDescriptionCrewFoodCost.init(); + fieldEffortDescriptionCrewShareRate.init(); + fieldEffortDescriptionRepairAndMaintenanceGearCost.init(); + fieldEffortDescriptionLandingCosts.init(); + fieldEffortDescriptionOtherRunningCost.init();*/ + } +} + ]]> + </script> + <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}" + genericType="EffortDescription" + onValueChanged='effortDescriptionSelectionChanged()' + cellRenderer='{new EffortDescriptionListRenderer()}' + enabled='{isActive()}' /> + </JScrollPane> + </cell> + <cell columns='2' fill='both' weightx='1.0'> + <Table border='{BorderFactory.createTitledBorder(t("isisfish.effortDescription.effortTitle"))}'> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{getEffortDescription() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldEffortDescriptionFishingOperation' constructorParams='this' + bean='{getEffortDescription()}' property='fishingOperation' + enabled='{isActive()}' decorator='boxed' useSign='true' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperation"'/--> + <JFormattedTextField id="fieldEffortDescriptionFishingOperation" text='{String.valueOf(getEffortDescription().getFishingOperation())}' + onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{getEffortDescription() != null}'/> + </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='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FishingOperationDuration"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{getEffortDescription() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldEffortDescriptionGearsNumberPerOperation' constructorParams='this' + bean='{getEffortDescription()}' property='gearsNumberPerOperation' + enabled='{isActive()}' decorator='boxed' useSign='true' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"GearsNumberPerOperation"'/--> + <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{String.valueOf(getEffortDescription().getGearsNumberPerOperation())}' + onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"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(t("isisfish.effortDescription.economicTitle"))}'> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewSize" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewSize"'/--> + <JTextField id="fieldEffortDescriptionCrewSize" text='{String.valueOf(getEffortDescription().getCrewSize())}' + onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewSize"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"UnitCostOfFishing"'/--> + <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{String.valueOf(getEffortDescription().getUnitCostOfFishing())}' + onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"UnitCostOfFishing"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FixedCrewSalary"'/--> + <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{String.valueOf(getEffortDescription().getFixedCrewSalary())}' + onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"FixedCrewSalary"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewFoodCost"'/--> + <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{String.valueOf(getEffortDescription().getCrewFoodCost())}' + onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewFoodCost"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewShareRate"'/--> + <JTextField id="fieldEffortDescriptionCrewShareRate" text='{String.valueOf(getEffortDescription().getCrewShareRate())}' + onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"CrewShareRate"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{getEffortDescription() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0' weighty='0.0'> + <!--NumberEditor id='fieldEffortDescriptionRepairAndMaintenanceGearCost' constructorParams='this' + bean='{getEffortDescription()}' property='repairAndMaintenanceGearCost' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' + _sensitivityMethod='"RepairAndMaintenanceGearCost"' useSign='true'/--> + <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{String.valueOf(getEffortDescription().getRepairAndMaintenanceGearCost())}' + onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"RepairAndMaintenanceGearCost"'/> + </cell> + </row> + <row> + <cell anchor='east' fill='none' weighty='0.0'> + <JLabel text="isisfish.effortDescription.landingCosts" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"LandingCosts"'/--> + <JTextField id="fieldEffortDescriptionLandingCosts" text='{String.valueOf(getEffortDescription().getLandingCosts())}' + onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"LandingCosts"'/> + </cell> + </row> + <row> + <cell anchor='northeast' fill='none' weighty='1.0'> + <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{getEffortDescription() != null}'/> + </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' + _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"OtherRunningCost"'/--> + <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{String.valueOf(getEffortDescription().getOtherRunningCost())}' + onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' + enabled='{getEffortDescription() != null}' decorator='boxed' _sensitivityBean='{EffortDescription.class}' _sensitivityMethod='"OtherRunningCost"'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.3'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validatorEffort.setChanged(false);changeModel.setStayChanged(false)"/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/EffortDescriptionUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,170 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + + <import> + java.util.ArrayList + fr.ifremer.isisfish.entities.EffortDescription + fr.ifremer.isisfish.entities.SetOfVessels + fr.ifremer.isisfish.entities.Metier + fr.ifremer.isisfish.ui.models.common.GenericListModel + fr.ifremer.isisfish.ui.input.renderer.MetierListRenderer + fr.ifremer.isisfish.ui.input.renderer.EffortDescriptionListRenderer + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.input.InputAction + </import> + + <BeanValidator id='validator' context="effortdescription" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <script><![CDATA[ +/** + * Get input action from context. + */ +protected InputAction getInputAction() { + return getContextValue(InputAction.class); +} + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + GenericListModel<Metier> metierModel = (GenericListModel<Metier>)fieldEffortDescriptionMetierList.getModel(); + if (evt.getNewValue() == null) { + metierModel.setElementList(null); + } + if (evt.getNewValue() != null) { + metierModel.setElementList(getFisheryRegion().getMetier()); + setEffortDescriptionEffortDescriptionList(); + } + } + }); +} + +/*public void refresh() { + SetOfVessels setOfVessels = getSaveVerifier().getEntity(SetOfVessels.class); + + // twice event for jaxx bindings detection + setBean(null); + setBean(setOfVessels); +}*/ + +protected void onFieldEffortDescriptionMetierListValueChanged() { + // active le bouton seulement si l'interface est active + // dans le cas de sensitivity par exemple + if (isActive()) { + buttonEffortDescriptionAdd.setEnabled(fieldEffortDescriptionMetierList.getSelectedIndex() != -1); + } +} + +protected void onFieldEffortDescriptionEffortDescriptionListValueChanged() { + // active le bouton seulement si l'interface est active + // dans le cas de sensitivity par exemple + if (isActive()) { + removeEffortDescriptionButton.setEnabled(fieldEffortDescriptionEffortDescriptionList.getSelectedIndex() != -1); + } +} + +protected void setEffortDescriptionEffortDescriptionList() { + GenericListModel<EffortDescription> model = new GenericListModel<>(); + if (getBean() != null && getBean().getPossibleMetiers() != null) { + List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); + model.setElementList(effortDescriptions); + } + fieldEffortDescriptionEffortDescriptionList.setModel(model); +} + +protected void addEffortDescriptions() { + Object[] selectedValues = (Object[])fieldEffortDescriptionMetierList.getSelectedValues(); + for (Object selectedValue : selectedValues) { + Metier selectedMetier = (Metier)selectedValue; + getInputAction().addEffortDescription(getBean(), selectedMetier); + } + setEffortDescriptionEffortDescriptionList(); +} +protected void removeEffortDescriptions() { + Object[] selectedValues = (Object[])fieldEffortDescriptionEffortDescriptionList.getSelectedValues(); + for (Object selectedValue : selectedValues) { + EffortDescription selectedEffortDescription = (EffortDescription)selectedValue; + getInputAction().removeEffortDescription(getBean(), selectedEffortDescription); + } + setEffortDescriptionEffortDescriptionList(); +} + ]]> + </script> + <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}" + genericType="Metier" + model='{new GenericListModel<Metier>()}' 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}" + genericType="EffortDescription" + cellRenderer='{new EffortDescriptionListRenderer()}' + onValueChanged='onFieldEffortDescriptionEffortDescriptionListValueChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsBasicsUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsBasicsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,224 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Port + fr.ifremer.isisfish.entities.VesselType + fr.ifremer.isisfish.entities.SetOfVessels + fr.ifremer.isisfish.ui.models.common.GenericComboModel + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + </import> + + <BeanValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldSetOfVesselsName" /> + </BeanValidator> + + <script><![CDATA[ +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; + + GenericComboModel<Port> modelPort = new GenericComboModel<>(getFisheryRegion().getPort()); + fieldSetOfVesselsPort.setModel(modelPort); + fieldSetOfVesselsPort.setSelectedItem(getBean().getPort()); + + GenericComboModel<VesselType> modelVessel = new GenericComboModel<>(getFisheryRegion().getVesselType()); + fieldSetOfVesselsVesselType.setModel(modelVessel); + fieldSetOfVesselsVesselType.setSelectedItem(getBean().getVesselType()); + + init=false; + } + } + }); +} + +/*public void refresh() { + SetOfVessels setOfVessels = (SetOfVessels)getSaveVerifier().getEntity(SetOfVessels.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(setOfVessels); + + if (getBean() != null) { + init = true; + jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsPort,getFisheryRegion().getPort(), getBean().getPort(), true); + jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsVesselType,getFisheryRegion().getVesselType(), getBean().getVesselType(), true); + init=false; + getSaveVerifier().addCurrentPanel(technicalEfficiency); + + // NumberEditor is not working + //fieldSetOfVesselsNumberOfVessels.init(); + //fieldSetOfVesselsFixedCosts.init(); + } +}*/ + +protected void portChanged() { + if (!init) { + getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem()); + } +} +protected void vesselTypeChanged() { + if (!init) { + getBean().setVesselType((VesselType)fieldSetOfVesselsVesselType.getSelectedItem()); + } +} + ]]> + </script> + <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'> + <JComboBox id="fieldSetOfVesselsPort" onItemStateChanged='portChanged()' + genericType="Port" + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldSetOfVesselsVesselType" onItemStateChanged='vesselTypeChanged()' + genericType="VesselType" + 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' + _sensitivityBean='{SetOfVesselsImpl.class}' _sensitivityMethod='"NumberOfVessels"'/--> + <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{String.valueOf(getBean().getNumberOfVessels())}' + onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"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' + _sensitivityBean='{SetOfVesselsImpl.class}' _sensitivityMethod='"FixedCosts"'/--> + <JTextField id="fieldSetOfVesselsFixedCosts" text='{String.valueOf(getBean().getFixedCosts())}' + onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"FixedCosts"'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='technicalEfficiency' constructorParams='this' + text='isisfish.setOfVessels.technicalEfficiency' active='{isActive()}' + bean='{getBean()}' formuleCategory='TechnicalEfficiency' beanProperty='TechnicalEfficiencyEquation' + clazz='{fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class}' + decorator='boxed' _sensitivityBean='{SetOfVessels.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(SetOfVessels.class)"/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/SetOfVesselsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,76 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.SetOfVessels'> + + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueStrategies")); + setNextPath(n("isisfish.input.tree.strategies")); + + // install change listener + // (depends on sensitivity can't be done on constructor) + installChangeListener(setOfVesselsTab); +} + +/*public void refresh() { + getSaveVerifier().addCurrentPanel(setOfVesselsBasicsUI, effortDescriptionUI, effortParametersUI); +}*/ + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + setOfVesselsBasicsUI.setLayer(active); + effortDescriptionUI.setLayer(active); + effortParametersUI.setLayer(active); +} + +@Override +public void resetChangeModel() { + setOfVesselsBasicsUI.resetChangeModel(); + effortDescriptionUI.resetChangeModel(); + effortParametersUI.resetChangeModel(); +} + ]]></script> + <JPanel id="body"> + <JTabbedPane id="setOfVesselsTab"> + <tab title='isisfish.setOfVessels.title'> + <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.effortDescription.title'> + <EffortDescriptionUI id='effortDescriptionUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.effortDescription.parametersTitle'> + <EffortDescriptionParametersUI id='effortParametersUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesStructuredUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesStructuredUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesStructuredUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,51 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> + + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> + + <script><![CDATA[ + protected void dynamicChanged() { + if (getBean() != null) { + getBean().setAgeGroupType(fieldSpeciesDynamicAge.isSelected()); + } + } + ]]> + </script> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().isAgeGroupType()}' + buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().isAgeGroupType()}' + buttonGroup="structuredGroup" enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/species/SpeciesUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,205 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + fr.ifremer.isisfish.entities.Species + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.input.InputAction + fr.ifremer.isisfish.ui.input.InputUI + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Species' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldSpeciesName" /> + </BeanValidator> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("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) { + + } + } + }); +} + +@Override +protected void goTo() { + // FIXME il ne faut pas appeler le parent + // on ne sais jamais de quel type est le parent + InputUI inputUI = getParentContainer(InputUI.class); + if (inputUI != null) { + if (getBean() == null) { + inputUI.getHandler().setTreeSelection(this, n("isisfish.input.tree.species"), n("isisfish.input.tree.populations")); + } + else { + inputUI.getHandler().setTreeSelection(this, getBean().getTopiaId(), n("isisfish.input.tree.populations")); + } + } +} + +/*public void refresh() { + Species species = (Species)getSaveVerifier().getEntity(Species.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(species); + + if (getBean() != null) { + setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations"); + // Number Editor is not working + //fieldSpeciesCEE.init(); + } +}*/ + ]]> + </script> + <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' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' _sensitivityBean='{SpeciesImpl.class}' + useSign='true' _sensitivityMethod='"CodeCEE"'/--> + <JTextField id="fieldSpeciesCEE" text='{String.valueOf(getBean().getCodeCEE())}' + onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Species.class}' _sensitivityMethod='"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' + _sensitivityBean='{Species.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Species.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyMonthInfoUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyMonthInfoUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyMonthInfoUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,279 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo0' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo1' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo2' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo3' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo4' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo5' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo6' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo7' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo8' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo9' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo10' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo11' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + org.apache.commons.lang3.StringUtils + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + static org.nuiton.i18n.I18n.t + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.MatrixND + </import> + + <BeanValidator id='validator' context="month" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <BeanValidator id='validator0' context="month" + bean='{getStrategyMonthInfo0()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator1' context="month" + bean='{getStrategyMonthInfo1()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator2' context="month" + bean='{getStrategyMonthInfo2()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator3' context="month" + bean='{getStrategyMonthInfo3()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator4' context="month" + bean='{getStrategyMonthInfo4()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator5' context="month" + bean='{getStrategyMonthInfo5()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator6' context="month" + bean='{getStrategyMonthInfo6()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator7' context="month" + bean='{getStrategyMonthInfo7()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator8' context="month" + bean='{getStrategyMonthInfo8()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator9' context="month" + bean='{getStrategyMonthInfo9()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator10' context="month" + bean='{getStrategyMonthInfo10()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <BeanValidator id='validator11' context="month" + bean='{getStrategyMonthInfo11()}' beanClass='fr.ifremer.isisfish.entities.StrategyMonthInfo' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <fr.ifremer.isisfish.ui.input.ChangeModel id="changeModel" changed="{validator0.isChanged() || validator1.isChanged() || validator2.isChanged() || validator3.isChanged() || validator4.isChanged() || validator5.isChanged() || validator6.isChanged() || validator7.isChanged() || validator8.isChanged() || validator9.isChanged() || validator10.isChanged() || validator11.isChanged()}" + valid="{validator0.isValid() && validator1.isValid() && validator2.isValid() && validator3.isValid() && validator4.isValid() && validator5.isValid() && validator6.isValid() && validator7.isValid() && validator8.isValid() && validator9.isValid() && validator10.isValid() && validator11.isValid()}" /> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setStrategyMonthInfo0(null); + setStrategyMonthInfo1(null); + setStrategyMonthInfo2(null); + setStrategyMonthInfo3(null); + setStrategyMonthInfo4(null); + setStrategyMonthInfo5(null); + setStrategyMonthInfo6(null); + setStrategyMonthInfo7(null); + setStrategyMonthInfo8(null); + setStrategyMonthInfo9(null); + setStrategyMonthInfo10(null); + setStrategyMonthInfo11(null); + fieldStrategyProportion.setMatrix(null); + } + if (evt.getNewValue() != null) { + setStrategyMonthInfo0(getBean().getStrategyMonthInfo().get(0)); + setStrategyMonthInfo1(getBean().getStrategyMonthInfo().get(1)); + setStrategyMonthInfo2(getBean().getStrategyMonthInfo().get(2)); + setStrategyMonthInfo3(getBean().getStrategyMonthInfo().get(3)); + setStrategyMonthInfo4(getBean().getStrategyMonthInfo().get(4)); + setStrategyMonthInfo5(getBean().getStrategyMonthInfo().get(5)); + setStrategyMonthInfo6(getBean().getStrategyMonthInfo().get(6)); + setStrategyMonthInfo7(getBean().getStrategyMonthInfo().get(7)); + setStrategyMonthInfo8(getBean().getStrategyMonthInfo().get(8)); + setStrategyMonthInfo9(getBean().getStrategyMonthInfo().get(9)); + setStrategyMonthInfo10(getBean().getStrategyMonthInfo().get(10)); + setStrategyMonthInfo11(getBean().getStrategyMonthInfo().get(11)); + setProportionMetierMatrix(); + } + } + }); +} + +@Override +public void resetChangeModel() { + changeModel.setStayChanged(false); +} + +/*@Override +public void refresh() { + //getSaveVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, + // strategyApril, strategyMay, strategyJune, + // strategyJuly, strategyAugust, strategySeptember, + // strategyOctober, strategyNovember, strategyDecember); +}*/ + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + strategyJanuary.setLayer(active); + strategyFebuary.setLayer(active); + strategyMarch.setLayer(active); + strategyApril.setLayer(active); + strategyMay.setLayer(active); + strategyJune.setLayer(active); + strategyJuly.setLayer(active); + strategyAugust.setLayer(active); + strategySeptember.setLayer(active); + strategyOctober.setLayer(active); + strategyNovember.setLayer(active); + strategyDecember.setLayer(active); +} +protected void setProportionMetierMatrix() { + MatrixND prop = getBean().getProportionMetier(); + if (prop != null) { + fieldStrategyProportion.setMatrix(prop.copy()); + } + else { + fieldStrategyProportion.setMatrix(null); + } +} +protected void strategyProportionMatrixChanged(MatrixPanelEvent event) { + MatrixND mat = fieldStrategyProportion.getMatrix(); + if (getBean() != null && mat != null) { + getBean().setProportionMetier(mat.copy()); + } +} + ]]></script> + <JPanel id='body'> + <Table constraints='BorderLayout.CENTER'> + <row> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyJanuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo0()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.january"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyFebuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo1()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.february"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyMarch' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo2()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.march"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyApril' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo3()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.april"))}' /> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyMay' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo4()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.may"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyJune' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo5()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.june"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyJuly' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo6()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.july"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyAugust' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo7()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.august"))}' /> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategySeptember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo8()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.september"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyOctober' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo9()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.october"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyNovember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo10()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.november"))}' /> + </cell> + <cell fill='horizontal' weightx='1' insets='0'> + <StrategyOneMonthInfoUI id='strategyDecember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo11()}" strategieMonthText='{StringUtils.capitalize(t("isisfish.month.december"))}' /> + </cell> + </row> + <row> + <cell fill='horizontal' columns="4"> + <JLabel text="isisfish.strategy.proportionMetierLabel" /> + </cell> + </row> + <row> + <cell fill='both' weightx='1' weighty='1' columns="4"> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyProportion" + onMatrixChanged="strategyProportionMatrixChanged(event)" + enabled='{isActive()}' decorator='boxed' + _sensitivityBean='{fr.ifremer.isisfish.entities.Strategy.class}' _sensitivityMethod='"ProportionMetier"'/> + </cell> + </row> + </Table> + <Table constraints='BorderLayout.SOUTH'> + <row> + <cell fill='horizontal' weightx='1'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{changeModel.isValid() && changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);validator0.setChanged(false);validator1.setChanged(false);validator2.setChanged(false);validator3.setChanged(false);validator4.setChanged(false);validator5.setChanged(false);validator6.setChanged(false);validator7.setChanged(false);validator8.setChanged(false);validator9.setChanged(false);validator10.setChanged(false);validator11.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='1'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyOneMonthInfoUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyOneMonthInfoUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyOneMonthInfoUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,119 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> + + <String id="strategieMonthText" javaBean='null'/> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Strategy + fr.ifremer.isisfish.entities.StrategyMonthInfo + fr.ifremer.isisfish.entities.TripType + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.models.common.GenericComboModel + </import> + + <script><![CDATA[ +protected boolean init; + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_STRATEGY_MONTH_INFO, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { + init = true; + refresh(); + init = false; + } + } + }); +} + +public void refresh() { + if (getStrategyMonthInfo() != null) { + numberOfTrips.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); + fieldStrategyMonthInfoMinInactivityDays.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); + + GenericComboModel<TripType> model = new GenericComboModel<>(getFisheryRegion().getTripType()); + fieldStrategyMonthInfoTripType.setModel(model); + fieldStrategyMonthInfoTripType.setSelectedItem(getStrategyMonthInfo().getTripType()); + } + else { + // don't put in addPropertyChangeListener + // if called after, remove content :( + numberOfTrips.setText(""); + fieldStrategyMonthInfoMinInactivityDays.setText(""); + } +} + + ]]></script> + <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'> + <JComboBox id="fieldStrategyMonthInfoTripType" + onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' + renderer='{new fr.ifremer.isisfish.ui.input.renderer.TripTypeListRenderer(true)}' + 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' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"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' + _sensitivityBean='{StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/--> + <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{String.valueOf(getStrategyMonthInfo().getMinInactivityDays())}' + onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyTabUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyTabUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyTabUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,211 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + + <import> + fr.ifremer.isisfish.entities.Strategy + fr.ifremer.isisfish.entities.SetOfVessels + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.models.common.GenericComboModel + </import> + + <BeanValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldStrategyName" /> + </BeanValidator> + + <script><![CDATA[ +protected boolean init; + +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldStrategyName.setText(""); + fieldStrategyProportionSetOfVessels.setText(""); + fieldStrategyComment.setText(""); + } + if (evt.getNewValue() != null) { + init = true; + setSetOfVesselsModel(); + init = false; + } + } + }); +} + +/*public void refresh() { + //Strategy strategy = (Strategy)getSaveVerifier().getEntity(Strategy.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + //setBean(null); + //setBean(strategy); + + if (getBean() != null) { + setSetOfVesselsModel(); + //fieldStrategyProportionSetOfVessels.init(); + + // code to replace bindings : + strategyInactivity.setActive(isActive() && getBean().isInactivityEquationUsed()); + + //getSaveVerifier().addCurrentPanel(strategyInactivity); + } + else { + // listener seam to be called after refresh and remove content :( + fieldStrategyName.setText(""); + //fieldStrategyProportionSetOfVessels.setModelText("0.0"); + fieldStrategyProportionSetOfVessels.setText("0.0"); + fieldStrategyComment.setText(""); + + // code to replace bindings : + strategyInactivity.setActive(isActive()); + } +}*/ + +protected void setSetOfVesselsModel() { + GenericComboModel<SetOfVessels> modelVessel = new GenericComboModel<>(getFisheryRegion().getSetOfVessels()); + fieldStrategySetOfVessels.setModel(modelVessel); + fieldStrategySetOfVessels.setSelectedItem(getBean().getSetOfVessels()); +} + +protected void setOfVesselsChanged() { + if (!init) { + getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem()); + } +} + ]]></script> + <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'> + <JComboBox id="fieldStrategySetOfVessels" + onItemStateChanged='setOfVesselsChanged()' + 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' + _sensitivityBean='{StrategyImpl.class}' _sensitivityMethod='"ProportionSetOfVessels"'/--> + <JTextField id="fieldStrategyProportionSetOfVessels" text='{String.valueOf(getBean().getProportionSetOfVessels())}' + onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Strategy.class}' _sensitivityMethod='"ProportionSetOfVessels"'/> + </cell> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().isInactivityEquationUsed()}' + text="isisfish.strategy.inactivityEquationUsed" + onActionPerformed='getBean().setInactivityEquationUsed(fieldUseEquationInactivity.isSelected())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id="strategyInactivity" constructorParams='this' + text='isisfish.strategy.inactivity' + active="{isActive() && getBean() != null && bean.isInactivityEquationUsed()}" + bean='{getBean()}' formuleCategory='Inactivity' beanProperty='InactivityEquation' + clazz='{fr.ifremer.isisfish.equation.StrategyInactivityEquation.class}' + decorator='boxed' _sensitivityBean='{Strategy.class}' _sensitivityMethod='"Inactivity"'/> <!-- bindings not work well actif='{getBean().isInactivityEquationUsed()}' --> + </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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Strategy.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/strategy/StrategyUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,70 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + </import> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueObservations")); + setNextPath(n("isisfish.input.tree.observations")); + // install change listener + // (depends on sensitivity can't be done on constructor) + installChangeListener(strategyTab); +} + +/*public void refresh() { + getSaveVerifier().addCurrentPanel(strategyMonthInfoUI, strategyTabUI); +}*/ + +@Override +public void setLayer(boolean active) { + super.setLayer(active); + strategyTabUI.setLayer(active); + strategyMonthInfoUI.setLayer(active); +} + +@Override +public void resetChangeModel() { + strategyTabUI.resetChangeModel(); + strategyMonthInfoUI.resetChangeModel(); +} + ]]></script> + <JPanel id="body"> + <JTabbedPane id="strategyTab"> + <tab title='isisfish.strategy.title'> + <StrategyTabUI id='strategyTabUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + <tab title='isisfish.strategyMonthInfo.title'> + <StrategyMonthInfoUI id='strategyMonthInfoUI' bean="{getBean()}" active="{isActive()}" sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -66,7 +66,7 @@ */ public class FisheryTreeHelper extends NavTreeHelper<FisheryTreeNode> { - public Map<Class, FisheryTreeNodeLoador<? extends TopiaEntity>> loadorCache = new HashMap<Class, FisheryTreeNodeLoador<? extends TopiaEntity>>(); + public Map<Class, FisheryTreeNodeLoador<? extends TopiaEntity>> loadorCache = new HashMap<>(); public <T extends TopiaEntity> FisheryTreeNodeLoador<? extends TopiaEntity> getLoadorFor(Class<T> type) { return loadorCache.get(type); Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/TripTypeUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/TripTypeUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/TripTypeUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,161 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='TripType'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.TripType id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + fr.ifremer.isisfish.entities.TripType + fr.ifremer.isisfish.types.TimeUnit + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.TripType' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldTripTypeName" /> + </BeanValidator> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueVesselTypes")); + setNextPath(n("isisfish.input.tree.vesseltypes")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldTripTypeName.setText(""); + fieldTripTypeDuration.setText(""); + fieldTripTypeMinTimeBetweenTrip.setText(""); + fieldTripTypeComment.setText(""); + } + if (evt.getNewValue() != null) { + + } + } + }); +} + +/*public void refresh() { + TripType tripType = (TripType)getSaveVerifier().getEntity(TripType.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(tripType); +}*/ + ]]> + </script> + <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' _sensitivityBean='{TripType.class}' _sensitivityMethod='"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' _sensitivityBean='{TripType.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(TripType.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> + Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -42,7 +42,7 @@ import fr.ifremer.isisfish.entities.Variable; import fr.ifremer.isisfish.entities.VariableDAO; import fr.ifremer.isisfish.entities.VariableType; -import fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel; +import fr.ifremer.isisfish.ui.models.common.GenericListModel; /** * Handler for generic variable ui. @@ -56,7 +56,7 @@ public class EntityVariableHandler { /** Class logger. */ - private static Log log = LogFactory.getLog(EntityVariableHandler.class); + private static final Log log = LogFactory.getLog(EntityVariableHandler.class); /** * Init view with currently entity variables. @@ -70,7 +70,7 @@ // fill current list List<Variable> variables = null; - TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel(); + GenericListModel<Variable> model = (GenericListModel<Variable>)view.getVariablesList().getModel(); TopiaEntity bean = view.getBean(); if (bean != null) { try { @@ -94,7 +94,7 @@ view.getVariableEntityName().setText(""); } - model.setEntities(variables); + model.setElementList(variables); } /** @@ -111,10 +111,10 @@ Variable.PROPERTY_ENTITY_ID, view.getBean().getTopiaId(), Variable.PROPERTY_NAME, t("isisfish.variables.defaultname")); - TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel(); - List<Variable> variables = (List<Variable>)model.getElements(); + GenericListModel<Variable> model = (GenericListModel<Variable>)view.getVariablesList().getModel(); + List<Variable> variables = model.getElementList(); variables.add(variable); - model.setEntities(variables); + model.setElementList(variables); // auto select view.getVariablesList().setSelectedValue(variable, true); @@ -141,10 +141,10 @@ // refresh ui view.getVariablesList().clearSelection(); // fix event bug - TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel(); - List<Variable> variables = (List<Variable>)model.getElements(); + GenericListModel<Variable> model = (GenericListModel<Variable>)view.getVariablesList().getModel(); + List<Variable> variables = model.getElementList(); variables.remove(variable); - model.setEntities(variables); + model.setElementList(variables); } catch (TopiaException ex) { throw new IsisFishRuntimeException("Can't delete variable", ex); } @@ -157,7 +157,7 @@ */ public void showSelectedVariable(EntityVariableUI view) { - JList variableList = view.getVariablesList(); + JList<Variable> variableList = view.getVariablesList(); Variable variable = (Variable)variableList.getSelectedValue(); view.setVariable(variable); view.getSaveVerifier().addCurrentEntity(variable); @@ -206,7 +206,7 @@ * @param view view */ public void saveVariable(EntityVariableUI view) { - JList variableList = view.getVariablesList(); + JList<Variable> variableList = view.getVariablesList(); Variable variable = (Variable)variableList.getSelectedValue(); variable.setName(view.getVariableNameField().getText().trim()); @@ -237,9 +237,9 @@ view.getSaveVerifier().save(); // refresh ui (name change) - TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel(); - List<Variable> variables = (List<Variable>)model.getElements(); - model.setEntities(variables); + GenericListModel<Variable> model = (GenericListModel<Variable>)view.getVariablesList().getModel(); + List<Variable> variables = model.getElementList(); + model.setElementList(variables); /*} catch (TopiaException ex) { throw new IsisFishRuntimeException("Can't save variable", ex); }*/ Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -59,7 +59,8 @@ <cell fill="both" weightx='1.0' weighty='1.0'> <JScrollPane> <JList id="variablesList" cellRenderer="{new VariableListRenderer()}" - model="{new fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel()}" + genericType='fr.ifremer.isisfish.entities.Variable' + model="{new fr.ifremer.isisfish.ui.models.common.GenericListModel<Variable>()}" onValueChanged="getVarHandler().showSelectedVariable(this)" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" enabled='{isActive()}'/> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/vesseltype/VesselTypeUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/vesseltype/VesselTypeUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/vesseltype/VesselTypeUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,276 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='VesselType'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.VesselType id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.t + static org.nuiton.i18n.I18n.n + fr.ifremer.isisfish.entities.VesselType + fr.ifremer.isisfish.entities.TripType + fr.ifremer.isisfish.types.TimeUnit + fr.ifremer.isisfish.ui.models.common.GenericListModel + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.VesselType' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldVesselTypeName" /> + </BeanValidator> + + <script><![CDATA[ +protected boolean init; + +protected void $afterCompleteSetup() { + setButtonTitle(t("isisfish.input.continueSetOfVessels")); + setNextPath(n("isisfish.input.tree.setofvessels")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldVesselTypeName.setText(""); + fieldVesselTypeLength.setText(""); + fieldVesselTypeSpeed.setText(""); + fieldVesselTypeMaxTripDuration.setText(""); + fieldVesselTypeActivityRange.setText(""); + fieldVesselTypeMinCrewSize.setText(""); + fieldVesselTypeSpeed.setText(""); + fieldVesselTypeUnitFuelCostOfTravel.setText(""); + fieldVesselTypeComment.setText(""); + } + if (evt.getNewValue() != null) { + setTripTypeListModel(); + } + } + }); +} + +/*public void refresh() { + VesselType vesselType = getSaveVerifier().getEntity(VesselType.class); + + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(vesselType); + + if (getBean() != null) { + setListModel(); + + // NumberEditor is not working + //fieldVesselTypeLength.init(); + //fieldVesselTypeLength.init(); + //fieldVesselTypeSpeed.init(); + //fieldVesselTypeActivityRange.init(); + //fieldVesselTypeMinCrewSize.init(); + //fieldVesselTypeSpeed.init(); + //fieldVesselTypeUnitFuelCostOfTravel.init(); + } +}*/ + +protected void setTripTypeListModel() { + init = true; + List<TripType> tripTypes = getFisheryRegion().getTripType(); + GenericListModel<TripType> tripTypeModel = new GenericListModel<>(tripTypes); + vesselTypeTripType.setModel(tripTypeModel); + + if (getBean() != null && getBean().getTripType() != null) { + for (TripType tripType : getBean().getTripType()) { + int index = tripTypes.indexOf(tripType); + vesselTypeTripType.addSelectionInterval(index, index); + } + } + init = false; +} +protected void tripTypeChanged() { + if (!init) { + java.util.List<TripType> tripTypes = new java.util.ArrayList<TripType>(); + for (Object o : vesselTypeTripType.getSelectedValues()) { + tripTypes.add((TripType)o); + } + getBean().setTripType(tripTypes); + } +} + ]]></script> + <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' + _sensitivityBean='{VesselType.class}' _sensitivityMethod='"Length"'/--> + <JTextField id="fieldVesselTypeLength" text='{String.valueOf(getBean().getLength())}' enabled='{isActive()}' + onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))' + decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' + _sensitivityBean='{VesselType.class}' _sensitivityMethod='"Speed"'/--> + <JTextField id="fieldVesselTypeSpeed" text='{String.valueOf(getBean().getSpeed())}' enabled='{isActive()}' + onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))' + decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' + _sensitivityBean='{VesselType.class}' _sensitivityMethod='"ActivityRange"'/--> + <JTextField id="fieldVesselTypeActivityRange" text='{String.valueOf(getBean().getActivityRange())}' enabled='{isActive()}' + onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))' + decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' _sensitivityBean='{VesselType.class}' + _sensitivityMethod='"MinCrewSize"'/--> + <JTextField id="fieldVesselTypeMinCrewSize" text='{String.valueOf(getBean().getMinCrewSize())}' enabled='{isActive()}' + onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))' + decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' + _sensitivityBean='{VesselType.class}' _sensitivityMethod='"UnitFuelCostOfTravel"'/--> + <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{String.valueOf(getBean().getUnitFuelCostOfTravel())}' + onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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> + <JList id="vesselTypeTripType" onValueChanged='tripTypeChanged()' + cellRenderer="{new fr.ifremer.isisfish.ui.input.renderer.TripTypeListRenderer()}" + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{VesselType.class}' _sensitivityMethod='"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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(VesselType.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneBasicsUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneBasicsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneBasicsUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,195 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> + + <import> + javax.swing.event.ListSelectionEvent + fr.ifremer.isisfish.entities.Cell + fr.ifremer.isisfish.entities.Zone + fr.ifremer.isisfish.map.CellSelectionLayer + fr.ifremer.isisfish.map.CopyMapToClipboardListener + fr.ifremer.isisfish.map.OpenMapEvents + fr.ifremer.isisfish.ui.models.common.GenericListModel + com.bbn.openmap.event.SelectMouseMode + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.awt.event.MouseEvent + java.util.ArrayList + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldZoneName" /> + <field name="cell" component="spZoneCells" /> + </BeanValidator> + + <script><![CDATA[ +protected void $afterCompleteSetup() { + + //zoneMap.init(zoneMapInfo); + new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + boolean result = false; + if (getBean() != null) { // impossible de desactiver la carte :( + getBean().setCell(zoneMap.getSelectedCells()); + setZoneCells(); + } + return result; + } + }; + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldZoneName.setText(""); + fieldZoneComment.setText(""); + zoneMap.setSelectedCells(); + } + if (evt.getNewValue() != null) { + setZoneCells(); + } + } + }); +} + +protected void setZoneCells() { + if (getBean() != null) { + List<Cell> cells = getFisheryRegion().getCell(); + GenericListModel<Cell> model = new GenericListModel<Cell>(cells); + zoneCells.setModel(model); + if (getBean().getCell() != null) { + for (Cell selectedCell : getBean().getCell()) { + int index = cells.indexOf(selectedCell); + zoneCells.addSelectionInterval(index, index); + } + } + } +} + +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 (isActive()) { + java.util.List<Cell> cells = new ArrayList<Cell>(); + for (Object o : zoneCells.getSelectedValues()) { + cells.add((Cell) o); + } + getBean().setCell(cells); + } + } +} +]]> + </script> + <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 id="spZoneCells"> + <JList id="zoneCells" enabled='{isActive()}' + 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' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Zone.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" + fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}' + decorator='boxed' constraints='BorderLayout.CENTER'/> + <com.bbn.openmap.InformationDelegator id="zoneMapInfo" constraints='BorderLayout.SOUTH' /> + </JPanel> + </JSplitPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Added: trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneHandler.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,52 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 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.zone; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.ui.input.InputContentHandler; + +/** + * Zone handler. + */ +public class ZoneHandler extends InputContentHandler<ZoneUI> { + + /** Class logger. */ + private static final Log log = LogFactory.getLog(ZoneHandler.class); + + protected void init(final ZoneUI zoneUI) { + super.init(zoneUI); + + zoneUI.setButtonTitle(t("isisfish.input.continuePorts")); + zoneUI.setNextPath(n("isisfish.input.tree.ports")); + + // install change listener + // (depends on sensitivity can't be done on constructor) + zoneUI.installChangeListener(zoneUI.zoneTab); + } +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneUI.jaxx (from rev 4209, trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/zone/ZoneUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,63 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 - 2015 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 + 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Zone'> + + <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> + + <ZoneHandler id="handler" /> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + handler.init(this); + } + + @Override + public void setLayer(boolean active) { + super.setLayer(active); + zoneBasicsUI.setLayer(active); + variablesUI.setLayer(active); + } + + @Override + public void resetChangeModel() { + zoneBasicsUI.resetChangeModel(); + variablesUI.resetChangeModel(); + } + ]]></script> + + <JPanel id="body"> + <JTabbedPane constraints='BorderLayout.CENTER' id="zoneTab"> + <tab title='isisfish.zone.title'> + <ZoneBasicsUI id="zoneBasicsUI" bean="{getBean()}" active="{isActive()}" + sensitivity="{isSensitivity()}" constructorParams='this' /> + </tab> + <tab title='isisfish.variables.tabtitle'> + <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI" + bean="{getBean()}" active="{isActive()}" + sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericComboModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericComboModel.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericComboModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2011 - 2012 Ifremer, CodeLutin, Chatellier Eric + * Copyright (C) 2011 - 2015 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 @@ -47,7 +47,7 @@ private static final long serialVersionUID = -4070846632975105788L; /** E list. */ - protected List<E> genericList; + protected List<E> elementList; /** * Empty constructor. @@ -59,10 +59,10 @@ /** * Constructor with export list. * - * @param genericList E list + * @param elementList E list */ - public GenericComboModel(List<E> genericList) { - setGenericList(genericList); + public GenericComboModel(List<E> elementList) { + setElementList(elementList); } /** @@ -70,28 +70,31 @@ * * @return E list */ - public List<E> getGenericList() { - return genericList; + public List<E> getElementList() { + return elementList; } /** * Set E list. * - * @param genericList E list to set + * @param elementList E list to set */ - public void setGenericList(List<E> genericList) { - this.genericList = genericList; + public void setElementList(List<E> elementList) { + this.elementList = elementList; + // reset selected setSelectedItem(null); + + fireContentsChanged(this, 0, elementList == null ? 0 : elementList.size() - 1); } public void addElement(E elt) { - genericList.add(elt); - fireIntervalAdded(this, genericList.size() - 1, genericList.size()); + elementList.add(elt); + fireIntervalAdded(this, elementList.size() - 1, elementList.size()); } public boolean containsElement(E elt) { - return genericList.contains(elt); + return elementList.contains(elt); } /* @@ -99,7 +102,7 @@ */ @Override public E getElementAt(int index) { - return genericList.get(index); + return elementList.get(index); } /* @@ -109,8 +112,8 @@ public int getSize() { int size = 0; - if (genericList != null) { - size = genericList.size(); + if (elementList != null) { + size = elementList.size(); } return size; } Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericListModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericListModel.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/GenericListModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2015 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 @@ -27,7 +27,7 @@ import java.util.List; -import javax.swing.AbstractListModel; +import javax.swing.DefaultListModel; import javax.swing.JList; /** @@ -41,7 +41,7 @@ * Last update : $Date$ * By : $Author$ */ -public class GenericListModel<E> extends AbstractListModel<E> { +public class GenericListModel<E> extends DefaultListModel<E> { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; @@ -81,6 +81,7 @@ */ public void setElementList(List<E> elementList) { this.elementList = elementList; + fireContentsChanged(this, 0, elementList == null ? 0 : elementList.size() - 1); } /* Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListModel.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,104 +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 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.models.export; - -import java.util.List; - -import javax.swing.AbstractListModel; - -import fr.ifremer.isisfish.export.ExportInfo; - -/** - * Model pour la liste des instances d'exports. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ExportListModel extends AbstractListModel<ExportInfo> { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - protected List<ExportInfo> exports; - - /** - * Empty constructor. - */ - public ExportListModel() { - this(null); - } - - /** - * Constructor with plan list. - * - * @param exports exports - */ - public ExportListModel(List<ExportInfo> exports) { - setExport(exports); - } - - /** - * Get exports list. - * - * @return the exports - */ - public List<ExportInfo> getExports() { - return exports; - } - - /** - * Set exports list. - * - * @param exports the exports to set - */ - public void setExport(List<ExportInfo> exports) { - this.exports = exports; - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public ExportInfo getElementAt(int index) { - return exports.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (exports != null) { - size = exports.size(); - } - return size; - } -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,74 +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 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.models.export; - -import java.awt.Component; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JLabel; -import javax.swing.JList; - -import fr.ifremer.isisfish.datastore.ExportStorage; -import fr.ifremer.isisfish.export.ExportInfo; - -/** - * Renderer pour la liste des export. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ExportListRenderer extends DefaultListCellRenderer { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /* - * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) - */ - @Override - public Component getListCellRendererComponent(JList<?> list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - // this must be used to have alterned highlight rows and default - // selection color - JLabel c = (JLabel) super.getListCellRendererComponent(list, value, - index, isSelected, cellHasFocus); - - ExportInfo export = (ExportInfo) value; - c.setText(ExportStorage.getName(export)); - - try { - c.setToolTipText(export.getDescription()); - } catch (Exception e) { - // can't get exception - } - - return this; - } -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboModel.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,109 +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 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.models.rule; - -import java.util.List; - -import javax.swing.DefaultComboBoxModel; - -/** - * Model pour la liste des noms de regles. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class RuleComboModel extends DefaultComboBoxModel<String> { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Rule names. */ - protected List<String> rulesNames; - - /** - * Empty constructor. - */ - public RuleComboModel() { - this(null); - } - - /** - * Constructor with rule names list. - * - * @param rulesNames exports Names - */ - public RuleComboModel(List<String> rulesNames) { - super(); - setExportNames(rulesNames); - } - - /** - * Get rule names. - * - * @return the rule names - */ - public List<String> getExportNames() { - return rulesNames; - } - - /** - * Set rule names. - * - * @param rulesNames the rule names to set - */ - public void setExportNames(List<String> rulesNames) { - this.rulesNames = rulesNames; - - // default first selected - if (!rulesNames.isEmpty()) { - setSelectedItem(rulesNames.get(0)); - } - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public String getElementAt(int index) { - return rulesNames.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (rulesNames != null) { - size = rulesNames.size(); - } - return size; - } -} Deleted: trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,105 +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 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.models.rule; - -import java.util.List; - -import javax.swing.AbstractListModel; - -import fr.ifremer.isisfish.rule.Rule; - -/** - * Model pour la liste des regles des parametres d'une simulation. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class RuleListModel extends AbstractListModel<Rule> { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - protected List<Rule> rules; - - /** - * Empty constructor. - */ - public RuleListModel() { - this(null); - } - - /** - * Constructor with rule list. - * - * @param rules rules - */ - public RuleListModel(List<Rule> rules) { - this.rules = rules; - } - - /** - * Get rules list. - * - * @return the rules - */ - public List<Rule> getRules() { - return rules; - } - - /** - * Set rules list. - * - * @param rules the rules to set - */ - public void setRules(List<Rule> rules) { - this.rules = rules; - fireContentsChanged(this, 0, rules.size() - 1); - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public Rule getElementAt(int index) { - return rules.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (rules != null) { - size = rules.size(); - } - return size; - } -} Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2015 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 @@ -29,13 +29,12 @@ javax.swing.JProgressBar; javax.swing.ListSelectionModel; </import> + <script><![CDATA[ - - queueTable.setDefaultRenderer(JProgressBar.class, new ComponentTableCellRenderer()); queueTableDone.setDefaultRenderer(JProgressBar.class, new ComponentTableCellRenderer()); ]]> - </script> + </script> <Boolean id='canStop' javaBean='false'/> <Boolean id='canShowLog' javaBean='false'/> @@ -57,7 +56,7 @@ <JScrollPane> <JTable id="queueTable" model='{newSimulationModel}' selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - selectionModel="{selectionModelQueueTable}" /> + selectionModel="{selectionModelQueueTable}"/> </JScrollPane> <JScrollPane> <JTable id="queueTableDone" model='{doneSimulationModel}' Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -74,14 +74,14 @@ private static Log log = LogFactory.getLog(TableBlockingLayerUI.class); /** Parent UI. */ - protected InputContentUI<?> parent; + protected InputContentUI<? extends TopiaEntityContextable> parent; /** * Init layer with parent. * * @param parent parent */ - public TableBlockingLayerUI(InputContentUI<?> parent) { + public TableBlockingLayerUI(InputContentUI<? extends TopiaEntityContextable> parent) { this.parent = parent; } Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2015-05-07 08:47:11 UTC (rev 4218) @@ -40,7 +40,7 @@ java.beans.PropertyChangeListener java.util.List fr.ifremer.isisfish.rule.Rule - fr.ifremer.isisfish.ui.models.rule.RuleListModel + fr.ifremer.isisfish.ui.models.common.GenericListModel fr.ifremer.isisfish.ui.models.common.ScriptParametersTableModel </import> @@ -50,10 +50,10 @@ addPropertyChangeListener(PROPERTY_RULES_LIST, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() == null) { - selectedRulesListModel.setRules(new ArrayList<Rule>()); + selectedRulesListModel.setElementList(new ArrayList<Rule>()); } else { List<Rule> rules = (List<Rule>)evt.getNewValue(); - selectedRulesListModel.setRules(rules); + selectedRulesListModel.setElementList(rules); } } }); @@ -80,6 +80,7 @@ <cell fill="both" rows="3" weightx="1" weighty="1"> <JScrollPane> <JList id="availableRuleList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + genericType="String" model='{new fr.ifremer.isisfish.ui.models.common.GenericListModel<String>(fr.ifremer.isisfish.datastore.RuleStorage.getRuleNames())}' cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleNamesListRenderer()}' onValueChanged='addRulesButton.setEnabled(availableRuleList.getSelectedIndex() != -1)' @@ -91,9 +92,9 @@ </cell> <cell fill="both" rows="3" weightx="1" weighty="1"> <JScrollPane enabled="{isActive()}"> - <fr.ifremer.isisfish.ui.models.rule.RuleListModel id="selectedRulesListModel" /> + <fr.ifremer.isisfish.ui.models.common.GenericListModel id="selectedRulesListModel" genericType="fr.ifremer.isisfish.rule.Rule" /> <JList id="selectedRulesList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - model='{selectedRulesListModel}' + genericType="fr.ifremer.isisfish.rule.Rule" model='{selectedRulesListModel}' cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleListCellRenderer()}' onValueChanged='removeRuleButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);clearRulesButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);handler.displayRuleParameters(this)' /> </JScrollPane> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooserHandler.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooserHandler.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooserHandler.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -23,6 +23,8 @@ package fr.ifremer.isisfish.ui.simulator; +import java.util.List; + import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.RegionStorage; @@ -52,9 +54,8 @@ * @param ruleChooser rule chooser ui */ protected void addSelectedRules(RuleChooser ruleChooser) { - Object[] availableRuleValues = ruleChooser.getAvailableRuleList().getSelectedValues(); - for (Object availableRuleValue : availableRuleValues) { - String availableRuleName = (String)availableRuleValue; + List<String> availableRuleValues = ruleChooser.getAvailableRuleList().getSelectedValuesList(); + for (String availableRuleName : availableRuleValues) { try { RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName); Rule ruleTmp = ruleStorage.getNewInstance(); @@ -68,7 +69,7 @@ throw new IsisFishRuntimeException("Can't add rule", ex); } } - ruleChooser.getSelectedRulesListModel().setRules(ruleChooser.getRulesList()); + ruleChooser.getSelectedRulesListModel().setElementList(ruleChooser.getRulesList()); } /** @@ -78,8 +79,8 @@ */ protected void removeSelectedRules(RuleChooser ruleChooser) { SimulAction simulAction = ruleChooser.getContextValue(SimulAction.class); - Object[] selectedRuleValues = ruleChooser.getSelectedRulesList().getSelectedValues(); - for (Object selectedRuleValue : selectedRuleValues) { + List<Rule> selectedRuleValues = ruleChooser.getSelectedRulesList().getSelectedValuesList(); + for (Rule selectedRuleValue : selectedRuleValues) { // condition pour savoir si on est dans l'instance principal // de définition d'une simulation (hack) @@ -92,7 +93,7 @@ // real rule remove ruleChooser.getRulesList().remove(selectedRuleValue); } - ruleChooser.getSelectedRulesListModel().setRules(ruleChooser.getRulesList()); + ruleChooser.getSelectedRulesListModel().setElementList(ruleChooser.getRulesList()); ruleChooser.getSelectedRulesList().clearSelection(); } @@ -113,7 +114,7 @@ ruleChooser.getContextValue(SimulationUI.class, "SimulationUI").refreshFactorTree(); } ruleChooser.getRulesList().clear(); - ruleChooser.getSelectedRulesListModel().setRules(ruleChooser.getRulesList()); + ruleChooser.getSelectedRulesListModel().setElementList(ruleChooser.getRulesList()); ruleChooser.getSelectedRulesList().clearSelection(); } @@ -141,8 +142,7 @@ RuleParametersFactorTableCellEditor sensitivityEditor = new RuleParametersFactorTableCellEditor(ruleChooser, selectedRule); ruleChooser.getSelectedRuleParameterTable().getColumnModel().getColumn(2).setCellEditor(sensitivityEditor); } - } - else { + } else { ruleChooser.getSelectedRuleParameterTableModel().setScript(null); } } Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenManagerFactory.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenManagerFactory.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenManagerFactory.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,5 +1,27 @@ package fr.ifremer.isisfish.ui.widget.text; +/* + * #%L + * ISIS-Fish + * %% + * Copyright (C) 2015 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% + */ + import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory; /** Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenMarker.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenMarker.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/widget/text/IsisTokenMarker.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -1,5 +1,27 @@ package fr.ifremer.isisfish.ui.widget.text; +/* + * #%L + * ISIS-Fish + * %% + * Copyright (C) 2015 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% + */ + import javax.swing.text.Segment; import org.fife.ui.rsyntaxtextarea.AbstractTokenMaker; Modified: trunk/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -6,7 +6,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 1999 - 2013 Ifremer, Codelutin + * Copyright (C) 1999 - 2015 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 Modified: trunk/src/main/resources/i18n/isis-fish_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/isis-fish_en_GB.properties 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/resources/i18n/isis-fish_en_GB.properties 2015-05-07 08:47:11 UTC (rev 4218) @@ -437,6 +437,7 @@ isisfish.input.continueCells=Continue to cells isisfish.input.continueGears=Continue to gears isisfish.input.continueMetiers=Continue to metiers +isisfish.input.continueObservations=Continue to observations isisfish.input.continuePopulations=Continue to populations isisfish.input.continuePorts=Continue to ports isisfish.input.continueSetOfVessels=Continue to set of vessels @@ -445,6 +446,7 @@ isisfish.input.continueTripTypes=Continue to trip types isisfish.input.continueVesselTypes=Continue to vessel types isisfish.input.continueZones=Continue to zones +isisfish.input.createNewRegion=Create isisfish.input.map.copytoclicboard=Copy to clipboard isisfish.input.menu.addRegion=Add region isisfish.input.menu.commit=Commit change @@ -459,7 +461,7 @@ isisfish.input.menu.sensitivity.export=Export database factors isisfish.input.menu.server=Server isisfish.input.newRegion=New region -isisfish.input.selectRegion=Select region +isisfish.input.selectRegion=Select region. isisfish.input.sensitivity.export.cancel=Factor export canceled isisfish.input.sensitivity.export.complete=Factor export complete isisfish.input.sensitivity.export.running=Exporting factors... @@ -626,7 +628,7 @@ isisfish.params.title=Parameters isisfish.params.toString.fishery=Fishery\: %1$s isisfish.params.toString.lib.logger.level=Level of libraries' logger \: %1$s -isisfish.params.toString.number.months= +isisfish.params.toString.number.months=Months count \: %s isisfish.params.toString.objective=Objective function \: %s isisfish.params.toString.optimization=Optimization methode \: %s isisfish.params.toString.optimization.generation=Generation\: %s @@ -855,8 +857,8 @@ isisfish.sensitivity.discret=Finite discrete factor isisfish.sensitivity.discretevaluelabel=Value %d isisfish.sensitivity.displaysecondpass=Display results -isisfish.sensitivity.distribution= -isisfish.sensitivity.distribution.parameters= +isisfish.sensitivity.distribution=Distribution +isisfish.sensitivity.distribution.parameters=Parameters isisfish.sensitivity.equation.valid=Valid variable isisfish.sensitivity.equation.variablename=Varaible name \: isisfish.sensitivity.export=Export Modified: trunk/src/main/resources/i18n/isis-fish_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/isis-fish_fr_FR.properties 2015-05-07 08:44:08 UTC (rev 4217) +++ trunk/src/main/resources/i18n/isis-fish_fr_FR.properties 2015-05-07 08:47:11 UTC (rev 4218) @@ -437,6 +437,7 @@ isisfish.input.continueCells=Continuer vers les mailles isisfish.input.continueGears=Continuer vers les engins isisfish.input.continueMetiers=Continuer vers les metiers +isisfish.input.continueObservations=Continuer vers les observations isisfish.input.continuePopulations=Continuer vers les populations isisfish.input.continuePorts=Continuer vers les ports isisfish.input.continueSetOfVessels=Continuer vers les flottilles @@ -445,6 +446,7 @@ isisfish.input.continueTripTypes=Continuer vers les types de trajets isisfish.input.continueVesselTypes=Continuer vers les types de navires isisfish.input.continueZones=Continuer vers les zones +isisfish.input.createNewRegion=Créer isisfish.input.map.copytoclicboard=Copier vers de presse-papiers isisfish.input.menu.addRegion=Ajouter une région isisfish.input.menu.commit=Sauvegarder les changements @@ -459,7 +461,7 @@ isisfish.input.menu.sensitivity.export=Exporter les facteurs isisfish.input.menu.server=Serveur isisfish.input.newRegion=Nouvelle région -isisfish.input.selectRegion=Sélectionnez une région +isisfish.input.selectRegion=Sélectionnez une région. isisfish.input.sensitivity.export.cancel=Export des facteurs annulé isisfish.input.sensitivity.export.complete=Export des facteurs réussit isisfish.input.sensitivity.export.running=Export des facteurs en cours... Added: trunk/src/test/java/fr/ifremer/isisfish/ui/input/InputSaveVerifierTest.java =================================================================== --- trunk/src/test/java/fr/ifremer/isisfish/ui/input/InputSaveVerifierTest.java (rev 0) +++ trunk/src/test/java/fr/ifremer/isisfish/ui/input/InputSaveVerifierTest.java 2015-05-07 08:47:11 UTC (rev 4218) @@ -0,0 +1,59 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 + * 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; + +import org.junit.Assert; +import org.junit.Test; + +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.PopulationImpl; +import fr.ifremer.isisfish.entities.PopulationSeasonInfo; +import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; +import fr.ifremer.isisfish.types.Month; + +/** + * Test InputVerifier. + * + * @author Eric Chatellier + */ +public class InputSaveVerifierTest { + + /** + * Test toString method. + * @throws Exception + */ + @Test + public void testToString() throws Exception { + Population pop = new PopulationImpl(); + pop.setName("Test1"); + Assert.assertEquals("Test1", new InputSaveVerifier().toString(pop)); + + PopulationSeasonInfo psi = new PopulationSeasonInfoImpl(); + psi.setPopulation(pop); + psi.setFirstMonth(Month.JANUARY); + psi.setLastMonth(Month.MARCH); + Assert.assertEquals("Test1 saison janvier-mars", new InputSaveVerifier().toString(psi)); + } +} Property changes on: trunk/src/test/java/fr/ifremer/isisfish/ui/input/InputSaveVerifierTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
echatellier@users.forge.codelutin.com