r3393 - in isis-fish/trunk: . doc/devel src/main/assembly src/main/assembly/x64 src/main/assembly/x86 src/main/java/fr/ifremer/isisfish src/main/java/fr/ifremer/isisfish/actions src/main/java/fr/ifremer/isisfish/datastore src/main/java/fr/ifremer/isisfish/datastore/migration src/main/java/fr/ifremer/isisfish/datastore/update src/main/java/fr/ifremer/isisfish/entities src/main/java/fr/ifremer/isisfish/export src/main/java/fr/ifremer/isisfish/logging src/main/java/fr/ifremer/isisfish/map s
Author: chatellier Date: 2011-06-14 17:43:37 +0000 (Tue, 14 Jun 2011) New Revision: 3393 Log: Merge branche 3.3.1 into trunk Added: isis-fish/trunk/doc/devel/Sensitivity.png isis-fish/trunk/doc/devel/sensitivity.zargo isis-fish/trunk/src/main/assembly/isisfish-log4j.properties isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V34.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/AbstractXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationDiscreteDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorGroupXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/RuleDiscreteDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationDiscreteDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDiscreteDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorGroupVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ChangeModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/renderer/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/tree/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/common/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellEditor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptFileFilter.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTranferable.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTransferHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTree.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySaveVerifier.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/equation/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx isis-fish/trunk/src/main/resources/fr/ isis-fish/trunk/src/main/resources/i18n/isis-fish_en_GB.properties isis-fish/trunk/src/main/resources/i18n/isis-fish_fr_FR.properties isis-fish/trunk/src/main/resources/icons/factors/ isis-fish/trunk/src/main/resources/icons/table.png isis-fish/trunk/src/main/resources/icons/table_multiple.png isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/rule/ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/FormInterval.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/IntervalPanelTest.java isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplanV2.xml isis-fish/trunk/src/test/resources/mexico/mexicohelper_factorgroupdp.xml Removed: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/HorizontalEntityVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/ApplicationMonitorUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Help.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/gear/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/metier/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/population/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/setofvessels/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/triptype/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/simulation/ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties isis-fish/trunk/src/main/resources/images/sigma-barre.gif isis-fish/trunk/src/main/resources/images/sigma.gif isis-fish/trunk/src/main/resources/interpreter.properties isis-fish/trunk/src/main/resources/oldmappings/ isis-fish/trunk/src/main/resources/templates/prescript/ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java Modified: isis-fish/trunk/changelog.txt isis-fish/trunk/pom.xml isis-fish/trunk/src/main/assembly/bin.xml isis-fish/trunk/src/main/assembly/x64/jri.dll isis-fish/trunk/src/main/assembly/x64/libjri.so isis-fish/trunk/src/main/assembly/x86/jri.dll isis-fish/trunk/src/main/assembly/x86/libjri.so isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishException.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishRuntimeException.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/OtherAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/DataStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageException.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/VersionStorage.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/PopulationMonitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationPreScript.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/RangeOfValues.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/StatusBarUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomePanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckRegion.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResult.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultFrame.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ExportAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialog.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/Interval.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalGraphic.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalLabel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalPanel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Args.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHAgent.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUserInfo.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java isis-fish/trunk/src/main/resources/log4j.properties isis-fish/trunk/src/main/xmi/isis-fish.properties isis-fish/trunk/src/main/xmi/isis-fish.zargo isis-fish/trunk/src/test/java/fr/ifremer/isisfish/AbstractIsisFishTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/IsisFishMiscTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/types/MonthTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplan.xml isis-fish/trunk/src/test/resources/test-database/analyseplans/CalibrationSimplexePasVariable2Capturabilite.java isis-fish/trunk/src/test/resources/test-database/analyseplans/SimulationNumberRestriction.java isis-fish/trunk/src/test/resources/test-database/exports/Abundances.java isis-fish/trunk/src/test/resources/test-database/exports/Biomasses.java isis-fish/trunk/src/test/resources/test-database/exports/CapturesNombre.java isis-fish/trunk/src/test/resources/test-database/exports/CapturesPoids.java isis-fish/trunk/src/test/resources/test-database/exports/CellsDefinition.java isis-fish/trunk/src/test/resources/test-database/exports/EffortsMetier.java isis-fish/trunk/src/test/resources/test-database/exports/MetierZone.java isis-fish/trunk/src/test/resources/test-database/exports/NonActivite.java isis-fish/trunk/src/test/resources/test-database/exports/OwnerMargin.java isis-fish/trunk/src/test/resources/test-database/exports/RegionDefinition.java isis-fish/trunk/src/test/resources/test-database/exports/RejetsNombre.java isis-fish/trunk/src/test/resources/test-database/exports/RejetsPoids.java isis-fish/trunk/src/test/resources/test-database/exports/VesselMargin.java isis-fish/trunk/src/test/resources/test-database/exports/ZonesDefinition.java isis-fish/trunk/src/test/resources/test-database/rules/Cantonnement.java isis-fish/trunk/src/test/resources/test-database/rules/CantonnementPreSimu.java isis-fish/trunk/src/test/resources/test-database/rules/ChangementParamControlablePresimu.java isis-fish/trunk/src/test/resources/test-database/rules/EffortReduction.java isis-fish/trunk/src/test/resources/test-database/rules/GraviteVPUE1.java isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEngin.java isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEnginPreSimu.java isis-fish/trunk/src/test/resources/test-database/rules/TACpoids.java isis-fish/trunk/src/test/resources/test-database/rules/TailleMin.java isis-fish/trunk/src/test/resources/test-database/rules/TotalClosure.java isis-fish/trunk/src/test/resources/test-database/scripts/GravityModel.java isis-fish/trunk/src/test/resources/test-database/scripts/ResultName.java isis-fish/trunk/src/test/resources/test-database/scripts/RuleUtil.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorJavaExpandGrid.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFast.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFrF2.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRMorris.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorROptimumLHS.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRRandomLHS.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRSobol.java isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRegularFractions.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassReferenceY9.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeReferenceY12.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeY6.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassY3.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightReferenceY7.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeReferenceY10.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeY4.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightY1.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassReferenceY8.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeReferenceY11.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeY5.java isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassY2.java Modified: isis-fish/trunk/changelog.txt =================================================================== --- isis-fish/trunk/changelog.txt 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/changelog.txt 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,3 +1,24 @@ +isis-fish (3.4.0.0) test; urgency=low + + * Remove maturity group unique constraints + * Add view to test R configuration + * Disable charset converter (need to be retested) + * Add a new button to check all script in one action in script UI + * Improve UI to enable some fields/tabs only after region loading + * Enable to put population effectives into factors + * Enable to put rules into factor + * Add group screening features + * Modify parameters interface to prepare factorizable values (population/rule) + * Factor, DesignPlan, Scenario and Domain are no longer generics + * Use new Jaxx tree api + * Update i18n to 2.3.1 + * Update to topia 2.5.3 + * Update to Jaxx 2.4 + * Update to rSyntaxTextArea 1.5.0 + * Update to svnkit 1.3.5 + + -- jeu. févr. 4 11:48:12 CET 2010 + isis-fish (3.3.0.8) stable; urgency=low * Fix NullPointerException with length change matrix Copied: isis-fish/trunk/doc/devel/Sensitivity.png (from rev 3392, isis-fish/branches/3.3.1/doc/devel/Sensitivity.png) =================================================================== (Binary files differ) Copied: isis-fish/trunk/doc/devel/sensitivity.zargo (from rev 3392, isis-fish/branches/3.3.1/doc/devel/sensitivity.zargo) =================================================================== (Binary files differ) Modified: isis-fish/trunk/pom.xml =================================================================== --- isis-fish/trunk/pom.xml 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/pom.xml 2011-06-14 17:43:37 UTC (rev 3393) @@ -11,7 +11,7 @@ <groupId>fr.ifremer</groupId> <artifactId>isis-fish</artifactId> - <version>3.3.0.9-SNAPSHOT</version> + <version>3.4.0.0-SNAPSHOT</version> <!-- POM Relationships : Inheritance : Dependencies --> <dependencies> @@ -25,9 +25,24 @@ </dependency> <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <version>${nuitonUtilsVersion}</version> + <scope>compile</scope> + </dependency> + + <!-- Unused, but make mavenpom happy --> + <dependency> + <groupId>org.apache.struts.xwork</groupId> + <artifactId>xwork-core</artifactId> + <version>2.2.1.1</version> + <scope>compile</scope> + </dependency> + + <dependency> <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n-api</artifactId> - <version>1.0.1</version> + <artifactId>nuiton-i18n</artifactId> + <version>${nuitonI18nVersion}</version> <scope>compile</scope> </dependency> @@ -48,16 +63,23 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> - <version>3.3.2.GA</version> + <version>3.6.4.Final</version> <scope>compile</scope> </dependency> <dependency> - <groupId>org.nuiton</groupId> + <groupId>org.nuiton.matrix</groupId> <artifactId>nuiton-matrix</artifactId> - <version>2.0.1</version> + <version>2.2-SNAPSHOT</version> <scope>compile</scope> </dependency> + + <dependency> + <groupId>org.nuiton.matrix</groupId> + <artifactId>nuiton-matrix-gui</artifactId> + <version>2.2-SNAPSHOT</version> + <scope>compile</scope> + </dependency> <dependency> <groupId>org.nuiton</groupId> @@ -67,6 +89,13 @@ </dependency> <dependency> + <groupId>com.fifesoft</groupId> + <artifactId>rsyntaxtextarea</artifactId> + <version>1.5.0</version> + <scope>runtime</scope> + </dependency> + + <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.1</version> @@ -83,21 +112,21 @@ <!-- Jaxx --> <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-validator</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> </dependency> @@ -105,14 +134,14 @@ <dependency> <groupId>org.swinglabs</groupId> <artifactId>jxlayer</artifactId> - <version>3.0.3</version> + <version>3.0.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-j2r</artifactId> - <version>1.0.1</version> + <version>1.0.2</version> <scope>compile</scope> </dependency> @@ -139,11 +168,17 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math</artifactId> - <version>2.1</version> + <version>2.2</version> <scope>runtime</scope> <!--script --> </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.2</version> + </dependency> + + <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> @@ -174,15 +209,14 @@ <artifactId>dom4j</artifactId> <version>1.6.1</version> <scope>compile</scope> + <exclusions> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + </exclusions> </dependency> - <dependency> - <groupId>jfree</groupId> - <artifactId>jfreechart</artifactId> - <version>1.0.12</version> - <scope>compile</scope> - </dependency> - <!-- encore utilise pour les pre-scripts --> <dependency> <groupId>org.beanshell</groupId> @@ -198,33 +232,38 @@ <scope>compile</scope> </dependency> - <dependency> - <groupId>org.nuiton.thirdparty</groupId> + <!-- <dependency> + <groupId>com.fifesoft</groupId> <artifactId>rsyntaxtextarea</artifactId> - <version>1.4.1</version> - <scope>runtime</scope> + <version>1.5.0</version> </dependency> <dependency> + <groupId>com.fifesoft</groupId> + <artifactId>languagesupport</artifactId> + <version>0.7</version> + </dependency> --> + + <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> - <version>0.1.42</version> + <version>0.1.44-1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.swinglabs</groupId> - <artifactId>swingx</artifactId> - <version>1.6.1</version> + <artifactId>swingx-core</artifactId> + <version>1.6.2-2</version> <scope>compile</scope> </dependency> - <dependency> + <!-- <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.9.1</version> <scope>compile</scope> - </dependency> + </dependency> --> <dependency> <groupId>xml-apis</groupId> @@ -239,16 +278,34 @@ <artifactId>jaxen</artifactId> <version>1.1.1</version> <scope>runtime</scope> + <exclusions> + <exclusion> + <artifactId>xml-apis</artifactId> + <groupId>xml-apis</groupId> + </exclusion> + <exclusion> + <artifactId>xmlParserAPIs</artifactId> + <groupId>xerces</groupId> + </exclusion> + </exclusions> </dependency> <!-- Change this dependence if you change database --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <version>1.2.128</version> + <version>1.3.155</version> <scope>compile</scope> </dependency> + <!-- Migration des bases creee avec h2 1.1 --> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2mig_pagestore_addon</artifactId> + <version>1.3.153</version> + <scope>runtime</scope> + </dependency> + <!-- aspectwerkz --> <dependency> <groupId>aspectwerkz</groupId> @@ -324,7 +381,7 @@ <dependency> <groupId>org.tmatesoft.svnkit</groupId> <artifactId>svnkit</artifactId> - <version>1.3.4</version> + <version>1.3.5</version> <scope>compile</scope> </dependency> <!-- fin svnkit pour communication subversion --> @@ -332,16 +389,16 @@ <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> - <version>2.3.16</version> + <version>2.3.18</version> <scope>compile</scope> </dependency> - <dependency> + <!-- <dependency> <groupId>net.sourceforge.cpdetector</groupId> <artifactId>cpdetector</artifactId> <version>1.0.7</version> <scope>compile</scope> - </dependency> + </dependency> --> <dependency> <groupId>com.sun</groupId> @@ -476,21 +533,18 @@ <!-- Super pom properties --> <projectId>isis-fish</projectId> <labs.id>8</labs.id> - <javadocPluginVersion>2.7</javadocPluginVersion> <siteLocales>fr,en</siteLocales> <maven.jar.main.class>fr.ifremer.isisfish.IsisFish</maven.jar.main.class> <license.licenseName>gpl_v2</license.licenseName> <!-- Dependencies version --> - <jaxxVersion>1.7.1</jaxxVersion> - <eugeneVersion>2.0.2</eugeneVersion> - <topiaVersion>2.3.4</topiaVersion> - <nuitonUtilsVersion>1.1.4</nuitonUtilsVersion> - <nuitonI18nVersion>1.2.2</nuitonI18nVersion> - <nuitonWidgetsVersion>1.0.1</nuitonWidgetsVersion> - <jrstPluginVersion>1.1.1</jrstPluginVersion> + <jaxxVersion>2.4.2</jaxxVersion> + <eugeneVersion>2.3.4</eugeneVersion> + <topiaVersion>2.6-SNAPSHOT</topiaVersion> + <nuitonUtilsVersion>2.2</nuitonUtilsVersion> + <nuitonI18nVersion>2.4</nuitonI18nVersion> + <nuitonWidgetsVersion>1.1.2-SNAPSHOT</nuitonWidgetsVersion> <aspectwerkzVersion>2.0</aspectwerkzVersion> - <xmlrpcVersion>3.1.2</xmlrpcVersion> <!-- jnlp (disabled until retested) <keystorepath>${codelutin.keystorepath}</keystorepath> @@ -522,14 +576,15 @@ <artifactId>maven-i18n-plugin</artifactId> <version>${nuitonI18nVersion}</version> </plugin> - <!-- <plugin> + <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> </configuration> - </plugin> --> + </plugin> + <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> @@ -538,7 +593,6 @@ <addClasspath>true</addClasspath> <mainClass>${maven.jar.main.class}</mainClass> <classpathPrefix>lib/</classpathPrefix> - <useUniqueVersions>false</useUniqueVersions> </manifest> </archive> </configuration> @@ -593,27 +647,12 @@ <fullPackagePath>fr.ifremer.isisfish</fullPackagePath> <defaultPackage>fr.ifremer.isisfish</defaultPackage> <!--<extractedPackages>fr.ifremer.isisfish</extractedPackages>--> - <templates> - org.nuiton.topia.generator.TopiaMetaTransformer - </templates> + <templates>org.nuiton.topia.generator.TopiaMetaTransformer</templates> </configuration> <goals> <goal>smart-generate</goal> </goals> </execution> - <execution> - <id>copyVersionFiles</id> - <phase>generate-sources</phase> - <configuration> - <includes>**/*.objectmodel</includes> - <copyVersionDir>${basedir}/src/main/resources/oldmappings/%MODELNAME%</copyVersionDir> - <copyVersionFiles>**/*.hbm.xml</copyVersionFiles> - <overwrite>true</overwrite> - </configuration> - <goals> - <goal>copyVersionFiles</goal> - </goals> - </execution> </executions> <dependencies> <dependency> @@ -635,7 +674,6 @@ </goals> <configuration> <src>${basedir}/src/main/java</src> - <extraImportList>jaxx.runtime.SwingUtil</extraImportList> <addSourcesToClassPath>true</addSourcesToClassPath> <addProjectClassPath>true</addProjectClassPath> </configuration> @@ -692,28 +730,16 @@ <repositories> <repository> - <id>javanet.repository</id> - <url>http://download.java.net/maven/2/</url> + <id>nuiton.public</id> + <url>http://maven.nuiton.org/nexus/content/groups/public</url> </repository> - <repository> - <id>nuiton.release</id> - <url>http://maven.nuiton.org/release</url> - </repository> - <repository> - <id>nuiton.snapshot</id> - <url>http://maven.nuiton.org/snapshot</url> - </repository> </repositories> <pluginRepositories> <pluginRepository> - <id>nuiton.plugin.release</id> - <url>http://maven.nuiton.org/release</url> + <id>nuiton.plugin.public</id> + <url>http://maven.nuiton.org/nexus/content/groups/public</url> </pluginRepository> - <pluginRepository> - <id>nuiton.plugin.snapshot</id> - <url>http://maven.nuiton.org/snapshot</url> - </pluginRepository> </pluginRepositories> <profiles> @@ -783,13 +809,11 @@ <artifactId>maven-javadoc-plugin</artifactId> <configuration> <links> - <link>http://java.sun.com/javase/6/docs/api/</link> - <link>http://maven-site.nuiton.org/nuiton-utils/apidocs/</link> - <link>http://maven-site.nuiton.org/nuiton-matrix/apidocs/</link> + <link>http://download.oracle.com/javase/6/docs/api/</link> + <link>http://maven-site.nuiton.org/nuiton-utils/nuiton-utils/apidocs/</link> + <link>http://maven-site.nuiton.org/nuiton-matrix/nuiton-matrix/apidocs/</link> <link>http://maven-site.nuiton.org/nuiton-j2r/apidocs/</link> - <link> - http://maven-site.nuiton.org/topia/topia-persistence/apidocs/ - </link> + <link>http://maven-site.nuiton.org/topia/topia-persistence/apidocs/</link> </links> </configuration> </plugin> Modified: isis-fish/trunk/src/main/assembly/bin.xml =================================================================== --- isis-fish/trunk/src/main/assembly/bin.xml 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/assembly/bin.xml 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,8 +24,9 @@ #L% --> -<assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.1.xsd"> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>bin</id> <formats> <format>zip</format> @@ -69,6 +70,13 @@ <include>isisfish64.bat</include> </includes> </fileSet> + <fileSet> + <directory>src/main/assembly</directory> + <outputDirectory /> + <includes> + <include>isisfish-log4j.properties</include> + </includes> + </fileSet> </fileSets> <files> Copied: isis-fish/trunk/src/main/assembly/isisfish-log4j.properties (from rev 3392, isis-fish/branches/3.3.1/src/main/assembly/isisfish-log4j.properties) =================================================================== --- isis-fish/trunk/src/main/assembly/isisfish-log4j.properties (rev 0) +++ isis-fish/trunk/src/main/assembly/isisfish-log4j.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,45 @@ +### +# #%L +# IsisFish +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2011 CodeLutin, Chatellier Eric +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-2.0.html>. +# #L% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout + +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +# Package level +log4j.logger.fr.ifremer.isisfish=INFO +log4j.logger.analyseplans=INFO +log4j.logger.exports=INFO +log4j.logger.formules=INFO +log4j.logger.rules=INFO +log4j.logger.scripts=INFO +log4j.logger.sensitivity=INFO +log4j.logger.sensitivityexports=INFO +log4j.logger.simulators=INFO + +# Add your configuration here +#log4j.logger.org.nuiton.j2r=DEBUG Modified: isis-fish/trunk/src/main/assembly/x64/jri.dll =================================================================== (Binary files differ) Modified: isis-fish/trunk/src/main/assembly/x64/libjri.so =================================================================== (Binary files differ) Modified: isis-fish/trunk/src/main/assembly/x86/jri.dll =================================================================== (Binary files differ) Modified: isis-fish/trunk/src/main/assembly/x86/libjri.so =================================================================== (Binary files differ) Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -2,6 +2,7 @@ * #%L * IsisFish * +<<<<<<< .courant * $Id$ * $HeadURL$ * %% @@ -11,6 +12,17 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. +======= + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Benjamin Poussin, 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 2 of the + * License, or (at your option) any later version. +>>>>>>> .fusion-droit.r3392 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,6 +38,7 @@ package fr.ifremer.isisfish; import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; import java.io.File; import java.net.MalformedURLException; @@ -119,7 +132,8 @@ * migration de donnees demande automatiquement un changement de version * d'application. */ - protected final static Version version = new Version(3, 3, 0, 7); + protected final static Version version = new Version(3, 4, 0, 0); + protected final static Version databaseVersion = new Version( version.getNumber(0), version.getNumber(1)); protected final static Version apiVersion = new Version( @@ -157,7 +171,7 @@ return apiVersion; } - static final public String COPYRIGHT_TEXT = "Version " + getVersion() + " IFREMER-MAERHA © 2000-2010"; + static final public String COPYRIGHT_TEXT = "Version " + getVersion() + " IFREMER-MAERHA © 2000-2011"; static final public String CONFIG_FILENAME = "isis-config-" + version.getNumber(0); /** separateur de liste */ @@ -205,6 +219,16 @@ File result = getOptionAsFile(Option.DATABASE_DIRECTORY.key); return result; } + + /** + * Retourne le repertoire racine de toutes les donnees communauté (commit utilisateur). + * + * @return community database directory + */ + public File getCommunityDatabaseDirectory() { + File result = getOptionAsFile(Option.COMMUNITY_DATABASE_DIRECTORY.key); + return result; + } /** * Get database directory to use for script. @@ -868,7 +892,7 @@ * @throws org.nuiton.util.ArgumentsParserException */ @Override - public void parse(String[] args) throws ArgumentsParserException { + public ApplicationConfig parse(String... args) throws ArgumentsParserException { super.parse(args); // dans la version precedente (3.1) seul le fichier user existe, il est // donc le seul a devoir etre modifie @@ -941,6 +965,8 @@ if (log.isDebugEnabled()) { printConfig(); } + + return this; } ////////////////////////////////////////////////// @@ -954,90 +980,93 @@ */ public static enum Option implements OptionDef { - COMPILATION_DIRECTORY("compilation.directory", _("isisfish.config.main.compileDirectory.description"), getUserHome() + File.separator + "isis-build"), - MONITORING_DIRECTORY("monitoring.directory", _("isisfish.config.main.monitoringDirectory.description"), getUserHome() + File.separator + "isis-monitoring"), - JAVADOC_DIRECTORY("javadoc.directory", _("isisfish.config.main.javadocDirectory.description"), getUserHome() + File.separator + "isis-docs"), - CONFIG_FILE(CONFIG_FILE_NAME, _("isisfish.config.main.configFileName.description"), CONFIG_FILENAME), - BACKUP_DIRECTORY("backup.directory", _("isisfish.config.main.defaultBackupDirectory.description"), getUserHome() + File.separator + "isis-backup"), + CONFIG_FILE(CONFIG_FILE_NAME, n_("isisfish.config.main.configFileName.description"), CONFIG_FILENAME), + COMPILATION_DIRECTORY("compilation.directory", n_("isisfish.config.main.compileDirectory.description"), getUserHome() + File.separator + "isis-build"), + MONITORING_DIRECTORY("monitoring.directory", n_("isisfish.config.main.monitoringDirectory.description"), getUserHome() + File.separator + "isis-monitoring"), + JAVADOC_DIRECTORY("javadoc.directory", n_("isisfish.config.main.javadocDirectory.description"), getUserHome() + File.separator + "isis-docs"), + BACKUP_DIRECTORY("backup.directory", n_("isisfish.config.main.defaultBackupDirectory.description"), getUserHome() + File.separator + "isis-backup"), - DEFAULT_EXPORT_NAMES("default.export.names", _("isisfish.config.main.defaultExportNames.description"), ""), - DEFAULT_RESULT_NAMES("default.result.names", _("isisfish.config.main.defaultResultNames.description"), ""), - DEFAULT_MAP_FILENAME("default.map.filename", _("isisfish.config.main.defaultMapFile.description"), "maps/vmap_area_thin.shp"), - DEFAULT_TAG_VALUE("default.tagvalue", _("isisfish.config.main.defaultTagValue.description"), ""), - ENCODING("encoding", _("isisfish.config.main.encoding.description"), "UTF-8"), - JAVADOC_URL("javadoc.url", _("isisfish.config.main.javadocURL.description"), "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/"), + DEFAULT_EXPORT_NAMES("default.export.names", n_("isisfish.config.main.defaultExportNames.description"), ""), + DEFAULT_RESULT_NAMES("default.result.names", n_("isisfish.config.main.defaultResultNames.description"), ""), + DEFAULT_MAP_FILENAME("default.map.filename", n_("isisfish.config.main.defaultMapFile.description"), "maps/vmap_area_thin.shp"), + DEFAULT_TAG_VALUE("default.tagvalue", n_("isisfish.config.main.defaultTagValue.description"), ""), + ENCODING("encoding", n_("isisfish.config.main.encoding.description"), "UTF-8"), + JAVADOC_URL("javadoc.url", n_("isisfish.config.main.javadocURL.description"), "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/"), - SIMULATOR_CLASSFILE("simulator.classfile", _("isisfish.config.main.defaultSimulator.description"), "DefaultSimulator.java"), + SIMULATOR_CLASSFILE("simulator.classfile", n_("isisfish.config.main.defaultSimulator.description"), "DefaultSimulator.java"), /** prevu pour l'architecture de lancement en plugin: local, isis-server, caparmor, ... */ - SIMULATOR_LAUNCHER(SimulationService.SIMULATION_LAUNCHER + ".3", _("isisfish.config.main.localSimulator.description"), InProcessSimulatorLauncher.class.getName()), - SIMULATOR_LAUNCHER2(SimulationService.SIMULATION_LAUNCHER + ".1", _("isisfish.config.main.subSimulator.description"), SubProcessSimulationLauncher.class.getName()), - SIMULATOR_LAUNCHER_REMOTE(SimulationService.SIMULATION_LAUNCHER + ".2", _("isisfish.config.main.remoteCaparmor.description"), SSHSimulatorLauncher.class.getName()), + SIMULATOR_LAUNCHER(SimulationService.SIMULATION_LAUNCHER + ".3", n_("isisfish.config.main.localSimulator.description"), InProcessSimulatorLauncher.class.getName()), + SIMULATOR_LAUNCHER2(SimulationService.SIMULATION_LAUNCHER + ".1", n_("isisfish.config.main.subSimulator.description"), SubProcessSimulationLauncher.class.getName()), + SIMULATOR_LAUNCHER_REMOTE(SimulationService.SIMULATION_LAUNCHER + ".2", n_("isisfish.config.main.remoteCaparmor.description"), SSHSimulatorLauncher.class.getName()), /** Serveur accessible par ssh : address */ - SIMULATOR_SSH_SERVER("simulation.ssh.server", _("isisfish.config.main.simulation.ssh.server.description"), "caparmor"), + SIMULATOR_SSH_SERVER("simulation.ssh.server", n_("isisfish.config.main.simulation.ssh.server.description"), "caparmor"), /** Serveur accessible par ssh : login */ - SIMULATOR_SSH_USER_NAME("simulation.ssh.username", _("isisfish.config.main.simulation.ssh.username.description"), ""), + SIMULATOR_SSH_USER_NAME("simulation.ssh.username", n_("isisfish.config.main.simulation.ssh.username.description"), ""), /** Serveur accessible par ssh : user home directory */ - SIMULATOR_SSH_USER_HOME("simulation.ssh.userhome", _("isisfish.config.main.simulation.ssh.userhome.description"), ""), + SIMULATOR_SSH_USER_HOME("simulation.ssh.userhome", n_("isisfish.config.main.simulation.ssh.userhome.description"), ""), /** Serveur accessible par ssh : remote data path */ - SIMULATOR_SSH_DATAPATH("simulation.ssh.datapath", _("isisfish.config.main.simulation.ssh.datapath.description"), "isis-database-3"), + SIMULATOR_SSH_DATAPATH("simulation.ssh.datapath", n_("isisfish.config.main.simulation.ssh.datapath.description"), "isis-database-3"), /** Serveur accessible par ssh : remote isis home install */ - SIMULATOR_SSH_ISIS_HOME("simulation.ssh.isis.home", _("isisfish.config.main.simulation.ssh.isis.home.description"), "/home3/caparmor/poussin/isis-fish-" + IsisConfig.getApiVersion()), + SIMULATOR_SSH_ISIS_HOME("simulation.ssh.isis.home", n_("isisfish.config.main.simulation.ssh.isis.home.description"), "/home3/caparmor/poussin/isis-fish-" + IsisConfig.getApiVersion()), /** Serveur accessible par ssh : remote tmp path */ - SIMULATOR_SSH_TMPPATH("simulation.ssh.tmppath", _("isisfish.config.main.simulation.ssh.tmppath.description"), "isis-tmp"), + SIMULATOR_SSH_TMPPATH("simulation.ssh.tmppath", n_("isisfish.config.main.simulation.ssh.tmppath.description"), "isis-tmp"), /** Serveur accessible par SSH : emplacement de Java (full path) */ - SIMULATOR_SSH_JAVAPATH("simulation.ssh.javapath", _("isisfish.config.main.simulation.ssh.javapath.description"), "/home3/caparmor/poussin/jdk/bin/java"), + SIMULATOR_SSH_JAVAPATH("simulation.ssh.javapath", n_("isisfish.config.main.simulation.ssh.javapath.description"), "/home3/caparmor/poussin/jdk/bin/java"), /** Serveur accessible par SSH : emplacement des executables pbs */ - SIMULATOR_SSH_PBSBINPATH("simulation.ssh.pbsbinpath", _("isisfish.config.main.simulation.ssh.pbsbinpath.description"), "/usr/pbs/bin"), + SIMULATOR_SSH_PBSBINPATH("simulation.ssh.pbsbinpath", n_("isisfish.config.main.simulation.ssh.pbsbinpath.description"), "/usr/pbs/bin"), /** Serveur accessible par SSH : option de l'executable qsub (defaut to -m n = no mail) */ - SIMULATOR_SSH_PBSQSUBOPTIONS("simulation.ssh.pbsqsuboptions", _("isisfish.config.main.simulation.ssh.pbsqsuboptions.description"), "-m n"), + SIMULATOR_SSH_PBSQSUBOPTIONS("simulation.ssh.pbsqsuboptions", n_("isisfish.config.main.simulation.ssh.pbsqsuboptions.description"), "-m n"), /** Serveur accessible par SSH : interval de check du fichier de control */ - SIMULATOR_SSH_CONTROLCHECKINTERVAL("simulation.ssh.control.check.interval", _("isisfish.config.main.simulation.ssh.control.check.interval.description"), "120"), + SIMULATOR_SSH_CONTROLCHECKINTERVAL("simulation.ssh.control.check.interval", n_("isisfish.config.main.simulation.ssh.control.check.interval.description"), "120"), /** Serveur accessible par SSH : nombre de thread au maximum a utilise simultanement */ - SIMULATOR_SSH_MAXTHREADS("simulation.ssh.max.threads", _("isisfish.config.main.simulation.ssh.max.threads.description"), "1"), + SIMULATOR_SSH_MAXTHREADS("simulation.ssh.max.threads", n_("isisfish.config.main.simulation.ssh.max.threads.description"), "1"), /** Application locale (for i18n init). */ - LOCALE("locale", _("isisfish.config.main.locale.description"), "fr_FR"), - SIMULATION_SHOW_ONLY_ERROR("simulationShowOnlyError", _("isisfish.config.main.simulationShowOnlyError.description"), "false"), - + LOCALE("locale", n_("isisfish.config.main.locale.description"), "fr_FR"), + SIMULATION_SHOW_ONLY_ERROR("simulationShowOnlyError", n_("isisfish.config.main.simulationShowOnlyError.description"), "false"), + /** Perform ui launch option. */ - LAUNCH_UI("launch.ui", _("isisfish.config.main.launchUI.description"), "true"), + LAUNCH_UI("launch.ui", n_("isisfish.config.main.launchUI.description"), "true"), /** Perform data migration option. */ - PERFORM_MIGRATION("perform.migration", _("isisfish.config.main.performmigration.description"), "true"), + PERFORM_MIGRATION("perform.migration", n_("isisfish.config.main.performmigration.description"), "true"), /** Perform vcs update option. */ - PERFORM_VCS_UPDATE("perform.vcsupdate", _("isisfish.config.main.performvcsupdate.description"), "true"), + PERFORM_VCS_UPDATE("perform.vcsupdate", n_("isisfish.config.main.performvcsupdate.description"), "true"), /** Perform cron option. */ - PERFORM_CRON("perform.cron", _("isisfish.config.main.performcron.description"), "true"), - - /** Database directory. */ - DATABASE_DIRECTORY("database.directory", _("isisfish.config.vcs.localDatabasePath.description"), getUserHome() + File.separator + "isis-database-3"), + PERFORM_CRON("perform.cron", n_("isisfish.config.main.performcron.description"), "true"), + /** Database lock mode (h2).*/ - DATABASE_LOCK_MODE("database.lockmode", _("isisfish.config.database.lockmode.description"), "file"), - + DATABASE_LOCK_MODE("database.lockmode", n_("isisfish.config.database.lockmode.description"), "file"), + // SSH (global, for both VCS and caparmor) - SSH_KEY_FILE("ssh.key.file", _("isisfish.config.ssh.key.file.description"), getUserHome() + File.separator + ".ssh" + File.separator + "isis_rsa"), - //SSH_PASSPHRASE_ENABLED("ssh.passphrase.enabled", _("isisfish.config.vcs.noPassPhrase.description"), "false"), - //SSH_PASSPHRASE("ssh.passphrase", _("isisfish.config.vcs.passphrase.description"), ""), + SSH_KEY_FILE("ssh.key.file", n_("isisfish.config.ssh.key.file.description"), getUserHome() + File.separator + ".ssh" + File.separator + "isis_rsa"), - // can be None, CVS or SVN. only None or SVN work - VCS_TYPE(VCS.VCS_TYPE, _("isisfish.config.vcs.type.description"), VCS.TYPE_SVN), - // depend of VCS_TYPE, for SVN can be svn, svn+ssh, http or file - VCS_PROTOCOL(VCS.VCS_PROTOCOL, _("isisfish.config.vcs.useSshConnexion.description"), "svn"), - - // user login to access vcs - VCS_USER_NAME(VCS.VCS_USER_NAME, _("isisfish.config.vcs.userName.description"), ""), - VCS_USER_PASSWORD(VCS.VCS_USER_PASSWORD, _("isisfish.config.vcs.userPassword.description"), ""), - VCS_HOST_NAME(VCS.VCS_HOST_NAME, _("isisfish.config.vcs.hostName.description"), "labs.libre-entreprise.org"), - VCS_PATH(VCS.VCS_PATH, _("isisfish.config.vcs.remotePath.description"), "/svnroot/isis-fish-data/"), + DATABASE_DIRECTORY("database.directory", n_("isisfish.config.vcs.localDatabasePath.description"), getUserHome() + File.separator + "isis-database-3"), + VCS_TYPE(VCS.VCS_TYPE, n_("isisfish.config.vcs.type.description"), VCS.TYPE_SVN), + VCS_PROTOCOL(VCS.VCS_PROTOCOL, n_("isisfish.config.vcs.protocol.description"), "svn"), + VCS_USER_NAME(VCS.VCS_USER_NAME, n_("isisfish.config.vcs.userName.description"), ""), + VCS_USER_PASSWORD(VCS.VCS_USER_PASSWORD, n_("isisfish.config.vcs.userPassword.description"), ""), + VCS_HOST_NAME(VCS.VCS_HOST_NAME, n_("isisfish.config.vcs.hostName.description"), "labs.libre-entreprise.org"), + VCS_PATH(VCS.VCS_PATH, n_("isisfish.config.vcs.remotePath.description"), "/svnroot/isis-fish-data/"), - USER_NAME("user.name", _("isisfish.config.main.userName.description"), System.getProperty("user.name")), - SMTP_SERVER("smtpServer", _("isisfish.config.main.smtpServer.description"), "smtp"), - USER_MAIL("userMail", _("isisfish.config.main.userMail.description"), USER_NAME.key + "@" + VCS_HOST_NAME.key); - - public final String key; - public final String description; - public final String defaultValue; + // community vsc + COMMUNITY_DATABASE_DIRECTORY("community.database.directory", n_("isisfish.config.vcs.localCommunityDatabasePath.description"), getUserHome() + File.separator + "isis-community-database-3"), + VCS_COMMUNITY_TYPE("vcs.community.type", n_("isisfish.config.vcs.community.type.description"), VCS.TYPE_SVN), + VCS_COMMUNITY_PROTOCOL("vcs.community.protocole", n_("isisfish.config.vcs.community.protocol.description"), "http"), + VCS_COMMUNITY_USER_NAME("vcs.community.username", n_("isisfish.config.vcs.community.username.description"), ""), + VCS_COMMUNITY_PASSWORD("vcs.community.password", n_("isisfish.config.vcs.community.password.description"), ""), + VCS_COMMUNITY_HOST_NAME("vcs.community.hostname", n_("isisfish.config.vcs.community.hostname.description"), "www.isis-fish.org"), + VCS_COMMUNITY_PATH("vcs.community.path", n_("isisfish.config.vcs.community.remotepath.description"), "/svn/isis-fish-community/"), + // misc options + USER_NAME("user.name", n_("isisfish.config.main.userName.description"), System.getProperty("user.name")), + SMTP_SERVER("smtpServer", n_("isisfish.config.main.smtpServer.description"), "smtp"), + USER_MAIL("userMail", n_("isisfish.config.main.userMail.description"), USER_NAME.key + "@" + VCS_HOST_NAME.key); + + public String key; + public String description; + public String defaultValue; + private Option(String key, String description, String defaultValue) { this.key = key; this.description = description; @@ -1057,7 +1086,7 @@ */ @Override public String getDescription() { - return description; + return _(description); } /* @@ -1091,6 +1120,30 @@ public boolean isTransient() { return false; } + + /* + * @see org.nuiton.util.ApplicationConfig.OptionDef#setDefaultValue(java.lang.String) + */ + @Override + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + /* + * @see org.nuiton.util.ApplicationConfig.OptionDef#setTransient(boolean) + */ + @Override + public void setTransient(boolean isTransient) { + + } + + /* + * @see org.nuiton.util.ApplicationConfig.OptionDef#setFinal(boolean) + */ + @Override + public void setFinal(boolean isFinal) { + + } } ////////////////////////////////////////////////// @@ -1098,58 +1151,70 @@ ////////////////////////////////////////////////// public static enum Action { - HELP(_("Show help"), OtherAction.class.getName() + "#help", "-h", "--help"), - VERSION(_("Show version"), OtherAction.class.getName() + "#version", "-v", "--version"), + HELP(n_("Show help"), OtherAction.class.getName() + "#help", "-h", "--help"), + VERSION(n_("Show version"), OtherAction.class.getName() + "#version", "-v", "--version"), - IMPORT_ANALYSE_PLAN(_(""), ImportAction.class.getName() + "#importAnalysePlan", "--importAnalysePlan"), - IMPORT_EXPORT(_(""), ImportAction.class.getName() + "#importExport", "--importExport"), - IMPORT_RULE(_(""), ImportAction.class.getName() + "#importRule", "--importRule"), - IMPORT_SCRIPT(_("Import one java file script source"), ImportAction.class.getName() + "#importScript", "--importScript"), - IMPORT_SIMULATOR(_(""), ImportAction.class.getName() + "#importSimulator", "--importSimulator"), - IMPORT_FORMULA(_(""), ImportAction.class.getName() + "#importFormula", "--importFormula"), - IMPORT_REGION(_(""), ImportAction.class.getName() + "#importRegion", "--importRegion"), - IMPORT_REGION_AND_RENAME(_(""), ImportAction.class.getName() + "#importRegionAndRename", "--importRegionAndRename"), - IMPORT_SIMULATION(_(""), ImportAction.class.getName() + "#importSimulation", "--importSimulation"), - IMPORT_SCRIPT_MODULE(_("Import zipped file containing all scripts directory structure"), ImportAction.class.getName() + "#importScriptModule", "--importScriptModule"), + IMPORT_ANALYSE_PLAN(n_(""), ImportAction.class.getName() + "#importAnalysePlan", "--importAnalysePlan"), + IMPORT_EXPORT(n_(""), ImportAction.class.getName() + "#importExport", "--importExport"), + IMPORT_RULE(n_(""), ImportAction.class.getName() + "#importRule", "--importRule"), + IMPORT_SCRIPT(n_("Import one java file script source"), ImportAction.class.getName() + "#importScript", "--importScript"), + IMPORT_SIMULATOR(n_(""), ImportAction.class.getName() + "#importSimulator", "--importSimulator"), + IMPORT_FORMULA(n_(""), ImportAction.class.getName() + "#importFormula", "--importFormula"), + IMPORT_REGION(n_(""), ImportAction.class.getName() + "#importRegion", "--importRegion"), + IMPORT_REGION_AND_RENAME(n_(""), ImportAction.class.getName() + "#importRegionAndRename", "--importRegionAndRename"), + IMPORT_SIMULATION(n_(""), ImportAction.class.getName() + "#importSimulation", "--importSimulation"), + IMPORT_SCRIPT_MODULE(n_("Import zipped file containing all scripts directory structure"), ImportAction.class.getName() + "#importScriptModule", "--importScriptModule"), - LIST_ANALYSE_PLAN(_(""), ExportAction.class.getName() + "#listAnalysePlan", "--listAnalysePlan"), - LIST_EXPORT(_(""), ExportAction.class.getName() + "#listExport", "--listExport"), - LIST_RULE(_(""), ExportAction.class.getName() + "#listRule", "--listRule"), - LIST_SCRIPT(_(""), ExportAction.class.getName() + "#listScript", "--listScript"), - LIST_SIMULATOR(_(""), ExportAction.class.getName() + "#listSimulator", "--listSimulator"), - LIST_FORMULA(_(""), ExportAction.class.getName() + "#listFormula", "--listFormula"), - LIST_REGION(_(""), ExportAction.class.getName() + "#listRegion", "--listRegion"), - LIST_SIMULATION(_(""), ExportAction.class.getName() + "#listSimulation", "--listSimulation"), + LIST_ANALYSE_PLAN(n_(""), ExportAction.class.getName() + "#listAnalysePlan", "--listAnalysePlan"), + LIST_EXPORT(n_(""), ExportAction.class.getName() + "#listExport", "--listExport"), + LIST_RULE(n_(""), ExportAction.class.getName() + "#listRule", "--listRule"), + LIST_SCRIPT(n_(""), ExportAction.class.getName() + "#listScript", "--listScript"), + LIST_SIMULATOR(n_(""), ExportAction.class.getName() + "#listSimulator", "--listSimulator"), + LIST_FORMULA(n_(""), ExportAction.class.getName() + "#listFormula", "--listFormula"), + LIST_REGION(n_(""), ExportAction.class.getName() + "#listRegion", "--listRegion"), + LIST_SIMULATION(n_(""), ExportAction.class.getName() + "#listSimulation", "--listSimulation"), - EXPORT_ANALYSE_PLAN(_(""), ExportAction.class.getName() + "#exportAnalysePlan", "--exportAnalysePlan"), - EXPORT_EXPORT(_(""), ExportAction.class.getName() + "#exportExport", "--exportExport"), - EXPORT_RULE(_(""), ExportAction.class.getName() + "#exportRule", "--exportRule"), - EXPORT_SCRIPT(_(""), ExportAction.class.getName() + "#exportScript", "--exportScript"), - EXPORT_SIMULATOR(_(""), ExportAction.class.getName() + "#exportSimulator", "--exportSimulator"), - EXPORT_FORMULA(_(""), ExportAction.class.getName() + "#exportFormula", "--exportFormula"), - EXPORT_REGION(_(""), ExportAction.class.getName() + "#exportRegion", "--exportRegion"), - EXPORT_SIMULATION(_(""), ExportAction.class.getName() + "#exportSimulation", "--exportSimulation"), + EXPORT_ANALYSE_PLAN(n_(""), ExportAction.class.getName() + "#exportAnalysePlan", "--exportAnalysePlan"), + EXPORT_EXPORT(n_(""), ExportAction.class.getName() + "#exportExport", "--exportExport"), + EXPORT_RULE(n_(""), ExportAction.class.getName() + "#exportRule", "--exportRule"), + EXPORT_SCRIPT(n_(""), ExportAction.class.getName() + "#exportScript", "--exportScript"), + EXPORT_SIMULATOR(n_(""), ExportAction.class.getName() + "#exportSimulator", "--exportSimulator"), + EXPORT_FORMULA(n_(""), ExportAction.class.getName() + "#exportFormula", "--exportFormula"), + EXPORT_REGION(n_(""), ExportAction.class.getName() + "#exportRegion", "--exportRegion"), + EXPORT_SIMULATION(n_(""), ExportAction.class.getName() + "#exportSimulation", "--exportSimulation"), - VCS_SSH_CREATE_KEY(_(""), VCSAction.class.getName() + "#sshCreateKey", "--sshCreateKey"), - VCS_UPDATE(_(""), VCSAction.class.getName() + "#vcsUpdate", "--vcsUpdate"), - VCS_ADD(_(""), VCSAction.class.getName() + "#vcsAdd", "--vcsAdd"), - VCS_REMOVE(_(""), VCSAction.class.getName() + "#vcsRemove", "--vcsRemove"), - VCS_COMMIT(_(""), VCSAction.class.getName() + "#vcsCommit", "--vcsCommit"), + VCS_SSH_CREATE_KEY(n_(""), VCSAction.class.getName() + "#sshCreateKey", "--sshCreateKey"), + VCS_UPDATE(n_(""), VCSAction.class.getName() + "#vcsUpdate", "--vcsUpdate"), + VCS_ADD(n_(""), VCSAction.class.getName() + "#vcsAdd", "--vcsAdd"), + VCS_REMOVE(n_(""), VCSAction.class.getName() + "#vcsRemove", "--vcsRemove"), + VCS_COMMIT(n_(""), VCSAction.class.getName() + "#vcsCommit", "--vcsCommit"), - SIMULATE_WITH_REGION(_(""), SimulationAction.class.getName() + "#simulateWithRegion", "--simulateWithRegion"), - SIMULATE_WITH_SIMULATION(_(""), SimulationAction.class.getName() + "#simulateWithSimulation", "--simulateWithSimulation"), - SIMULATE_WITH_SIMULATION_AND_SCRIPT(_(""), SimulationAction.class.getName() + "#simulateWithSimulationAndScript", "--simulateWithSimulationAndScript"), - SIMULATE_REMOTELLY(_(""), SimulationAction.class.getName() + "#simulateRemotelly", "--simulateRemotelly"), - SIMULATE_REMOTELLY_WITH_PRESCRIPT(_(""), SimulationAction.class.getName() + "#simulateRemotellyWithPreScript", "--simulateRemotellyWithPreScript"); + SIMULATE_WITH_REGION(n_(""), SimulationAction.class.getName() + "#simulateWithRegion", "--simulateWithRegion"), + SIMULATE_WITH_SIMULATION(n_(""), SimulationAction.class.getName() + "#simulateWithSimulation", "--simulateWithSimulation"), + SIMULATE_WITH_SIMULATION_AND_SCRIPT(n_(""), SimulationAction.class.getName() + "#simulateWithSimulationAndScript", "--simulateWithSimulationAndScript"), + SIMULATE_REMOTELLY(n_(""), SimulationAction.class.getName() + "#simulateRemotelly", "--simulateRemotelly"), + SIMULATE_REMOTELLY_WITH_PRESCRIPT(n_(""), SimulationAction.class.getName() + "#simulateRemotellyWithPreScript", "--simulateRemotellyWithPreScript"); - public String description; - public String action; - public String[] aliases; + protected String description; + protected String action; + protected String[] aliases; private Action(String description, String action, String ... aliases) { this.description = description; this.action = action; this.aliases = aliases; - } + } + + public String getDescription() { + return _(description); + } + + public String getAction() { + return action; + } + + public String[] getAliases() { + return aliases; + } } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2005 - 2010 Ifremer, CodeLutin + * Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -36,10 +36,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; -import java.util.HashMap; import java.util.List; -import java.util.Locale; -import java.util.Map; import javax.imageio.ImageIO; import javax.swing.JLabel; @@ -49,17 +46,14 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; -import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; -import org.nuiton.math.matrix.DoubleBigVector; -import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.i18n.init.ClassPathI18nInitializer; import org.nuiton.topia.TopiaException; import org.nuiton.util.FileUtil; -import org.nuiton.util.LocaleConverter; import org.nuiton.util.Version; -import org.nuiton.widget.SwingUtil; +import org.nuiton.widget.SwingSession; import fr.ifremer.isisfish.cron.CronService; import fr.ifremer.isisfish.datastore.AnalysePlanStorage; @@ -73,18 +67,8 @@ import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.datastore.SimulatorStorage; import fr.ifremer.isisfish.simulator.launcher.SimulationService; -import fr.ifremer.isisfish.types.Date; -import fr.ifremer.isisfish.types.Month; -import fr.ifremer.isisfish.types.RangeOfValues; -import fr.ifremer.isisfish.types.TimeUnit; import fr.ifremer.isisfish.ui.WelcomeUI; import fr.ifremer.isisfish.ui.util.ErrorHelper; -import fr.ifremer.isisfish.util.ConverterUtil; -import fr.ifremer.isisfish.util.DateConverter; -import fr.ifremer.isisfish.util.MonthConverter; -import fr.ifremer.isisfish.util.RangeOfValuesConverter; -import fr.ifremer.isisfish.util.StringConverter; -import fr.ifremer.isisfish.util.TimeUnitConverter; import fr.ifremer.isisfish.vcs.VCS; import fr.ifremer.isisfish.vcs.VCSActionEvent; import fr.ifremer.isisfish.vcs.VCSException; @@ -111,6 +95,8 @@ static public IsisConfig config = null; static public VCS vcs = null; + + static public VCS communityVcs = null; /** * ask for application quit @@ -119,69 +105,45 @@ System.exit(0); } - public static void main(String... args) { + public static void main(String... args) throws Exception { - try { - // permet de faire fonctionner la compilation en webstart - System.setSecurityManager(null); + // permet de faire fonctionner la compilation en webstart + System.setSecurityManager(null); - // initialisation de l'application - IsisFish.init(args); + // initialisation de l'application + init(args); - if (log.isDebugEnabled()) { - log.debug(_("isisfish.launch.init.done", config.getElapsedTimeAsString())); - } + if (log.isDebugEnabled()) { + log.debug(_("isisfish.launch.init.done", config.getElapsedTimeAsString())); + } - // action after init - config.doAction(IsisConfig.STEP_AFTER_INIT); + // action after init + config.doAction(IsisConfig.STEP_AFTER_INIT); - // initVCS ask for passphrase, ui must be set before - initLookAndFeel(); - - // static vcs init (needed for some actions) - try { - initVCS(); - } catch (Exception eee) { - log.warn(_("Error during vcs initialisation"), eee); - } + // initVCS ask for passphrase, ui must be set before + initLookAndFeel(); + + // static vcs init (needed for some actions) + try { + initVCS(); + initCommunityVCS(); + } catch (Exception eee) { + log.warn(_("Error during vcs initialisation"), eee); + } - if (log.isInfoEnabled()) { - log.info(_("isisfish.launching", config.getElapsedTimeAsString())); - } - - // after init vcs and local data - config.doAction(IsisConfig.STEP_AFTER_INIT_VCS); - - doNuitonMigration(); + if (log.isInfoEnabled()) { + log.info(_("isisfish.launching", config.getElapsedTimeAsString())); + } + + // after init vcs and local data + config.doAction(IsisConfig.STEP_AFTER_INIT_VCS); - launchUI(); + launchUI(); - // action after ui launched - config.doAction(IsisConfig.STEP_AFTER_UI); - - startCronService(); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Global IsisFish exception", e); - } - quit(); - } catch (LinkageError e) { - - if (log.isFatalEnabled()) { - log.fatal("Linkage error detected", e); - } - - // a real java.lang.Error sometimes happen when - // using non recompiled script due to dependency changes - // this is the better solution found : - // remove isis build directory - FileUtil.deleteRecursively(IsisFish.config.getCompileDirectory()); - // display message - JOptionPane.showMessageDialog(null, _("isisfish.error.linkageerror.message"), - _("isisfish.error.linkageerror.title"), JOptionPane.ERROR_MESSAGE); - // restart isis - quit(); - } + // action after ui launched + config.doAction(IsisConfig.STEP_AFTER_UI); + + startCronService(); } /** @@ -196,82 +158,6 @@ } /** - * Move user script to nuiton dependants packages. - * - * Find all files containing "org.codelutin." into "org.nuiton." - */ - protected static void doNuitonMigration() { - if (config.isPerformMigration()) { - // Search in a set of directories - // Searching throw simulations/* can take a huge time... - File[] folders = new File[]{ - AnalysePlanStorage.getAnalysePlanDirectory(), - ExportStorage.getExportDirectory(), - FormuleStorage.getFormuleDirectory(), - RuleStorage.getRuleDirectory(), - ScriptStorage.getScriptDirectory(), - SensitivityStorage.getSensitivityDirectory(), - SensitivityExportStorage.getSensitivityExportDirectory(), - SimulatorStorage.getSimulatorDirectory() - }; - - try { - Map<File, List<CharSequence>> filesToMigrate = new HashMap<File, List<CharSequence>>(); - for (File folder : folders) { - filesToMigrate.putAll(FileUtil.grep("org\\.codelutin\\.", folder, ".*\\.java", "ISO-8859-1")); - } - - if (filesToMigrate != null && !filesToMigrate.isEmpty()) { - - // yes by defaut (for tests) - // but ask user if UI launch - boolean migrationOption = true; - if (IsisFish.config.isLaunchUI()) { - // display a user frame - String migratedFiles = ""; - String separator = ""; - for (File fileToMigrate : filesToMigrate.keySet()) { - migratedFiles += separator + fileToMigrate.toString(); - separator = "\n"; - } - JLabel labelModifiedFiles = new JLabel(_("isisfish.misc.nuitonmigration")); - JTextArea areaModifiedFiles = new JTextArea(migratedFiles); - areaModifiedFiles.setEditable(false); - areaModifiedFiles.setAutoscrolls(true); - JScrollPane sp = new JScrollPane(areaModifiedFiles); - sp.setPreferredSize(new Dimension(500, 100)); // don't remove popup is huge - migrationOption = ask(new Component[] { labelModifiedFiles, sp} ); - } - - // if migration has to be done - if (migrationOption) { - if (log.isInfoEnabled()) { - log.info("Starting nuiton.org migration for user scripts :"); - } - - for (File fileToMigrate : filesToMigrate.keySet()) { - if (log.isInfoEnabled()) { - log.info(" migrate file : " + fileToMigrate.getAbsolutePath()); - } - FileUtil.sed("org\\.codelutin\\.", "org.nuiton.", fileToMigrate, "ISO-8859-1"); - } - } - } - } - catch(IOException eee) { - if (log.isErrorEnabled()) { - log.error("Can't to nuiton migration", eee); - } - } - } - else { - if (log.isInfoEnabled()) { - log.info(_("Skip data migration (disabled)")); - } - } - } - - /** * Install "Nimbus" LookAndFeel if available. * * @throws InstantiationException @@ -318,28 +204,23 @@ // i18n is not inited here if (log.isInfoEnabled()) { - log.info("Starting Isis-Fish with args : " + java.util.Arrays.toString(args)); + log.info("Starting Isis-Fish " + IsisConfig.getVersion() + " with args : " + java.util.Arrays.toString(args)); log.info("Date: " + SimpleDateFormat.getInstance().format(new java.util.Date())); - log.info("Java version: " + System.getProperty("java.runtime.version")); - log.info("Java VM: " + System.getProperty("java.vm.name")); + log.info("Java version: " + System.getProperty("java.runtime.version") + ", " + System.getProperty("java.vm.name")); log.info("System arch: " + System.getProperty("os.arch")); - log.info("R_HOME: " + System.getenv("R_HOME")); - log.info("R.type: " + System.getProperty("R.type")); + log.info("R_HOME: " + System.getenv("R_HOME") + ", R.type: " + System.getProperty("R.type")); log.info("PATH: " + System.getenv("PATH")); } - // first load converter and matrixFactory - initConvertersAndMatrixFactory(); - - // after init shutdown hook - Runtime.getRuntime().addShutdownHook(new IsisQuitHook()); - // parsing des options à partir des arguments passés config = new IsisConfig(); config.parse(args); // init i18n - I18n.init(config.getLocale()); + I18n.init(new ClassPathI18nInitializer(), config.getLocale()); + + // after init shutdown hook + Runtime.getRuntime().addShutdownHook(new IsisQuitHook()); } /** @@ -398,26 +279,15 @@ * @return true if user confirm question */ protected static boolean ask(Object msg) { - boolean result = true; int value = JOptionPane.showConfirmDialog(null, msg); if (value == JOptionPane.CANCEL_OPTION) { quit(); } - result = value == JOptionPane.YES_OPTION; + boolean result = value == JOptionPane.YES_OPTION; return result; } /** - * Switch le vcs vers VCSNone et le sauvegarde pour le prochain lancement - */ - protected static void switchToNoneVCS() { - log.info(_("Switch repository type to none")); - config.setOption(IsisConfig.Option.VCS_TYPE.key, VCS.TYPE_NONE); - config.saveForUser(); - vcs = VCSFactory.createVCS(config); - } - - /** * Initialise le VCS et check s'il y a des mises à jour pour * prevenir l'utilisateur. * @@ -459,7 +329,10 @@ "Can't rename local repository that don't use svn"); } } else { - switchToNoneVCS(); + log.info(_("Switch repository type to none")); + config.setOption(IsisConfig.Option.VCS_TYPE.key, VCS.TYPE_NONE); + config.saveForUser(); + vcs = VCSFactory.createVCS(config); } } } @@ -470,8 +343,7 @@ log.info(_("Local repository don't exist")); } if (!vcs.isConnected()) { - ErrorHelper.showErrorDialog(_( - "isisfish.vcs.init.notfoundcantdownload", + ErrorHelper.showErrorDialog(_("isisfish.vcs.init.notfoundcantdownload", IsisConfig.getApiVersion()), null); } else { // Si on utilise pas le bon tag on change de tag @@ -523,7 +395,7 @@ // il est possiblement obligatoire de ne plus etre sur le trunk, ou // de migrer sur un autre tag - List<File> filesInClonflict = null; + List<File> filesInClonflict; // si on est sur une branche, on est en developpement, on ne fait donc rien if (vcs.getTag().startsWith("branches")) { @@ -563,11 +435,94 @@ else { // VCS can't be null // set none if ui isn't launched - config.setOption(VCS.VCS_TYPE, "none"); // to make him happy + config.setOption(VCS.VCS_TYPE, VCS.TYPE_NONE); // to make him happy vcs = VCSFactory.createVCS(config); } } + + /** + * Initialise le VCS et check s'il y a des mises à jour pour + * prevenir l'utilisateur. + * + * @throws VCSException + */ + static public void initCommunityVCS() throws VCSException { + // vcs must be done is ui is enabled too + if (config.isLaunchUI() && config.isPerformVcsUpdate()) { + + // init vcs + // in graphical mode, real VCS + communityVcs = VCSFactory.createPublicVCS(config); + + VCSActionAsker asker = new VCSActionAsker(); + communityVcs.addVetoableActionListener(asker); + + // Si le repo local exist mais n'est pas du bon type, on renome ce repertoire + File local = config.getCommunityDatabaseDirectory(); + + if (local.exists()) { + if (!communityVcs.isValidLocalRepository()) { + if (log.isInfoEnabled()) { + log.info(_("Local repository exists but it's not valide for current vcs: %s", + config.getOption(VCS.VCS_TYPE))); + } + if (ask(_("isisfish.vcs.init.wrongprotocol", local))) { + File localBackup = new File(local.getParentFile(), + local.getName() + "-" + + new SimpleDateFormat("yyyy-mm-dd-HH-mm-ss").format(new java.util.Date())); + if (log.isInfoEnabled()) { + log.info(_("Rename data directory to %s", localBackup)); + } + if (!local.renameTo(localBackup)) { + throw new IsisFishRuntimeException( + "Can't rename local repository that don't use svn"); + } + } else { + log.info(_("Switch repository type to none")); + config.setOption(IsisConfig.Option.VCS_COMMUNITY_TYPE.key, VCS.TYPE_NONE); + config.saveForUser(); + communityVcs = VCSFactory.createPublicVCS(config); + } + } + } + + // Si le repo local n'existe pas on fait un check out complet + if (!local.exists()) { + if (log.isInfoEnabled()) { + log.info(_("Local repository don't exist")); + } + if (!communityVcs.isConnected()) { + ErrorHelper.showErrorDialog(_("isisfish.vcs.init.notfoundcantdownload", + "trunk"), null); + } else { + // initialise le repo local + communityVcs.checkout(null, true); + } + } + + // on s'arrete la si on est pas connecte + if (communityVcs.isConnected()) { + + // cleanup + communityVcs.cleanup(null); + + // check protocol, user, host + communityVcs.checkProtocol(); + + } + + // fin de l'init on supprime le vetoable du vcs + communityVcs.remoteVetoableActionListener(asker); + } + else { + // VCS can't be null + // set none if ui isn't launched + config.setOption(IsisConfig.Option.VCS_COMMUNITY_TYPE.key, VCS.TYPE_NONE); // to make him happy + communityVcs = VCSFactory.createPublicVCS(config); + } + } + /** * Display dialog with files list, and specifique label. * @@ -603,16 +558,53 @@ public static void launchUI() { if (config.isLaunchUI()) { - // migration must be done in UI envirronement and - // must nerver be done in caparmor - // TODO set it here for now, ui is not displayed on caparmor - //doNuitonMigration(); - + // catch wall application exception + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + public void uncaughtException(Thread t, Throwable cause) { + if (cause instanceof LinkageError) { + if (log.isFatalEnabled()) { + log.fatal("Linkage error detected", cause); + } + + // a real java.lang.Error sometimes happen when + // using non recompiled script due to dependency changes + // this is the better solution found : + // remove isis build directory + FileUtil.deleteRecursively(IsisFish.config.getCompileDirectory()); + + ErrorHelper.showErrorDialog(null, _("isisfish.error.linkageerror.message"), cause); + } + else { + if (log.isErrorEnabled()) { + log.error("Global application exception", cause); + } + + // les NumberFormatException sont courantes lors de la saisie + // ca va etre relou de toutes les afficher + Throwable lastCause = cause; + while (lastCause.getCause() != null) { + lastCause = lastCause.getCause(); + } + if (!(lastCause instanceof NumberFormatException)) { + ErrorHelper.showErrorDialog(null, cause.getMessage(), cause); + } + } + } + }); + // init simulater manager SimulationService.getService(); // init IsisTray IsisTray.getInstance(); + + // configure swing session + // can't be in config ? getUserConfigDirectory() not static + File isisConfigDirectory = new File(config.getUserConfigDirectory(), "isis-fish"); + isisConfigDirectory.mkdirs(); + File sessionFile = new File(isisConfigDirectory, "session.xml"); + final SwingSession session = new SwingSession(sessionFile, true); + // lauch first UI (welcomeUI) WelcomeUI welcome = new WelcomeUI(); // Set to exit on close @@ -620,8 +612,15 @@ welcome.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - ((WelcomeUI)e.getSource()).close(); + WelcomeUI ui = (WelcomeUI)e.getSource(); + ui.getHandler().close(ui); } + + @Override + public void windowClosed(WindowEvent e) { + session.save(); + quit(); + } }); try { @@ -634,7 +633,10 @@ log.error("Can't set frame icon", ex); } } - SwingUtil.center(welcome); + + // show main isis window + welcome.setLocationRelativeTo(null); + session.add(welcome); welcome.setVisible(true); } else { @@ -643,26 +645,5 @@ } } } - - /** - * Initialise les convertiseurs utilisé par commons-beansutils. - * - * @deprecated since 3.2.0.5 duplicated with {@link ConverterUtil#getConverter(org.nuiton.topia.TopiaContext)} - */ - protected static void initConvertersAndMatrixFactory() { - - ConvertUtils.register(new LocaleConverter(), Locale.class); - - // init converters - ConvertUtils.register(new DateConverter(), Date.class); - ConvertUtils.register(new MonthConverter(), Month.class); - ConvertUtils.register(new TimeUnitConverter(), TimeUnit.class); - ConvertUtils.register(new RangeOfValuesConverter(), RangeOfValues.class); - // ... et inversement - ConvertUtils.register(new StringConverter(), String.class); - - // par defaut on utilise des doubles pour les matrices - MatrixFactory.setDefaultVectorClass(DoubleBigVector.class); - } } // IsisFish Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishException.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishException.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishException.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2005 - 2010 Ifremer, CodeLutin + * Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,24 +25,32 @@ package fr.ifremer.isisfish; +/** + * Isis non runtime exception. + * + * @author poussin + */ public class IsisFishException extends Exception { /** serialVersionUID. */ private static final long serialVersionUID = -9012018415761616627L; - public IsisFishException() { - super(); - } - + /** + * Constructor with message. + * + * @param message message + */ public IsisFishException(String message) { super(message); } + /** + * Constructor with message and cause. + * + * @param message message + * @param cause cause + */ public IsisFishException(String message, Throwable cause) { super(message, cause); } - - public IsisFishException(Throwable cause) { - super(cause); - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishRuntimeException.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishRuntimeException.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFishRuntimeException.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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,9 @@ package fr.ifremer.isisfish; /** + * Isis runtime exception. + * * @author poussin - * */ public class IsisFishRuntimeException extends RuntimeException { @@ -35,32 +36,21 @@ private static final long serialVersionUID = 3388901195563202616L; /** + * Constructor with message. * + * @param message message */ - public IsisFishRuntimeException() { - super(); - } - - /** - * @param message - */ public IsisFishRuntimeException(String message) { super(message); } /** - * @param message - * @param cause + * Constructor with message and cause. + * + * @param message message + * @param cause cause */ public IsisFishRuntimeException(String message, Throwable cause) { super(message, cause); } - - /** - * @param cause - */ - public IsisFishRuntimeException(Throwable cause) { - super(cause); - } - } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/OtherAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/OtherAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/OtherAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -58,7 +58,7 @@ System.out.println("Actions:"); for (IsisConfig.Action a : IsisConfig.Action.values()) { - System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + ") : " + a.description); + System.out.println("\t" + Arrays.toString(a.getAliases()) + "(" + a.getAction() + ") : " + a.getDescription()); } System.exit(0); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Benjamin Poussin + * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Benjamin Poussin, 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 @@ -97,8 +97,7 @@ RegionStorage.importAndRenameZip(region, regionName); } else { if (log.isWarnEnabled()) { - log.warn(_( - "Region %s allready exist in repository. Can't import", + log.warn(_("Region %s allready exist in repository. Can't import", regionName)); } } @@ -138,7 +137,8 @@ log.info("Command line action : simulateWithSimulationAndScript (" + simulationId + ", " + simulationZip.getAbsolutePath() + ", " + simulationPrescript + ")"); } - String name = simulationId; // ne pas mettre la date, car le sub process la met deja + " " + new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date()); + // ne pas mettre la date, car le sub process la met deja + " " + new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date()); + String name = simulationId; //SimulationStorage simulation = launcher.simulate(null, control, simulationZip); //simulation.getStorage().closeContext(); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -152,7 +152,7 @@ lastContentUpdate = System.nanoTime(); lastContentLength = getFile().length(); } catch (IOException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get content", eee); } } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/DataStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/DataStorage.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/DataStorage.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -202,8 +202,6 @@ /** * Returns the storage. * - * Update shema if necessary. - * * @return Returns the storage. */ public TopiaContext getStorage() { @@ -289,6 +287,7 @@ // load data // creation des proprietes pour creer le TopiaContext Properties config = new Properties(); + // false = don't perform, schema is empty IsisH2Config.addDatabaseConfig(config, rootDirDest); IsisH2Config.addHibernateMapping(config); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Tony Chemit + * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Tony Chemit, 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 @@ -32,14 +32,13 @@ import org.apache.commons.logging.LogFactory; import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; -import org.nuiton.topia.migration.TopiaMigrationServiceImpl; +import org.nuiton.topia.migration.TopiaMigrationEngine; +import org.nuiton.topia.migration.TopiaMigrationService; -import fr.ifremer.isisfish.IsisConfig; import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishDAOHelper; -import fr.ifremer.isisfish.datastore.migration.SwingMigrationCallbackHandler; +import fr.ifremer.isisfish.datastore.migration.DatabaseMigrationClass; - /** * Isis H2 concrete Config implementation. * @@ -56,7 +55,7 @@ private static Log log = LogFactory.getLog(IsisH2Config.class); /** Set in static field to be overridden by tests. Default to swing callback. */ - protected static Class<?> databaseMigrationClass = SwingMigrationCallbackHandler.class; + protected static Class<?> databaseMigrationClass = DatabaseMigrationClass.class; protected static final String COMMON_URL = // on peut aussi utiliser mysql ou postgresql @@ -158,11 +157,11 @@ } // migration configuration, seulement pour les fichiers, pas pour les bases memoires - config.put(TopiaMigrationServiceImpl.MIGRATION_APPLICATION_VERSION, IsisConfig.getDatabaseVersion().toString()); - config.put(TopiaMigrationServiceImpl.MIGRATION_PREVIOUS_MAPPING_DIRECTORY, "oldmappings"); - config.put(TopiaMigrationServiceImpl.MIGRATION_MODEL_NAMES, "IsisFish"); - config.put(TopiaMigrationServiceImpl.MIGRATION_CALLBACKHANDLERS, databaseMigrationClass.getName()); - config.put("topia.service.migration", TopiaMigrationServiceImpl.class.getName()); + config.put(TopiaMigrationService.TOPIA_SERVICE_NAME, TopiaMigrationEngine.class.getName()); + config.put(TopiaMigrationService.MIGRATION_CALLBACK, databaseMigrationClass.getName()); + /*if (!performMigration) { + config.put(TopiaMigrationService.MIGRATION_MIGRATE_ON_INIT, databaseMigrationClass.getName()); + }*/ return config; } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -93,10 +93,10 @@ transient protected Set<String> enabledResult = null; /** - * Les ResultStorage ne doivent pas etre instancier directement, mais - * recuperer a partir d'un - * {@link fr.ifremer.isisfish.datastore.SimulationStorage#getResultStorage()} - */ + * Les ResultStorage ne doivent pas etre instancier directement, mais + * recuperer a partir d'un + * {@link fr.ifremer.isisfish.datastore.SimulationStorage#getResultStorage()} + */ public ResultStorage(SimulationStorage simulation) { this.simulation = simulation; } @@ -327,9 +327,9 @@ protected void doAddResult(Date date, String name, MatrixND mat, TopiaContext tx) throws IsisFishException{ // si la matrice n'a pas de semantique on refuse - for (int i=0; i<mat.getNbDim(); i++) { + for (int i=0; i<mat.getDimCount(); i++) { // la semantique n'est pas bonne des qu'il y a un null dedans - if (mat.getSemantics(i).contains(null)) { + if (mat.getSemantic(i).contains(null)) { throw new SimulationException("Erreur le résultat que vous souhaitez enregistrer n'a pas d'information convenable pour la dimension: " + i + " " + mat.getDimensionName(i) ); } } @@ -586,7 +586,7 @@ MatrixND mat = (MatrixND)results.get(0).getMatrix(); // recuperation des noms des dimensions - String [] dimNames = new String[1 + mat.getNbDim()]; + String [] dimNames = new String[1 + mat.getDimCount()]; dimNames[0] = _("isisfish.common.date"); for (int i=1; i<dimNames.length; i++) { dimNames[i] = mat.getDimensionName(i-1); @@ -594,7 +594,7 @@ // creation de la semantique pour la matrice resultat. +1 pour les dates - List [] sem = new List[1 + mat.getNbDim()]; + List[] sem = new List[1 + mat.getDimCount()]; sem[0] = dates; for (int i=1; i<sem.length; i++) { @@ -607,8 +607,8 @@ log.trace("Ajout de la semantics: "+ Arrays.asList(mattmp.getSemantics())); } - for (int s=0; s<mattmp.getNbDim(); s++) { - sem[s+1].addAll(mattmp.getSemantics(s)); + for (int s=0; s<mattmp.getDimCount(); s++) { + sem[s+1].addAll(mattmp.getSemantic(s)); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -362,8 +362,7 @@ parameter = new SimulationParameterImpl(); parameter.fromProperties(prop); } catch (IOException eee) { - throw new IsisFishRuntimeException(_( - "isisfish.error.read.simulation.parameters", file), eee); + throw new IsisFishRuntimeException(_("isisfish.error.read.simulation.parameters", file), eee); } } return this.parameter; @@ -392,8 +391,7 @@ parameter = new SimulationParameterImpl(); parameter.fromProperties(prop); } catch (IOException eee) { - throw new IsisFishRuntimeException(_( - "isisfish.error.read.simulation.parameters", file), eee); + throw new IsisFishRuntimeException(_("isisfish.error.read.simulation.parameters", file), eee); } return this.parameter; } @@ -732,10 +730,10 @@ tx.commitTransaction(); tx.closeContext(); - } catch (IOException e) { - throw new StorageException(e); - } catch (TopiaException e) { - throw new StorageException(e); + } catch (IOException ex) { + throw new StorageException("Can't extract region", ex); + } catch (TopiaException ex) { + throw new StorageException("Can't extract region", ex); } finally { if (tmpDir != null && !FileUtil.deleteRecursively(tmpDir)) { log.warn(_("isisfish.error.delete.file", tmpDir)); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageException.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageException.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/StorageException.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,24 +27,36 @@ import fr.ifremer.isisfish.IsisFishException; +/** + * Storage exception. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ public class StorageException extends IsisFishException { /** serialVersionUID. */ private static final long serialVersionUID = -8193638893951824873L; - public StorageException() { - super(); - } - + /** + * Constructor with message. + * + * @param message message + */ public StorageException(String message) { super(message); } + /** + * Constructor with message and cause. + * + * @param message message + * @param cause cause + */ public StorageException(String message, Throwable cause) { super(message, cause); } - - public StorageException(Throwable cause) { - super(cause); - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/VersionStorage.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/VersionStorage.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/VersionStorage.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -44,7 +44,7 @@ import fr.ifremer.isisfish.vcs.VCSException; /** - * Classe permettant de géré l'interaction avec le VSC. + * Classe permettant de géré l'interaction avec le VCS. * * @author poussin * @version $Revision$ @@ -82,14 +82,21 @@ * * In simulation context, must look for files in simulation directory * instead of isis database. - * - * TODO better place in other storage, but needed for region anad java scrits */ protected static File getContextDatabaseDirectory() { return IsisFish.config.getContextDatabaseDirectory(); } /** + * Return community database directory. + * + * @return community database directory + */ + protected static File getCommunityDatabaseDirectory() { + return IsisFish.config.getCommunityDatabaseDirectory(); + } + + /** * Get cache storage key to use depending on context storage used. * * Two simulation must have their own cache. @@ -111,6 +118,15 @@ protected static VCS getVCS() { return IsisFish.vcs; } + + /** + * Get community {@link VCS}. + * + * @return community VCS + */ + protected static VCS getCommunityVCS() { + return IsisFish.communityVcs; + } /** * Permet de demander la preparation des fichiers pour etre envoyé vers le VCS. @@ -344,6 +360,9 @@ if (getVCS().isVersionnableFile(f)) { result.add(f.getName()); } + else if (getCommunityVCS().isVersionnableFile(f)) { + result.add(f.getName()); + } } } Collections.sort(result); Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,117 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore.migration; + +import static org.nuiton.i18n.I18n._; + +import java.util.List; + +import javax.swing.JOptionPane; + +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.util.Version; + +import fr.ifremer.isisfish.IsisFishDAOHelper; + +/** + * Migration callback by class for all isis database migration. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass { + + protected static final Version VERSION_32 = new Version("3.2"); + protected static final Version VERSION_33 = new Version("3.3"); + protected static final Version VERSION_34 = new Version("3.4"); + + public DatabaseMigrationClass() { + super(new MigrationResolver()); + } + + protected static class MigrationResolver implements MigrationCallBackForVersionResolver { + /* + * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersionResolver#getCallBack(org.nuiton.util.Version) + */ + @Override + public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) { + Class<? extends MigrationCallBackForVersion> result = null; + + if (version.equals(VERSION_32)) { + result = MigrationV0V32.class; + } + else if (version.equals(VERSION_33)) { + result = MigrationV32V33.class; + } + else if (version.equals(VERSION_34)) { + result = MigrationV33V34.class; + } + return result; + } + + } + + /* + * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#getAvailableVersions() + */ + @Override + public Version[] getAvailableVersions() { + Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_34 }; + return result; + } + + /* + * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#getApplicationVersion() + */ + @Override + public Version getApplicationVersion() { + Version appVersion = new Version(IsisFishDAOHelper.getModelVersion()); + return appVersion; + } + + /* + * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#askUser(org.nuiton.util.Version, java.util.List) + */ + @Override + public boolean askUser(Version dbVersion, List<Version> versions) { + boolean result = false; + + int answer = JOptionPane.showConfirmDialog( + null, _("isisfish.misc.databasemigration.question", dbVersion, versions.get(versions.size() - 1)), + _("isisfish.misc.databasemigration.title"), + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + + if (answer == JOptionPane.YES_OPTION) { + result = true; + } + + return result; + } + +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,70 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore.migration; + +import java.util.List; + +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion; +import org.nuiton.util.Version; + +/** + * Migration between version 0 and 3.2. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MigrationV0V32 extends MigrationCallBackForVersion { + + /** + * Constructor. + * + * @param version version + * @param callBack callback + */ + public MigrationV0V32(Version version, TopiaMigrationCallbackByClass callBack) { + super(version, callBack); + } + + /* + * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean) + */ + @Override + protected void prepareMigrationScript(TopiaContextImplementor tx, + List<String> queries, boolean showSql, boolean showProgression) + throws TopiaException { + queries.add("alter table SETOFVESSELS add column TECHNICALEFFICIENCYEQUATION VARCHAR(255);"); + queries.add("alter table STRATEGY add column INACTIVITYEQUATIONUSED BIT default false;"); + queries.add("alter table STRATEGY add column INACTIVITYEQUATION VARCHAR(255);"); + queries.add("alter table STRATEGYMONTHINFO alter NUMBEROFTRIPS double;"); + queries.add("alter table STRATEGYMONTHINFO alter MININACTIVITYDAYS double;"); + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,80 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore.migration; + +import java.util.List; + +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion; +import org.nuiton.util.Version; + +/** + * Migration between version 3.2 and 3.3. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MigrationV32V33 extends MigrationCallBackForVersion { + + /** + * Constructor. + * + * @param version version + * @param callback callback + */ + public MigrationV32V33(Version version, TopiaMigrationCallbackByClass callback) { + super(version, callback); + } + + /* + * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean) + */ + @Override + protected void prepareMigrationScript(TopiaContextImplementor tx, + List<String> queries, boolean showSql, boolean showProgression) + throws TopiaException { + // replace in equation + queries.add("update EQUATION set content = replace(content, 'org.codelutin.', 'org.nuiton.');"); + // replace in matrix semantics + queries.add("update POPULATION set recruitmentDistribution_semantics = replace(recruitmentDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where recruitmentDistribution_semantics IS NOT null;"); + queries.add("update POPULATION set mappingZoneReproZoneRecru_semantics = replace(mappingZoneReproZoneRecru_semantics, 'org.codelutin.', 'org.nuiton.') where mappingZoneReproZoneRecru_semantics IS NOT null;"); + queries.add("update POPULATION set capturability_semantics = replace(capturability_semantics, 'org.codelutin.', 'org.nuiton.') where capturability_semantics IS NOT null;"); + queries.add("update POPULATIONSEASONINFO set reproductionDistribution_semantics = replace(reproductionDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where reproductionDistribution_semantics IS NOT null;"); + queries.add("update POPULATIONSEASONINFO set lengthChangeMatrix_semantics = replace(lengthChangeMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where lengthChangeMatrix_semantics IS NOT null;"); + queries.add("update POPULATIONSEASONINFO set migrationMatrix_semantics = replace(migrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where migrationMatrix_semantics IS NOT null;"); + queries.add("update POPULATIONSEASONINFO set emigrationMatrix_semantics = replace(emigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where emigrationMatrix_semantics IS NOT null;"); + queries.add("update POPULATIONSEASONINFO set immigrationMatrix_semantics = replace(immigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where immigrationMatrix_semantics IS NOT null;"); + queries.add("update RESULT set matrix_semantics = replace(matrix_semantics, 'org.codelutin.', 'org.nuiton.') where matrix_semantics IS NOT null;"); + queries.add("update STRATEGYMONTHINFO set proportionMetier_semantics = replace(proportionMetier_semantics, 'org.codelutin.', 'org.nuiton.') where proportionMetier_semantics IS NOT null;"); + // add .shp default extension + queries.add("update FISHERYREGION set MAPFILES = regexp_replace(MAPFILES, '(,|$)', '.shp$1') where MAPFILES IS NOT null AND LENGTH(TRIM(MAPFILES)) > 0;"); + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V34.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V34.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V34.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V34.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,70 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore.migration; + +import java.util.List; + +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion; +import org.nuiton.util.Version; + +/** + * Migration between version 3.3 and 3.4. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MigrationV33V34 extends MigrationCallBackForVersion { + + /** + * Constructor. + * + * @param version version + * @param callback callback + */ + public MigrationV33V34(Version version, TopiaMigrationCallbackByClass callback) { + super(version, callback); + } + + /* + * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean) + */ + @Override + protected void prepareMigrationScript(TopiaContextImplementor tx, + List<String> queries, boolean showSql, boolean showProgression) + throws TopiaException { + // remove maturity group + // CONSTRAINT_0 est la nom généré de la constainte d'unicité + // sur les maturityGroup + // en v3.3, il n'y a qu'une contrainte sur la table population + queries.add("ALTER TABLE POPULATION DROP CONSTRAINT IF EXISTS CONSTRAINT_0;"); + } +} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,179 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2007 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.datastore.migration; - -import static org.nuiton.i18n.I18n._; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import javax.swing.JOptionPane; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.migration.DatabaseManager; -import org.nuiton.topia.migration.callback.MigrationCallbackHandler; -import org.nuiton.util.VersionNumberUtil; - -/** - * MigrationCallbackHandler. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class SwingMigrationCallbackHandler implements MigrationCallbackHandler { - - /** to use log facility, just put in your code: log.info("..."); */ - static private Log log = LogFactory - .getLog(SwingMigrationCallbackHandler.class); - - /* - * @see org.nuiton.topia.migration.callback.MigrationCallbackHandler#doMigration(java.lang.String, java.lang.String) - */ - @Override - public MigrationChoice doMigration(DatabaseManager dbManager, - String dbVersion, String applicationVersion) { - - int answer = JOptionPane.showConfirmDialog( - null, _("isisfish.misc.databasemigration.question", dbVersion, applicationVersion), - _("isisfish.misc.databasemigration.title"), - JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - - MigrationChoice result = (answer == JOptionPane.YES_OPTION) ? MigrationChoice.MIGRATION - : MigrationChoice.NO_MIGRATION; - - if (result == MigrationChoice.MIGRATION) { - result = migrate(dbManager, dbVersion, applicationVersion); - } - return result; - } - - /** - * Perform real migration. - * - * @param dbManager database manager - * @param dbVersion database version - * @param applicationVersion application version - * @return {@code MigrationChoice.CUSTOM_MIGRATION} if success, {@code MigrationChoice.NO_MIGRATION} otherwise. - */ - protected MigrationChoice migrate(DatabaseManager dbManager, - String dbVersion, String applicationVersion) { - // migration manuel sans l'aide de topia-service - // tant que c pas fait on dit non - MigrationChoice result = MigrationChoice.NO_MIGRATION; - // ouverture d'une connexion direct JDBC sur la base - try { - Connection conn = dbManager.getConnection(); - try { - conn.setAutoCommit(false); - if (VersionNumberUtil.smallerThan(dbVersion, "3.2")) { - // on fait une migration vers 3.2 - migrateTo3_2(conn); - } - - // do same thing for other version - if (VersionNumberUtil.smallerThan(dbVersion, "3.3")) { - // on fait une migration vers 3.2 - migrateTo3_3(conn); - } - - // commit des modifs - conn.commit(); - // la migration a reussi, on dit que c fait - result = MigrationChoice.CUSTOM_MIGRATION; - } catch (Exception eee) { - // en cas d'erreur - log.error("Migration impossible de la base", eee); - // rollback du travail en cours - conn.rollback(); - } finally { - // close database connexion - conn.close(); - } - } catch (Exception eee) { - log.error("Error lors de la tentative de migration", eee); - } - - return result; - } - - protected void migrateTo3_2(Connection conn) throws SQLException { - if (log.isInfoEnabled()) { - log.info("Migrate to version 3.2"); - } - - //alteration du schema - // nouvelles equations dans les tables - - String[] sqls = new String[] { - "alter table SETOFVESSELS add column TECHNICALEFFICIENCYEQUATION VARCHAR(255);", - "alter table STRATEGY add column INACTIVITYEQUATIONUSED BIT default false;", - "alter table STRATEGY add column INACTIVITYEQUATION VARCHAR(255);", - "alter table STRATEGYMONTHINFO alter NUMBEROFTRIPS double;", - "alter table STRATEGYMONTHINFO alter MININACTIVITYDAYS double;" }; - for (String sql : sqls) { - log.info("try " + sql); - PreparedStatement sta = conn.prepareStatement(sql); - sta.executeUpdate(); - log.info("done " + sql); - } - } - - protected void migrateTo3_3(Connection conn) throws SQLException { - if (log.isInfoEnabled()) { - log.info("Migrate to version 3.3"); - } - - String[] sqls = new String[] { - // replace in equation - "update EQUATION set content = replace(content, 'org.codelutin.', 'org.nuiton.');", - // replace in matrix semantics - "update POPULATION set recruitmentDistribution_semantics = replace(recruitmentDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where recruitmentDistribution_semantics IS NOT null;", - "update POPULATION set mappingZoneReproZoneRecru_semantics = replace(mappingZoneReproZoneRecru_semantics, 'org.codelutin.', 'org.nuiton.') where mappingZoneReproZoneRecru_semantics IS NOT null;", - "update POPULATION set capturability_semantics = replace(capturability_semantics, 'org.codelutin.', 'org.nuiton.') where capturability_semantics IS NOT null;", - "update POPULATIONSEASONINFO set reproductionDistribution_semantics = replace(reproductionDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where reproductionDistribution_semantics IS NOT null;", - "update POPULATIONSEASONINFO set lengthChangeMatrix_semantics = replace(lengthChangeMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where lengthChangeMatrix_semantics IS NOT null;", - "update POPULATIONSEASONINFO set migrationMatrix_semantics = replace(migrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where migrationMatrix_semantics IS NOT null;", - "update POPULATIONSEASONINFO set emigrationMatrix_semantics = replace(emigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where emigrationMatrix_semantics IS NOT null;", - "update POPULATIONSEASONINFO set immigrationMatrix_semantics = replace(immigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where immigrationMatrix_semantics IS NOT null;", - "update RESULT set matrix_semantics = replace(matrix_semantics, 'org.codelutin.', 'org.nuiton.') where matrix_semantics IS NOT null;", - "update STRATEGYMONTHINFO set proportionMetier_semantics = replace(proportionMetier_semantics, 'org.codelutin.', 'org.nuiton.') where proportionMetier_semantics IS NOT null;", - // add .shp default extension - "update FISHERYREGION set MAPFILES = regexp_replace(MAPFILES, '(,|$)', '.shp$1') where MAPFILES IS NOT null AND LENGTH(TRIM(MAPFILES)) > 0;" - }; - for (String sql : sqls) { - log.info("try " + sql); - PreparedStatement sta = conn.prepareStatement(sql); - sta.executeUpdate(); - log.info("done " + sql); - } - } - -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 1999 - 2010 Ifremer, CodeLutin + * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -23,7 +23,7 @@ * #L% */ /** - * IsisFish V2 import. + * Database storage migration. */ package fr.ifremer.isisfish.datastore.migration; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -53,6 +53,10 @@ import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; import org.nuiton.math.matrix.MatrixFactory; import org.nuiton.math.matrix.MatrixHelper; import org.nuiton.math.matrix.MatrixND; @@ -61,11 +65,7 @@ import org.nuiton.util.ArrayUtil; import org.nuiton.util.FileUtil; import org.nuiton.util.Resource; -import org.nuiton.util.VersionNumberUtil; -import org.dom4j.Document; -import org.dom4j.Element; -import org.dom4j.Node; -import org.dom4j.io.SAXReader; +import org.nuiton.util.VersionUtil; import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishDAOHelper; @@ -191,9 +191,9 @@ * @throws Exception */ private File convertXML(File file, String versionStart, String versionEnd) throws Exception { - if(VersionNumberUtil.greaterThan(versionStart, versionEnd)){ + if(VersionUtil.greaterThan(versionStart, versionEnd)){ throw new Exception(_("isisfish.error.import.recent.files")); - }else if(VersionNumberUtil.smallerThan(versionStart, versionEnd)){ + }else if(VersionUtil.smallerThan(versionStart, versionEnd)){ // upgrate du fichier try{ // recherche des fichiers XSL de conversion @@ -228,7 +228,7 @@ URL xsl = (URL)xslurl.get(0); result.add(xsl); String end = getVersionEnd(xsl); - if(VersionNumberUtil.equals(versionEnd, end)){ + if(VersionUtil.equals(versionEnd, end)){ return result.toArray(new URL[result.size()]); } xslurl = Resource.getURLs(".*?" + XSL_DIRECTORY + "/isis-fish-"+end+"_.*.xsl$"); @@ -359,7 +359,7 @@ // frame.getEquationEditorPane().setEquation(eq); frame.setEquation(eq.getCategory(), eq.getName(), eq.getJavaInterface(), eq.getContent()); frame.setVisible(true); - if (frame.isOk()) { + if (frame.isResultOk()) { eq.setContent(frame.getEditor().getText()); } context.commitTransaction(); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 1999 - 2010 Ifremer, CodeLutin + * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -23,7 +23,7 @@ * #L% */ /** - * Database storage migration. + * IsisFish V2 import. */ package fr.ifremer.isisfish.datastore.update; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/CellImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -51,7 +51,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/EquationImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -77,8 +77,7 @@ double result = ((Number) val).doubleValue(); return result; } else { - throw new IsisFishRuntimeException(_( - "isisfish.error.equation.return.number", eq)); + throw new IsisFishRuntimeException(_("isisfish.error.equation.return.number", eq)); } } else if (Language.JAVA.equals(getLanguage()) || getJavaInterface() != null) { @@ -90,18 +89,15 @@ double result = ((Number) val).doubleValue(); return result; } else { - throw new IsisFishRuntimeException(_( - "isisfish.error.equation.return.number", eq)); + throw new IsisFishRuntimeException(_("isisfish.error.equation.return.number", eq)); } } else { // TODO other language support - throw new IsisFishRuntimeException(_( - "isisfish.error.unsupported.equation.langage", + throw new IsisFishRuntimeException(_("isisfish.error.unsupported.equation.langage", getLanguage(), eq)); } } catch (Exception eee) { - throw new IsisFishRuntimeException(_( - "isisfish.error.evaluate.equation", eq), eee); + throw new IsisFishRuntimeException(_("isisfish.error.evaluate.equation", eq), eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/FisheryRegionImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -106,7 +106,7 @@ List<Port> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get port", eee); } } @@ -119,7 +119,7 @@ List<Cell> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get cell", eee); } } @@ -133,7 +133,7 @@ List<VesselType> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get vessel type", eee); } } @@ -146,7 +146,7 @@ List<Gear> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get gear", eee); } } @@ -159,7 +159,7 @@ List<Metier> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get metier", eee); } } @@ -173,7 +173,7 @@ List<SetOfVessels> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get setOfVessels", eee); } } @@ -186,7 +186,7 @@ List<Species> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get species", eee); } } @@ -200,7 +200,7 @@ List<Strategy> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get strategy", eee); } } @@ -214,7 +214,7 @@ List<TripType> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get tripType", eee); } } @@ -227,7 +227,7 @@ List<Zone> result = dao.findAll(); return result; } catch (TopiaException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get zone", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/GearImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -52,7 +52,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/MetierImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -55,7 +55,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PopulationSeasonInfoImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -80,7 +80,7 @@ List oldMonths = null; if (result != null) { - oldMonths = result.getSemantics(0); + oldMonths = result.getSemantic(0); } List<Month> months = getMonths(); @@ -829,7 +829,7 @@ // l'equation doit mettre les resultats dans la matrice result e.evaluate("N", N, "pop", pop, "month", month, "prepro", coeff .getValue(month), "zoneRepro", zoneRepro, "groups", N - .getSemantics(0), "zones", N.getSemantics(1), "result", + .getSemantic(0), "zones", N.getSemantic(1), "result", result); } } catch (Exception eee) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/PortImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -51,7 +51,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SetOfVesselsImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -64,7 +64,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/SpeciesImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -51,7 +51,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -67,7 +67,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } @@ -92,7 +92,7 @@ public List<StrategyMonthInfo> getStrategyMonthInfo() { try { List<StrategyMonthInfo> result = super.getStrategyMonthInfo(); - if (result == null) { // Faire le test suivant pose de gros probleme, car il essai de faire un getStrategyMonthInfo et donc ca boucle || result.size() != Month.NUMBER_OF_MONTH) { + if (result == null || result.size() != Month.NUMBER_OF_MONTH) { if (result != null) { log.warn(_("isisfish.error.strategy.order", getName(), result.size())); @@ -130,8 +130,7 @@ if (!month.equals(result.getMonth())) { // normalement les StrategyMonthInfo sont dans l'ordre mais // pour etre sur que ca fonctionne on fait un petit test - log - .warn("StrategyMonthInfo not in month order, i take time to find good StrategyMonthInfo"); + log.warn("StrategyMonthInfo not in month order, i take time to find good StrategyMonthInfo"); result = null; for (StrategyMonthInfo smi : smis) { if (month.equals(smi.getMonth())) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/StrategyMonthInfoImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -65,7 +65,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } @@ -75,7 +75,7 @@ // se le metier n'y ait pas on renvera 0; MatrixND mat = super.getProportionMetier(); if (mat != null) { - int indice = mat.getSemantics(0).indexOf(metier); + int indice = mat.getSemantic(0).indexOf(metier); if (indice >= 0) { result = mat.getValue(indice); } @@ -90,8 +90,7 @@ mat.setValue(metier, value); setProportionMetier(mat); } else { - log - .warn("Can't set proportion of metier, not enough information available"); + log.warn("Can't set proportion of metier, not enough information available"); } } @@ -121,7 +120,7 @@ _("isisfish.strategyMonthInfo.proportion"), new List[] { metiers }, new String[] { _("isisfish.strategyMonthInfo.metier") }); - } else if (!result.getSemantics(0).equals(metiers)) { + } else if (!result.getSemantic(0).equals(metiers)) { MatrixND tmp = MatrixFactory.getInstance().create( _("isisfish.strategyMonthInfo.proportion"), new List[] { metiers }, Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/TripTypeImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,8 +25,6 @@ package fr.ifremer.isisfish.entities; -import org.nuiton.topia.TopiaException; - import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.RegionStorage; import fr.ifremer.isisfish.datastore.StorageException; @@ -48,11 +46,7 @@ /** serialVersionUID. */ private static final long serialVersionUID = 1L; - /* (non-Javadoc) - * @see org.nuiton.topia.persistence.TopiaEntityAbstract#postCreate() - */ - @Override - public void postCreate() throws TopiaException { + public TripTypeImpl() { setMinTimeBetweenTrip(new TimeUnit(0)); setTripDuration(new TimeUnit(0)); } @@ -63,7 +57,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/VesselTypeImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,8 +25,6 @@ package fr.ifremer.isisfish.entities; -import org.nuiton.topia.TopiaException; - import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.RegionStorage; import fr.ifremer.isisfish.datastore.StorageException; @@ -48,11 +46,7 @@ /** serialVersionUID. */ private static final long serialVersionUID = 1L; - /* (non-Javadoc) - * @see org.nuiton.topia.persistence.TopiaEntityAbstract#postCreate() - */ - @Override - public void postCreate() throws TopiaException { + public VesselTypeImpl() { setMaxTripDuration(new TimeUnit(0)); } @@ -62,7 +56,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/entities/ZoneImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -51,7 +51,7 @@ .getFisheryRegion(getTopiaContext()); return result; } catch (StorageException eee) { - throw new IsisFishRuntimeException(eee); + throw new IsisFishRuntimeException("Can't get fishery region", eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/export/ExportHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -145,15 +145,18 @@ String valueString = "not initialized"; try { valueString = props.getProperty(paramTag + propName); - + // ATTENTION il semblerait que notre intance de beanUtils // soit ecrasé par celle du MatrixType ... // a ne pas deplacer avant la boucle ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); - + Object value = beanUtils.convert(valueString, type); - log.info("DEBUG: set sensitivityexport param: " + paramTag + propName - + " = " + value + "(" + valueString + ")"); + if (log.isDebugEnabled()) { + log.debug("Set sensitivityexport param: " + paramTag + + propName + " = " + value + "(" + valueString + ")"); + } + SensitivityExportStorage.setParameterValue(export, propName, value); } catch (Exception eee) { if (log.isWarnEnabled()) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -140,9 +140,9 @@ if (log.isDebugEnabled()) { log.debug(_("isisfish.log.addAppender", appenderId)); } - } catch (IOException e) { - log.error(_("isisfish.error.log.createAppender", appenderId, e.getMessage())); - throw new IsisFishException(e); + } catch (IOException ex) { + log.error(_("isisfish.error.log.createAppender", appenderId, ex.getMessage())); + throw new IsisFishException("Can't add appender", ex); } } @@ -170,32 +170,26 @@ * Open a new log console for the given simulation * * @param simulationName name of the simulation to use - * @throws Exception todo + * @throws IOException + * @throws IllegalArgumentException */ - public static void showSimulationLogConsole(String simulationName) throws Exception { - if (simulationName != null) { + public static void showSimulationLogConsole(String simulationName) throws IllegalArgumentException, IOException { + SimulationStorage storage; - try { - SimulationStorage storage; + storage = SimulationStorage.getSimulation(simulationName); - storage = SimulationStorage.getSimulation(simulationName); + File logFile = new File(storage.getSimulationLogFile()); - File logFile = new File(storage.getSimulationLogFile()); + String smtpServer = IsisFish.config.getSmtpServer(); + String defaultFrom = IsisFish.config.getUserMail(); - String smtpServer = IsisFish.config.getSmtpServer(); - String defaultFrom = IsisFish.config.getUserMail(); + String defaultTo = IsisConfig.REPORT_EMAIL; + String title = _("isisfish.simulation.log.console.title", simulationName); - String defaultTo = IsisConfig.REPORT_EMAIL; - String title = _("isisfish.simulation.log.console.title", simulationName); + LogConsole.newConsole(logFile, smtpServer, defaultFrom, defaultTo, title); - LogConsole.newConsole(logFile, smtpServer, defaultFrom, defaultTo, title); - - log.info(_("isisfish.simulation.log.showConsole", simulationName)); - - } catch (Exception eee) { - log.warn(_("isisfish.error.simulation.log.openAppender", simulationName, eee.getMessage()), eee); - throw eee; - } + if (log.isInfoEnabled()) { + log.info(_("isisfish.simulation.log.showConsole", simulationName)); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -643,6 +643,10 @@ */ public void setSelectionMode(int v) { this.selectionMode = v; + + if (activeSelectionLayer != null) { + activeSelectionLayer.setSelectionMode(v); + } } public void addSelectionLayer() { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric + * 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 @@ -25,25 +25,27 @@ package fr.ifremer.isisfish.mexico; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.stream.StreamResult; import org.apache.commons.beanutils.ConvertUtilsBean; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; @@ -54,11 +56,14 @@ import org.nuiton.topia.TopiaContext; import org.nuiton.topia.persistence.TopiaEntity; import org.xml.sax.InputSource; -import org.xml.sax.SAXException; +import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.mexico.xml.DesignPlanXMLVisitor; import fr.ifremer.isisfish.mexico.xml.DomXMLParser; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.rule.RuleHelper; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; import fr.ifremer.isisfish.util.ConverterUtil; @@ -97,24 +102,6 @@ } - /* - * Get xml representation of a scenario. - * - * @param scenarios sensitivity scenarios - * @return xml sensitivity scenarios representation - * - * TODO : non finished and untested - * - public static String getSensitivityScenarionsAsXML( - SensitivityScenarios scenarios) { - - SensitivityScenariosXMLVisitor visitor = new SensitivityScenariosXMLVisitor(); - scenarios.accept(visitor); - String sensitivityScenariosXml = visitor.getXML(); - return sensitivityScenariosXml; - - }*/ - /** * Parse xmlFile with sax, and return a {@link DesignPlan}. * @@ -140,29 +127,6 @@ } return designPlan; } - - /* - * Parse xmlFile with sax, and return a {@link SensitivityScenarios}. - * - * @param xmlFile file path to parse - * @return SensitivityScenarios - * @throws IOException - * - * TODO : non finished and untested - * - public static SensitivityScenarios getSensitivityScenariosFromXML( - String xmlFile) throws IOException { - SensitivityScenarios scenarios = null; - try { - SAXReader reader = new SAXReader(); - Document doc = reader.read(xmlFile); - Element root = doc.getRootElement(); - scenarios = DomXMLParser.parseSensitivityScenarios(root); - } catch (DocumentException e) { - throw new IOException(e); - } - return scenarios; - }*/ /** * Format xml string. @@ -170,37 +134,22 @@ * @param unformattedXml non formatted xml string (must be valid xml) * @return xml, formatted and indented * + * Code from http://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java + * * @throws IsisFishRuntimeException * @throws IllegalArgumentException if input xml is not valid - * - * @deprecated use standard java xml api instead of xerces */ - @Deprecated public static String formatXML(String unformattedXml) { - try { - // parseXmlFile - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - InputSource is = new InputSource(new StringReader(unformattedXml)); - org.w3c.dom.Document document = db.parse(is); - - // format - OutputFormat format = new OutputFormat(document); - format.setLineWidth(65); - format.setIndenting(true); - format.setIndent(2); - Writer out = new StringWriter(); - XMLSerializer serializer = new XMLSerializer(out, format); - serializer.serialize(document); - - return out.toString(); - } catch (IOException e) { - throw new IsisFishRuntimeException(e); - } catch (ParserConfigurationException e) { - throw new IllegalArgumentException(e); - } catch (SAXException e) { - throw new IllegalArgumentException(e); + Transformer serializer= SAXTransformerFactory.newInstance().newTransformer(); + serializer.setOutputProperty(OutputKeys.INDENT, "yes"); + serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + Source xmlSource=new SAXSource(new InputSource(new ByteArrayInputStream(unformattedXml.getBytes()))); + StreamResult res = new StreamResult(new ByteArrayOutputStream()); + serializer.transform(xmlSource, res); + return new String(((ByteArrayOutputStream)res.getOutputStream()).toByteArray()); + } catch (Exception e) { + throw new IsisFishRuntimeException("Can't format xml", e); } } @@ -248,17 +197,6 @@ List<?> semantics = matrix.getSemantic(dimIndex); buffer.append("<dimension name=\"" + matrix.getDimensionName(dimIndex) + "\" size=\"" + semantics.size() + "\">"); for (Object semantic : semantics) { - /*if (semantic == null) { - buffer.append("<label/>"); - } - else if (semantic instanceof TopiaEntity) { - TopiaEntity semanticTE = (TopiaEntity)semantic; - buffer.append("<label>" + semanticTE.getTopiaId() + "</label>"); - } - else { - buffer.append("<label>" + semantic.toString() + "</label>"); - }*/ - buffer.append("<label>"); appendString(buffer, semantic); buffer.append("</label>"); @@ -420,4 +358,98 @@ } return qualifiedName; } + + /** + * Transform rules list as xml. + * + * Format is : + * <pre> + * <rules> + * <rule name="RuleName1"> + * <param key="rule.0.parameter.param1">param1</param> + * <param key="rule.0.parameter.pop">topiaId1</param> + * </rule> + * <rule name="RuleName2"> + * <param key="rule.0.parameter.param1">param2</param> + * <param key="rule.0.parameter.pop">topiaId2</param> + * </rule> + * </rules> + * </pre> + * + * @param rules rules list + * @return rules as xml + */ + public static String getRulesAsXml(List<Rule> rules) { + StringBuffer ruleAsString = new StringBuffer(); + ruleAsString.append("<rules>"); + for (Rule rule : rules) { + Properties props = RuleHelper.getRuleAsProperties(0, null, rule); + + // rule name and rule parameters + ruleAsString.append("<rule name=\""); + ruleAsString.append(rule.getClass().getSimpleName()); + ruleAsString.append("\">"); + for (String propName : props.stringPropertyNames()) { + ruleAsString.append("<param key=\""); + ruleAsString.append(propName); + ruleAsString.append("\">"); + ruleAsString.append(StringEscapeUtils.escapeXml(props.getProperty(propName))); + ruleAsString.append("</param>"); + } + ruleAsString.append("</rule>"); + } + ruleAsString.append("</rules>"); + return ruleAsString.toString(); + } + + /** + * Parse xml as rules list. + * + * Format is : + * <pre> + * <rules> + * <rule name="RuleName1"> + * <param key="rule.0.parameter.param1">param1</param> + * <param key="rule.0.parameter.pop">topiaId1</param> + * </rule> + * <rule name="RuleName2"> + * <param key="rule.0.parameter.param1">param2</param> + * <param key="rule.0.parameter.pop">topiaId2</param> + * </rule> + * </rules> + * </pre> + * + * @param rulesElement rules dom element + * @param topiaContext topia context (for rules parameters) + * @return rules as xml + */ + public static List<Rule> getRulesFromXml(Element rulesElement, TopiaContext topiaContext) { + List<Rule> rules = new ArrayList<Rule>(); + List<Element> ruleElements = rulesElement.elements("rule"); + for (Element ruleElement : ruleElements) { + String name = ruleElement.attributeValue("name"); + try { + Rule rule = RuleStorage.getRule(name).getNewRuleInstance(); + + // get properties + Properties props = new Properties(); + List<Element> paramElements = ruleElement.elements("param"); + for (Element paramElement : paramElements) { + String key = paramElement.attributeValue("key"); + String value = paramElement.getTextTrim(); + props.setProperty(key, value); + } + RuleHelper.populateRule(0, topiaContext, rule, props); + + rules.add(rule); + } + catch (IsisFishException ex) { + if (log.isWarnEnabled()) { + log.warn("Can't make instance of rule " + name, ex); + } + } + } + + return rules; + } } Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/HorizontalEntityVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/HorizontalEntityVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/HorizontalEntityVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,170 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 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 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.mexico.export; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.persistence.EntityVisitor; -import org.nuiton.topia.persistence.TopiaEntity; - -import fr.ifremer.isisfish.entities.Equation; - -/** - * Parcourt en largeur du model et délegation à un autre visiteur. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - * - * @deprecated use those from topia - */ - at Deprecated -public class HorizontalEntityVisitor implements EntityVisitor { - - /** Class logger. */ - private static Log log = LogFactory.getLog(HorizontalEntityVisitor.class); - - /** Delegate visitor. */ - protected EntityVisitor delegateVisitor; - - /** Cache used to remember entity during exploration. */ - protected List<TopiaEntity> alreadyExplored; - - /** Entity to be visited later. */ - protected List<TopiaEntity> toVisitEntities; - - /** - * Constructor. - * - * @param delegateVisitor delegate visitor - */ - public HorizontalEntityVisitor(EntityVisitor delegateVisitor) { - this.delegateVisitor = delegateVisitor; - this.alreadyExplored = new ArrayList<TopiaEntity>(); - this.toVisitEntities = new ArrayList<TopiaEntity>(); - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#start(org.nuiton.topia.persistence.TopiaEntity) - */ - @Override - public void start(TopiaEntity entity) { - delegateVisitor.start(entity); - if (!alreadyExplored.contains(entity)) { - alreadyExplored.add(entity); - } - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#visit(org.nuiton.topia.persistence.TopiaEntity, java.lang.String, java.lang.Class, java.lang.Object) - */ - @Override - public void visit(TopiaEntity e, String name, Class<?> type, Object value) { - // si c'est une entité - - // FIXME only hack about Equation is used instead of Topia visitor - if (value instanceof TopiaEntity && !(value instanceof Equation)) { - TopiaEntity entity = (TopiaEntity) value; - toVisitEntities.add(entity); - } else { - delegateVisitor.visit(e, name, type, value); - } - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#visit(org.nuiton.topia.persistence.TopiaEntity, java.lang.String, java.lang.Class, java.lang.Class, java.lang.Object) - */ - @Override - public void visit(TopiaEntity e, String name, Class<?> collectionType, - Class<?> type, Object value) { - - Collection<?> values = (Collection<?>) value; - if (values != null && !values.isEmpty()) { - int i = 0; - for (Object currentValue : values) { - visit(e, name, type, collectionType, i++, currentValue); - } - } - - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#visit(org.nuiton.topia.persistence.TopiaEntity, java.lang.String, java.lang.Class, java.lang.Class, int, java.lang.Object) - */ - @Override - public void visit(TopiaEntity e, String name, Class<?> collectionType, - Class<?> type, int index, Object value) { - // si c'est une entité - if (value instanceof TopiaEntity) { - TopiaEntity entity = (TopiaEntity) value; - - toVisitEntities.add(entity); - } else { - delegateVisitor.visit(e, name, collectionType, type, index, value); - } - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#end(org.nuiton.topia.persistence.TopiaEntity) - */ - @Override - public void end(TopiaEntity entity) { - delegateVisitor.end(entity); - - // here, must revisit all remembered entities - List<TopiaEntity> currentEntities = new ArrayList<TopiaEntity>(toVisitEntities); - // TODO verify if clearing here is enought - toVisitEntities.clear(); - for (TopiaEntity currentEntity : currentEntities) { - try { - if (!alreadyExplored.contains(currentEntity)) { - currentEntity.accept(this); - } - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Error on horizontal exploration", ex); - } - } - } - } - - /* - * @see org.nuiton.topia.persistence.EntityVisitor#clear() - */ - @Override - public void clear() { - alreadyExplored.clear(); - toVisitEntities.clear(); - delegateVisitor.clear(); - } -} // HorizontallyEntityVisitor Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionEntityVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,73 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 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 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.export; + +import org.nuiton.topia.persistence.EntityVisitor; +import org.nuiton.topia.persistence.HorizontalEntityVisitor; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.entities.Equation; + +/** + * Parcourt en largeur du model et délegation à un autre visiteur. + * + * Extend {@link HorizontalEntityVisitor} from topia to add + * a hack about internal entity equation. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RegionEntityVisitor extends HorizontalEntityVisitor { + + /** + * Constructor. + * + * @param delegateVisitor delegate visitor + */ + public RegionEntityVisitor(EntityVisitor delegateVisitor) { + super(delegateVisitor); + } + + /* + * @see org.nuiton.topia.persistence.EntityVisitor#visit(org.nuiton.topia.persistence.TopiaEntity, java.lang.String, java.lang.Class, java.lang.Object) + */ + @Override + public void visit(TopiaEntity e, String name, Class<?> type, Object value) { + // si c'est une entité + + // FIXME only hack about Equation is used instead of Topia visitor + if (value instanceof TopiaEntity && !(value instanceof Equation)) { + TopiaEntity entity = (TopiaEntity) value; + toVisitEntities.add(entity); + } else { + delegateVisitor.visit(e, name, type, value); + } + } + +} // HorizontallyEntityVisitor Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/RegionExplorer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric + * 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 @@ -25,9 +25,8 @@ package fr.ifremer.isisfish.mexico.export; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.HorizontalEntityVisitor; import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.FisheryRegion; @@ -52,9 +51,6 @@ */ public class RegionExplorer { - /** Class logger. */ - private static Log log = LogFactory.getLog(RegionExplorer.class); - /** * Explore region and call export on each entity found. * @@ -65,9 +61,9 @@ public void explore(FisheryRegion region, RegionExport regionExport) throws TopiaException { regionExport.beginExport(); - - HorizontalEntityVisitor visitor = new HorizontalEntityVisitor(regionExport); + RegionEntityVisitor visitor = new RegionEntityVisitor(regionExport); + // explore cells for (Cell cell : region.getCell()) { cell.accept(visitor); Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,29 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 1999 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ +/** + * Set of classes used during region's factor's enabled properties export. + */ +package fr.ifremer.isisfish.mexico.export; + Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/package-info.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/package-info.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,29 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 1999 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ +/** + * Mexico file format package. + */ +package fr.ifremer.isisfish.mexico; + Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/AbstractXMLVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/AbstractXMLVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/AbstractXMLVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/AbstractXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,58 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.xml; + +/** + * Abstract xml visitor containing xml string buffer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class AbstractXMLVisitor { + + /** XML text buffer. */ + protected StringBuffer xmlBuffer; + + /** + * Constructor. + * + * Init xml buffer. + */ + public AbstractXMLVisitor() { + xmlBuffer = new StringBuffer(); + } + + /** + * Get xml buffer content. + * + * @return content as string + */ + public String getXML() { + String xml = xmlBuffer.toString(); + return xml; + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,13 +25,11 @@ package fr.ifremer.isisfish.mexico.xml; -import java.io.Serializable; - import fr.ifremer.isisfish.simulator.sensitivity.Domain; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; /** - * XML domain visitor. + * XML continuous domain visitor. * * @author chatellier * @version $Revision: 1.0 $ @@ -52,15 +50,36 @@ ContinuousDomain cDomain = (ContinuousDomain)domain; xmlBuffer.append(" cardinality=\"" + cDomain.getCardinality() + "\">"); - xmlBuffer.append("<range min=\"" + cDomain.getMinBound() + "\" max=\"" + cDomain.getMaxBound() + "\" />"); + appendDomain(cDomain); } /** + * Default ContinuousDomain implementation for double. + * Maybe overridden by specific continuous domains. + * + * @param domain domain to print + */ + protected void appendDomain(ContinuousDomain domain) { + // facteur continue pourcentage + if (domain.isPercentageType()) { + xmlBuffer.append("<reference coefficient=\"" + domain.getCoefficient() + "\">"); + xmlBuffer.append(domain.getReferenceValue()); + xmlBuffer.append("</reference>"); + } + else { + // facteur continue min/max + xmlBuffer.append("<range>"); + xmlBuffer.append("<min>" + domain.getMinBound() + "</min>"); + xmlBuffer.append("<max>" + domain.getMaxBound() + "</max>"); + xmlBuffer.append("</range>"); + } + } + + /** * {@inheritDoc} */ @Override - public <E extends Serializable, F extends Serializable> void visit(Domain<E,F> domain, - F label, E value) { + public void visit(Domain domain, Object label, Object value) { } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -26,7 +26,7 @@ package fr.ifremer.isisfish.mexico.xml; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.visitor.DesignPlanVisitor; /** @@ -38,37 +38,19 @@ * Last update : $Date: 5 mars 2009 $ * By : $Author: chatellier $ */ -public class DesignPlanXMLVisitor implements DesignPlanVisitor { +public class DesignPlanXMLVisitor extends AbstractXMLVisitor implements DesignPlanVisitor { - /** XML text buffer. */ - protected StringBuffer xmlBuffer; - /** - * Constructor. + * {@inheritDoc} * - * Init xml buffer. + * Changes : + * v2 : depuis la v2, meilleur gestion des min/max, pourcentage poru quasiment + * tous les facteurs continue + * v0 : version original */ - public DesignPlanXMLVisitor() { - xmlBuffer = new StringBuffer(); - } - - /** - * Get xml buffer content. - * - * @return content as string - */ - public String getXML() { - String xml = xmlBuffer.toString(); - return xml; - } - - /** - * {@inheritDoc} - */ @Override public void start(DesignPlan designPlan) { - xmlBuffer.append("<experimentalDesign>"); - xmlBuffer.append("<factors>"); + xmlBuffer.append("<experimentalDesign version=\"2\">"); } /** @@ -76,9 +58,9 @@ */ @Override public void visit(DesignPlan designPlan, - Factor factor) { - FactorXMLVisitor visitor = new FactorXMLVisitor(); - factor.accept(visitor); + FactorGroup factorGroup) { + FactorGroupXMLVisitor visitor = new FactorGroupXMLVisitor(); + factorGroup.accept(visitor); xmlBuffer.append(visitor.getXML()); } @@ -87,7 +69,6 @@ */ @Override public void end(DesignPlan designPlan) { - xmlBuffer.append("</factors>"); xmlBuffer.append("</experimentalDesign>"); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin, Chatellier Eric + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,13 +25,11 @@ package fr.ifremer.isisfish.mexico.xml; -import java.io.Serializable; - import fr.ifremer.isisfish.simulator.sensitivity.Domain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; /** - * XML domain visitor. + * XML discrete domain visitor. * * @author chatellier * @version $Revision: 1.0 $ @@ -60,8 +58,7 @@ * {@inheritDoc} */ @Override - public <E extends Serializable, F extends Serializable> void visit(Domain<E,F> domain, - F label, E value) { + public void visit(Domain domain, Object label, Object value) { xmlBuffer.append("<value>" + value + "</value>"); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin, CHatellier Eric + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,17 +27,22 @@ import java.util.List; +import org.apache.commons.lang.StringEscapeUtils; import org.dom4j.Element; import org.nuiton.math.matrix.MatrixND; import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.mexico.MexicoHelper; +import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; /** * Parse xml using dom. @@ -52,6 +57,33 @@ */ public class DomXMLParser { + public static final String DISCRETE = "discrete"; + public static final String ENUMERATION = "enumeration"; + public static final String DOMAIN = "domain"; + public static final String FIXED = "fixed"; + public static final String VALUE = "value"; + public static final String RULE = "rule"; + public static final String RULES = "rules"; + public static final String VERSION = "version"; + public static final String NAME = "name"; + public static final String TYPE = "type"; + public static final String PROPERTY = "property"; + public static final String TARGET = "target"; + public static final String CONTINUOUS = "continuous"; + public static final String MATRIXCONTINUOUS = "matrixcontinuous"; + public static final String COEFFICIENT = "coefficient"; + public static final String EQUATIONCONTINUOUS = "equationcontinuous"; + public static final String EQUATION = "equation"; + public static final String VARIABLE = "variable"; + public static final String PERCENTAGE = "percentage"; + public static final String REFERENCE = "reference"; + public static final String RANGE = "range"; + public static final String MIN = "min"; + public static final String MAX = "max"; + public static final String CARDINALITY = "cardinality"; + public static final String INTEGER = "integer"; + public static final String MX = "mx"; + /** * Parse element root node as Design plan. * @@ -63,246 +95,466 @@ DesignPlan plan = new DesignPlan(); - List<Element> factorElements = rootElement - .selectNodes("child::factors/factor"); + // could return "2" or null + String version = rootElement.attributeValue(VERSION); + List<Element> factorGroupElements = rootElement.selectNodes("child::factors"); + FactorGroup factorGroup = null; + if (!factorGroupElements.isEmpty()) { + if ("2".equals(version)) { + factorGroup = parseFactorGroupV2(factorGroupElements.get(0), topiaContext); + } + else { + factorGroup = parseFactorGroup(factorGroupElements.get(0), topiaContext); + } + } + plan.setFactorGroup(factorGroup); + + return plan; + } + + /** + * Recursive parse of factor group elements (>factors<). + * + * @param fgElement factor group element (>factors<) + * @param topiaContext context + * @return factor group + * + * @deprecated since 3.4.0.0, this parsing method parse experimentalDesign + * in version "0" or "null" version, don't remove for + * data reading purpose, but could be removed in a future version + */ + @Deprecated + protected static FactorGroup parseFactorGroup(Element fgElement, TopiaContext topiaContext) { + + String factorGroupName = fgElement.attributeValue(NAME); + FactorGroup factorGroup = new FactorGroup(factorGroupName); + + // sub factor group + List<Element> factorGroupElements = fgElement.selectNodes("child::factors"); + for (Element factorGroupElement : factorGroupElements) { + FactorGroup subFactorGroup = parseFactorGroup(factorGroupElement, topiaContext); + factorGroup.addFactor(subFactorGroup); + } + + // normal factors + List<Element> factorElements = fgElement.selectNodes("child::factor"); + for (Element factorElement : factorElements) { - String type = factorElement.attributeValue("type"); - String name = factorElement.attributeValue("name"); - String property = factorElement.attributeValue("property"); - String path = factorElement.element("target").getText().trim(); + String type = factorElement.attributeValue(TYPE); + String name = factorElement.attributeValue(NAME); + String property = factorElement.attributeValue(PROPERTY); + String path = factorElement.element(TARGET).getText().trim(); // double if ("real".equals(type)) { - Factor<Double,Integer> factor = new Factor<Double,Integer>(name); + Factor factor = new Factor(name); factor.setPath(path); - Element fixedElement = factorElement.element("domain").element( - "fixed"); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); // tous les domaines continues - if (property.endsWith("continuous")) { + if (property.endsWith(CONTINUOUS)) { ContinuousDomain domain; - if(property.equals("matrixcontinuous")) { + if (property.equals(MATRIXCONTINUOUS)) { // matrix specific // <coefficient operator="-" value="0.799"/> - MatrixContinuousDomain mdomain = new MatrixContinuousDomain(); - Element coefficientElement = fixedElement.element("coefficient"); - mdomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - mdomain.setOperator(coefficientElement.attributeValue("operator")); + MatrixContinuousDomain mdomain = new MatrixContinuousDomain(true); + Element coefficientElement = fixedElement.element(COEFFICIENT); + mdomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue(VALUE))); // <mx name="test1" step="0">... - Element matrixElement = fixedElement.element("mx"); + Element matrixElement = fixedElement.element(MX); MatrixND matrix = MexicoHelper.getMatrixFromXml(matrixElement, topiaContext); - mdomain.setMatrix(matrix); + mdomain.setReferenceValue(matrix); domain = mdomain; } - else if (property.equals("equationcontinuous")) { + else if (property.equals(EQUATIONCONTINUOUS)) { // equation specific - EquationContinuousDomain edomain = new EquationContinuousDomain(); - Element coefficientElement = fixedElement.element("coefficient"); - edomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - edomain.setOperator(coefficientElement.attributeValue("operator")); + EquationContinuousDomain edomain = new EquationContinuousDomain(true); + Element coefficientElement = fixedElement.element(COEFFICIENT); + edomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue(VALUE))); - Element equationElement = fixedElement.element("equation"); - edomain.setReferenceValue(Double.valueOf(equationElement.attributeValue("reference"))); - edomain.setVariableName(equationElement.attributeValue("variable")); + Element equationElement = fixedElement.element(EQUATION); + edomain.setReferenceValue(Double.valueOf(equationElement.attributeValue(REFERENCE))); + edomain.setVariableName(equationElement.attributeValue(VARIABLE)); domain = edomain; } else { // continous domain - domain = new ContinuousDomain<Double,Double>(); + domain = new ContinuousDomain(); + + Element percentageElement = fixedElement.element(PERCENTAGE); + if (percentageElement != null) { + domain.setCoefficient(Double.valueOf(percentageElement.attributeValue(COEFFICIENT))); + domain.setReferenceValue(Double.valueOf(percentageElement.attributeValue(REFERENCE))); + domain.setPercentageType(true); + } + else { + // <range max="1.0" min="0.0"/> + Element rangeElement = fixedElement.element(RANGE); + domain.setMinBound(Double.valueOf(rangeElement.attributeValue(MIN))); + domain.setMaxBound(Double.valueOf(rangeElement.attributeValue(MAX))); + } } - - domain.setCardinality(Integer.valueOf(fixedElement.attributeValue("cardinality"))); - - // <range max="1.0" min="0.0"/> - Element rangeElement = fixedElement.element("range"); - domain.setMinBound(Double.valueOf(rangeElement.attributeValue("min"))); - domain.setMaxBound(Double.valueOf(rangeElement.attributeValue("max"))); + domain.setCardinality(Integer.valueOf(fixedElement.attributeValue(CARDINALITY))); + factor.setDomain(domain); - } else if ("discrete".equals(property)) { - DiscreteDomain<Double,Integer> domain = new DiscreteDomain<Double,Integer>(); + } else if (DISCRETE.equals(property)) { + DiscreteDomain domain = new DiscreteDomain(); List<Element> valueElements = fixedElement.element( - "enumeration").elements("value"); + ENUMERATION).elements(VALUE); int label = 0; for (Element valueElement : valueElements) { - domain.getValues().put(Integer.valueOf(label), + domain.getValues().put(label, Double.valueOf(valueElement.getTextTrim())); ++label; } factor.setDomain(domain); } - plan.getFactors().add(factor); - } else if ("integer".equals(type)) { - Factor<Integer,Integer> factor = new Factor<Integer,Integer>(name); + factorGroup.addFactor(factor); + } else if (INTEGER.equals(type)) { + Factor factor = new Factor(name); factor.setPath(path); - Element fixedElement = factorElement.element("domain").element("fixed"); - if ("continuous".equals(property)) { - ContinuousDomain domain = null; + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + if (CONTINUOUS.equals(property)) { + ContinuousDomain domain; - if(property.equals("matrixcontinuous")) { + if(property.equals(MATRIXCONTINUOUS)) { // matrix specific - MatrixContinuousDomain mdomain = new MatrixContinuousDomain(); + MatrixContinuousDomain mdomain = new MatrixContinuousDomain(true); - Element coefficientElement = fixedElement.element("coefficient"); - mdomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - mdomain.setOperator(coefficientElement.attributeValue("operator")); + Element coefficientElement = fixedElement.element(COEFFICIENT); + mdomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue(VALUE))); // matrix specific - Element matrixElement = fixedElement.element("mx"); + Element matrixElement = fixedElement.element(MX); MatrixND matrix = MexicoHelper.getMatrixFromXml(matrixElement, topiaContext); - mdomain.setMatrix(matrix); + mdomain.setReferenceValue(matrix); domain = mdomain; } - else if (property.equals("equationcontinuous")) { + else if (property.equals(EQUATIONCONTINUOUS)) { // equation specific - EquationContinuousDomain edomain = new EquationContinuousDomain(); + EquationContinuousDomain edomain = new EquationContinuousDomain(true); - Element coefficientElement = fixedElement.element("coefficient"); - edomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue("value"))); - edomain.setOperator(coefficientElement.attributeValue("operator")); + Element coefficientElement = fixedElement.element(COEFFICIENT); + edomain.setCoefficient(Double.valueOf(coefficientElement.attributeValue(VALUE))); - Element equationElement = fixedElement.element("equation"); - edomain.setReferenceValue(Double.valueOf(equationElement.attributeValue("reference"))); - edomain.setVariableName(equationElement.attributeValue("variable")); + Element equationElement = fixedElement.element(EQUATION); + edomain.setReferenceValue(Double.valueOf(equationElement.attributeValue(REFERENCE))); + edomain.setVariableName(equationElement.attributeValue(VARIABLE)); domain = edomain; } else { // continous domain - domain = new ContinuousDomain<Integer,Integer>(); + domain = new ContinuousDomain(); + + Element percentageElement = fixedElement.element(PERCENTAGE); + if (percentageElement != null) { + domain.setCoefficient(Double.valueOf(percentageElement.attributeValue(COEFFICIENT))); + domain.setReferenceValue(Double.valueOf(percentageElement.attributeValue(REFERENCE))); + domain.setPercentageType(true); + } + else { + // <range max="1" min="3"/> + Element rangeElement = fixedElement.element(RANGE); + domain.setMinBound(Integer.valueOf(rangeElement.attributeValue(MIN))); + domain.setMaxBound(Integer.valueOf(rangeElement.attributeValue(MAX))); + } + } - domain.setCardinality(Integer.valueOf(fixedElement.attributeValue("cardinality"))); + domain.setCardinality(Integer.valueOf(fixedElement.attributeValue(CARDINALITY))); - // <range max="1" min="3"/> - Element rangeElement = fixedElement.element("range"); - domain.setMinBound(Integer.valueOf(rangeElement.attributeValue("min"))); - domain.setMaxBound(Integer.valueOf(rangeElement.attributeValue("max"))); - factor.setDomain(domain); - } else if ("discrete".equals(property)) { - DiscreteDomain<Integer,Integer> domain = new DiscreteDomain<Integer,Integer>(); + } else if (DISCRETE.equals(property)) { + DiscreteDomain domain = new DiscreteDomain(); List<Element> valueElements = fixedElement.element( - "enumeration").elements("value"); + ENUMERATION).elements(VALUE); int label = 0; for (Element valueElement : valueElements) { - domain.getValues().put(Integer.valueOf(label), + domain.getValues().put(label, Integer.valueOf(valueElement.getTextTrim())); ++label; } factor.setDomain(domain); } - plan.getFactors().add(factor); + factorGroup.addFactor(factor); + } else if (RULE.equals(type)) { + Factor factor = new Factor(name); + factor.setPath(path); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + if (DISCRETE.equals(property)) { + RuleDiscreteDomain domain = new RuleDiscreteDomain(); + List<Element> valueElements = fixedElement.element(ENUMERATION).elements(VALUE); + int label = 0; + for (Element valueElement : valueElements) { + Element rulesElement = valueElement.element(RULES); + List<Rule> rulesValue = MexicoHelper.getRulesFromXml(rulesElement, topiaContext); + domain.getValues().put(label, rulesValue); + ++label; + } + factor.setDomain(domain); + } + factorGroup.addFactor(factor); } } - return plan; + return factorGroup; } - - /* - * Parse element root node as Sensitivity Scenarios. + + /** + * Recursive parse of factor group elements (>factors<). * - * @return a {@link SensitivityScenarios} + * This version handle xml file with min/max and percentage factor + * in each continuous factors. * - * TODO : non finished and untested - * - public static SensitivityScenarios parseSensitivityScenarios( - Element rootElement) { + * @param fgElement factor group element (>factors<) + * @param topiaContext context + * @return factor group + */ + protected static FactorGroup parseFactorGroupV2(Element fgElement, TopiaContext topiaContext) { - SensitivityScenarios scenarios = new SensitivityScenarios(); + String factorGroupName = fgElement.attributeValue(NAME); + FactorGroup factorGroup = new FactorGroup(factorGroupName); - List<Element> scenarioElements = rootElement - .selectNodes("child::scenarios/scenario"); + // sub factor group + List<Element> factorGroupElements = fgElement.selectNodes("child::factors"); + for (Element factorGroupElement : factorGroupElements) { + FactorGroup subFactorGroup = parseFactorGroupV2(factorGroupElement, topiaContext); + factorGroup.addFactor(subFactorGroup); + } + + // normal factors + List<Element> factorElements = fgElement.selectNodes("child::factor"); - for (Element scenarioElement : scenarioElements) { + for (Element factorElement : factorElements) { + String type = factorElement.attributeValue(TYPE); + String name = factorElement.attributeValue(NAME); + String property = factorElement.attributeValue(PROPERTY); + String path = factorElement.element(TARGET).getText().trim(); - Scenario scenario = new Scenario(); - List<Element> factorElements = scenarioElement.elements("factor"); + // double + if ("real".equals(type)) { + Factor factor = new Factor(name); + factor.setPath(path); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + // tous les domaines continues + if (property.endsWith(CONTINUOUS)) { - for (Element factorElement : factorElements) { - String type = factorElement.attributeValue("type"); - String name = factorElement.attributeValue("name"); - String property = factorElement.attributeValue("property"); - String path = factorElement.element("target").getText().trim(); + ContinuousDomain domain; + if(property.equals(MATRIXCONTINUOUS)) { + + MatrixContinuousDomain mdomain = new MatrixContinuousDomain(); + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + // matrix specific + // <coefficient operator="-" value="0.799"/> + mdomain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + // <mx name="test1" step="0">... + Element matrixElement = referenceElement.element(MX); + MatrixND matrix = MexicoHelper.getMatrixFromXml(matrixElement, topiaContext); + mdomain.setReferenceValue(matrix); + mdomain.setPercentageType(true); + } + else { + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + MatrixND minMatrix = MexicoHelper.getMatrixFromXml(minElement.element(MX), topiaContext); + MatrixND maxMatrix = MexicoHelper.getMatrixFromXml(maxElement.element(MX), topiaContext); + mdomain.setMinBound(minMatrix); + mdomain.setMaxBound(maxMatrix); + } - // double - if ("real".equals(type)) { - Factor<Double> factor = new Factor<Double>(name); - factor.setPath(path); - factor.setValue(Double.valueOf(factorElement.element( - "value").getText().trim())); + domain = mdomain; + } + else if (property.equals(EQUATIONCONTINUOUS)) { + // equation specific + EquationContinuousDomain edomain = new EquationContinuousDomain(); + edomain.setVariableName(fixedElement.attributeValue(VARIABLE)); + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + edomain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + edomain.setReferenceValue(Double.valueOf(referenceElement.getTextTrim())); + edomain.setPercentageType(true); + } + else { + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + edomain.setMinBound(Double.valueOf(minElement.getTextTrim())); + edomain.setMaxBound(Double.valueOf(maxElement.getTextTrim())); + } - Element fixedElement = factorElement.element("domain") - .element("fixed"); - if ("continuous".equals(property)) { - ContinuousDomain<Double> domain = new ContinuousDomain<Double>(); - domain.setCardinality(Integer.valueOf(fixedElement - .attributeValue("cardinality"))); - Element rangeElement = fixedElement.element("range"); - domain.setMinBound(Double.valueOf(rangeElement - .attributeValue("min"))); - domain.setMaxBound(Double.valueOf(rangeElement - .attributeValue("max"))); - factor.setDomain(domain); - } else if ("discrete".equals(property)) { - DiscreteDomain<Double> domain = new DiscreteDomain<Double>(); - List<Element> valueElements = fixedElement.element( - "enumeration").elements("value"); - int label = 0; - for (Element valueElement : valueElements) { - domain.getValues().put( - Integer.valueOf(label), - Double.valueOf(valueElement.getText() - .trim())); - ++label; + domain = edomain; + } + else { + // continous domain + domain = new ContinuousDomain(); + + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + domain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + domain.setReferenceValue(Double.valueOf(referenceElement.getTextTrim())); + domain.setPercentageType(true); } - factor.setDomain(domain); + else { + // <range max="1.0" min="0.0"/> + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + domain.setMinBound(Double.valueOf(minElement.getTextTrim())); + domain.setMaxBound(Double.valueOf(maxElement.getTextTrim())); + } } - scenario.getFactors().add(factor); - } else if ("integer".equals(type)) { - Factor<Integer> factor = new Factor<Integer>(name); - factor.setPath(path); - factor.setValue(Integer.valueOf(factorElement.element( - "value").getText().trim())); - Element fixedElement = factorElement.element("domain") - .element("fixed"); - if ("continuous".equals(property)) { - ContinuousDomain<Integer> domain = new ContinuousDomain<Integer>(); - domain.setCardinality(Integer.valueOf(fixedElement - .attributeValue("cardinality"))); - Element rangeElement = fixedElement.element("range"); - domain.setMinBound(Integer.valueOf(rangeElement - .attributeValue("min"))); - domain.setMaxBound(Integer.valueOf(rangeElement - .attributeValue("max"))); - factor.setDomain(domain); - } else if ("discrete".equals(property)) { - DiscreteDomain<Integer> domain = new DiscreteDomain<Integer>(); - List<Element> valueElements = fixedElement.element( - "enumeration").elements("value"); - int label = 0; - for (Element valueElement : valueElements) { - domain.getValues().put( - Integer.valueOf(label), - Integer.valueOf(valueElement.getText() - .trim())); - ++label; + domain.setCardinality(Integer.valueOf(fixedElement.attributeValue(CARDINALITY))); + + factor.setDomain(domain); + } else if (DISCRETE.equals(property)) { + DiscreteDomain domain = new DiscreteDomain(); + List<Element> valueElements = fixedElement.element( + ENUMERATION).elements(VALUE); + int label = 0; + for (Element valueElement : valueElements) { + domain.getValues().put(label, + Double.valueOf(valueElement.getTextTrim())); + ++label; + } + factor.setDomain(domain); + } + factorGroup.addFactor(factor); + } else if (INTEGER.equals(type)) { + Factor factor = new Factor(name); + factor.setPath(path); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + if (CONTINUOUS.equals(property)) { + ContinuousDomain domain; + + if(property.equals(MATRIXCONTINUOUS)) { + + MatrixContinuousDomain mdomain = new MatrixContinuousDomain(); + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + // matrix specific + // <coefficient operator="-" value="0.799"/> + mdomain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + // <mx name="test1" step="0">... + Element matrixElement = referenceElement.element(MX); + MatrixND matrix = MexicoHelper.getMatrixFromXml(matrixElement, topiaContext); + mdomain.setReferenceValue(matrix); + mdomain.setPercentageType(true); } - factor.setDomain(domain); + else { + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + MatrixND minMatrix = MexicoHelper.getMatrixFromXml(minElement.element(MX), topiaContext); + MatrixND maxMatrix = MexicoHelper.getMatrixFromXml(maxElement.element(MX), topiaContext); + mdomain.setMinBound(minMatrix); + mdomain.setMaxBound(maxMatrix); + } + + domain = mdomain; } - scenario.getFactors().add(factor); + else if (property.equals(EQUATIONCONTINUOUS)) { + // equation specific + EquationContinuousDomain edomain = new EquationContinuousDomain(); + edomain.setVariableName(fixedElement.attributeValue(VARIABLE)); + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + edomain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + edomain.setReferenceValue(Double.valueOf(referenceElement.getTextTrim())); + edomain.setPercentageType(true); + } + else { + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + edomain.setMinBound(Double.valueOf(minElement.getTextTrim())); + edomain.setMaxBound(Double.valueOf(maxElement.getTextTrim())); + } + + domain = edomain; + } + else { + // continous domain + domain = new ContinuousDomain(); + + Element referenceElement = fixedElement.element(REFERENCE); + if (referenceElement != null) { + domain.setCoefficient(Double.valueOf(referenceElement.attributeValue(COEFFICIENT))); + domain.setReferenceValue(Double.valueOf(referenceElement.getTextTrim())); + domain.setPercentageType(true); + } + else { + // <range max="1.0" min="0.0"/> + Element rangeElement = fixedElement.element(RANGE); + Element minElement = rangeElement.element(MIN); + Element maxElement = rangeElement.element(MAX); + domain.setMinBound(Integer.valueOf(minElement.getTextTrim())); + domain.setMaxBound(Integer.valueOf(maxElement.getTextTrim())); + } + } + + domain.setCardinality(Integer.valueOf(fixedElement.attributeValue(CARDINALITY))); + + factor.setDomain(domain); + } else if (DISCRETE.equals(property)) { + DiscreteDomain domain = new DiscreteDomain(); + List<Element> valueElements = fixedElement.element( + ENUMERATION).elements(VALUE); + int label = 0; + for (Element valueElement : valueElements) { + domain.getValues().put(label, + Integer.valueOf(valueElement.getTextTrim())); + ++label; + } + factor.setDomain(domain); } + factorGroup.addFactor(factor); + } else if (RULE.equals(type)) { + Factor factor = new Factor(name); + factor.setPath(path); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + if (DISCRETE.equals(property)) { + RuleDiscreteDomain domain = new RuleDiscreteDomain(); + List<Element> valueElements = fixedElement.element(ENUMERATION).elements(VALUE); + int label = 0; + for (Element valueElement : valueElements) { + Element rulesElement = valueElement.element(RULES); + List<Rule> rulesValue = MexicoHelper.getRulesFromXml(rulesElement, topiaContext); + domain.getValues().put(label, rulesValue); + ++label; + } + factor.setDomain(domain); + } + factorGroup.addFactor(factor); + } else if (EQUATION.equals(type)) { + Factor factor = new Factor(name); + factor.setPath(path); + Element fixedElement = factorElement.element(DOMAIN).element(FIXED); + if (DISCRETE.equals(property)) { + EquationDiscreteDomain domain = new EquationDiscreteDomain(); + List<Element> valueElements = fixedElement.element(ENUMERATION).elements(VALUE); + int label = 0; + for (Element valueElement : valueElements) { + String content = StringEscapeUtils.unescapeXml(valueElement.getText()); + domain.getValues().put(label, content); + ++label; + } + factor.setDomain(domain); + } + factorGroup.addFactor(factor); } - scenarios.getScenarios().add(scenario); } - return scenarios; - }*/ + return factorGroup; + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,27 +36,6 @@ * Last update : $Date: 5 mars 2009 $ * By : $Author: chatellier $ */ -public abstract class DomainXMLVisitor implements DomainVisitor { +public abstract class DomainXMLVisitor extends AbstractXMLVisitor implements DomainVisitor { - /** XML text buffer. */ - protected StringBuffer xmlBuffer; - - /** - * Constructor. - * - * Init xml buffer. - */ - public DomainXMLVisitor() { - xmlBuffer = new StringBuffer(); - } - - /** - * Get xml buffer content. - * - * @return content as string - */ - public String getXML() { - String xml = xmlBuffer.toString(); - return xml; - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 1999 - 2010 Ifremer, CodeLutin, Chatellier Eric + * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -26,6 +26,7 @@ package fr.ifremer.isisfish.mexico.xml; import fr.ifremer.isisfish.simulator.sensitivity.Domain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; /** @@ -44,12 +45,46 @@ */ @Override public void start(Domain domain) { - super.start(domain); + xmlBuffer.append("<domain>"); + xmlBuffer.append("<fixed"); EquationContinuousDomain eDomain = (EquationContinuousDomain)domain; - // since 3.3.0.0 coefficient element is outside equation element - xmlBuffer.append("<coefficient value=\"" + eDomain.getCoefficient() + "\" operator=\"" + eDomain.getOperator() + "\" />"); - xmlBuffer.append("<equation variable=\"" + eDomain.getVariableName()+ "\""); - xmlBuffer.append(" reference=\"" + eDomain.getReferenceValue() + "\" />"); + // this version add variable name + xmlBuffer.append(" cardinality=\"") + .append(eDomain.getCardinality()) + .append("\" variable=\"") + .append(eDomain.getVariableName()) + .append("\">"); + + appendDomain(eDomain); } + + /** + * {@inheritDoc} + */ + @Override + protected void appendDomain(ContinuousDomain domain) { + + EquationContinuousDomain eDomain = (EquationContinuousDomain)domain; + + // facteur continue pourcentage + if (domain.isPercentageType()) { + xmlBuffer.append("<reference coefficient=\"") + .append(eDomain.getCoefficient()) + .append( "\">"); + xmlBuffer.append(eDomain.getReferenceValue()); + xmlBuffer.append("</reference>"); + } + else { + // facteur continue min/max + xmlBuffer.append("<range>"); + xmlBuffer.append("<min>") + .append(domain.getMinBound()) + .append("</min>"); + xmlBuffer.append("<max>") + .append(domain.getMaxBound()) + .append("</max>"); + xmlBuffer.append("</range>"); + } + } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationDiscreteDomainXMLVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationDiscreteDomainXMLVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationDiscreteDomainXMLVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationDiscreteDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,53 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.xml; + +import org.apache.commons.lang.StringEscapeUtils; + +import fr.ifremer.isisfish.simulator.sensitivity.Domain; + +/** + * XML equation discrete domain visitor. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class EquationDiscreteDomainXMLVisitor extends DiscreteDomainXMLVisitor { + + /** + * {@inheritDoc} + */ + @Override + public void visit(Domain domain, Object label, Object value) { + String content = (String)value; + xmlBuffer.append("<value>"); + xmlBuffer.append(StringEscapeUtils.escapeXml(content)); + xmlBuffer.append("</value>"); + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorGroupXMLVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorGroupXMLVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorGroupXMLVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorGroupXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,80 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.xml; + +import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; +import fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorGroupVisitor; + +/** + * XML factor group visitor. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class FactorGroupXMLVisitor extends AbstractXMLVisitor implements FactorGroupVisitor { + + /* + * @see fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorGroupVisitor#start(fr.ifremer.isisfish.simulator.sensitivity.FactorGroup) + */ + @Override + public void start(FactorGroup factorGroup) { + xmlBuffer.append("<factors"); + if (factorGroup.getName() != null) { + xmlBuffer.append(" name=\"" + factorGroup.getName() + "\""); + } + xmlBuffer.append(">"); + } + + /* + * @see fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorGroupVisitor#visit(fr.ifremer.isisfish.simulator.sensitivity.FactorGroup, fr.ifremer.isisfish.simulator.sensitivity.Factor) + */ + @Override + public void visit(FactorGroup factorGroup, Factor factor) { + if (factor instanceof FactorGroup) { + FactorGroup factorGroup2 = (FactorGroup)factor; + FactorGroupXMLVisitor visitor = new FactorGroupXMLVisitor(); + factorGroup2.accept(visitor); + xmlBuffer.append(visitor.getXML()); + } + else { + FactorXMLVisitor visitor = new FactorXMLVisitor(); + factor.accept(visitor); + xmlBuffer.append(visitor.getXML()); + } + } + + /* + * @see fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorGroupVisitor#end(fr.ifremer.isisfish.simulator.sensitivity.FactorGroup) + */ + @Override + public void end(FactorGroup factorGroup) { + xmlBuffer.append("</factors>"); + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,14 +25,16 @@ package fr.ifremer.isisfish.mexico.xml; -import java.io.Serializable; +import org.nuiton.math.matrix.MatrixND; import fr.ifremer.isisfish.simulator.sensitivity.Domain; import fr.ifremer.isisfish.simulator.sensitivity.Factor; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorVisitor; /** @@ -44,66 +46,54 @@ * Last update : $Date: 5 mars 2009 $ * By : $Author: chatellier $ */ -public class FactorXMLVisitor implements FactorVisitor { +public class FactorXMLVisitor extends AbstractXMLVisitor implements FactorVisitor { - /** XML text buffer. */ - protected StringBuffer xmlBuffer; - - /** - * Constructor. - * - * Init xml buffer. - */ - public FactorXMLVisitor() { - xmlBuffer = new StringBuffer(); - } - - /** - * Get xml buffer content. - * - * @return content as string - */ - public String getXML() { - String xml = xmlBuffer.toString(); - return xml; - } - /* * @see fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorVisitor#start(fr.ifremer.isisfish.simulator.sensitivity.Factor) */ @Override public void start(Factor factor) { xmlBuffer.append("<factor"); - xmlBuffer.append(" name=\"" + factor.getName() + "\""); - Serializable referenceValueForType = null; + xmlBuffer.append(" name=\"").append(factor.getName()).append("\""); + Object referenceValueForType = null; // property attribute - if (factor.getDomain() instanceof MatrixContinuousDomain) { - xmlBuffer.append(" property=\"matrixcontinuous\""); - referenceValueForType = ((MatrixContinuousDomain)factor.getDomain()).getMinBound(); - } - else if (factor.getDomain() instanceof EquationContinuousDomain) { - xmlBuffer.append(" property=\"equationcontinuous\""); - referenceValueForType = ((ContinuousDomain)factor.getDomain()).getMinBound(); - } - else if (factor.getDomain() instanceof ContinuousDomain) { - xmlBuffer.append(" property=\"continuous\""); - referenceValueForType = ((ContinuousDomain)factor.getDomain()).getMinBound(); - } - else if (factor.getDomain() instanceof DiscreteDomain) { + + Domain domain = factor.getDomain(); + + if (domain instanceof ContinuousDomain) { + if (domain instanceof MatrixContinuousDomain) { + xmlBuffer.append(" property=\"matrixcontinuous\""); + } else if (domain instanceof EquationContinuousDomain) { + xmlBuffer.append(" property=\"equationcontinuous\""); + } else { + xmlBuffer.append(" property=\"continuous\""); + } + referenceValueForType = ((ContinuousDomain) domain).getReferenceValue(); + if (referenceValueForType == null) { + referenceValueForType = ((ContinuousDomain) domain).getMinBound(); + } + } else if (domain instanceof DiscreteDomain) { xmlBuffer.append(" property=\"discrete\""); - Object firstKey = ((DiscreteDomain)factor.getDomain()).getValues().firstKey(); - referenceValueForType = (Serializable)((DiscreteDomain)factor.getDomain()).getValues().get(firstKey); + Object firstKey = ((DiscreteDomain) domain).getValues().firstKey(); + referenceValueForType = ((DiscreteDomain) domain).getValues().get(firstKey); } // type attribute - if (referenceValueForType instanceof Double || referenceValueForType instanceof Float) { + if (referenceValueForType instanceof Double || referenceValueForType instanceof Float + || referenceValueForType instanceof MatrixND) { xmlBuffer.append(" type=\"real\""); } else if (referenceValueForType instanceof Integer) { xmlBuffer.append(" type=\"integer\""); } + else if (domain instanceof RuleDiscreteDomain) { + xmlBuffer.append(" type=\"rule\""); + } + else if (domain instanceof EquationDiscreteDomain) { + xmlBuffer.append(" type=\"equation\""); + } xmlBuffer.append(">"); // target element - xmlBuffer.append("<target>" + factor.getPath() + "</target>"); + xmlBuffer.append("<target>").append(factor.getPath()).append("</target>"); // value element /* TODO value should be only in simulation export, not in design plan export @@ -120,14 +110,15 @@ DomainXMLVisitor visitor = null; if (factor.getDomain() instanceof MatrixContinuousDomain) { visitor = new MatrixContinuousDomainXMLVisitor(); - } - else if (factor.getDomain() instanceof EquationContinuousDomain) { + } else if (factor.getDomain() instanceof EquationContinuousDomain) { visitor = new EquationContinuousDomainXMLVisitor(); - } - else if (factor.getDomain() instanceof ContinuousDomain) { + } else if (factor.getDomain() instanceof ContinuousDomain) { visitor = new ContinuousDomainXMLVisitor(); - } - else if (factor.getDomain() instanceof DiscreteDomain) { + } else if (factor.getDomain() instanceof RuleDiscreteDomain) { + visitor = new RuleDiscreteDomainXMLVisitor(); + } else if (factor.getDomain() instanceof EquationDiscreteDomain) { + visitor = new EquationDiscreteDomainXMLVisitor(); + } else if (factor.getDomain() instanceof DiscreteDomain) { visitor = new DiscreteDomainXMLVisitor(); } domain.accept(visitor); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin, CHatellier Eric + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,8 +25,10 @@ package fr.ifremer.isisfish.mexico.xml; +import org.nuiton.math.matrix.MatrixND; + import fr.ifremer.isisfish.mexico.MexicoHelper; -import fr.ifremer.isisfish.simulator.sensitivity.Domain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; /** @@ -44,12 +46,28 @@ * {@inheritDoc} */ @Override - public void start(Domain domain) { - super.start(domain); + protected void appendDomain(ContinuousDomain domain) { MatrixContinuousDomain mDomain = (MatrixContinuousDomain)domain; - // since 3.3.0.0 coefficient element is outside matrix element - xmlBuffer.append("<coefficient value=\"" + mDomain.getCoefficient() + "\" operator=\"" + mDomain.getOperator() + "\" />"); - xmlBuffer.append(MexicoHelper.getMatrixAsXML(mDomain.getMatrix())); + + // facteur continue pourcentage + if (domain.isPercentageType()) { + xmlBuffer.append("<reference coefficient=\"") + .append(mDomain.getCoefficient()) + .append("\">"); + xmlBuffer.append(MexicoHelper.getMatrixAsXML((MatrixND)mDomain.getReferenceValue())); + xmlBuffer.append("</reference>"); + } + else { + // facteur continue min/max + xmlBuffer.append("<range>"); + xmlBuffer.append("<min>") + .append(MexicoHelper.getMatrixAsXML((MatrixND)mDomain.getMinBound())) + .append("</min>"); + xmlBuffer.append("<max>") + .append(MexicoHelper.getMatrixAsXML((MatrixND)mDomain.getMaxBound())) + .append("</max>"); + xmlBuffer.append("</range>"); + } } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/RuleDiscreteDomainXMLVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/RuleDiscreteDomainXMLVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/RuleDiscreteDomainXMLVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/RuleDiscreteDomainXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,57 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.mexico.xml; + +import java.util.List; + +import fr.ifremer.isisfish.mexico.MexicoHelper; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.simulator.sensitivity.Domain; + +/** + * XML rule domain visitor. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RuleDiscreteDomainXMLVisitor extends DiscreteDomainXMLVisitor { + + /** + * {@inheritDoc} + */ + @Override + public void visit(Domain domain, Object label, Object value) { + List<Rule> rulesList = (List<Rule>)value; + String rulesAsXml = MexicoHelper.getRulesAsXml(rulesList); + + xmlBuffer.append("<value>"); + xmlBuffer.append(rulesAsXml); + xmlBuffer.append("</value>"); + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -38,31 +38,9 @@ * Last update : $Date: 5 mars 2009 $ * By : $Author: chatellier $ */ -public class ScenarioXMLVisitor implements ScenarioVisitor { +public class ScenarioXMLVisitor extends AbstractXMLVisitor implements ScenarioVisitor { - /** XML text buffer. */ - protected StringBuffer xmlBuffer; - /** - * Constructor. - * - * Init xml buffer. - */ - public ScenarioXMLVisitor() { - xmlBuffer = new StringBuffer(); - } - - /** - * Get xml buffer content. - * - * @return content as string - */ - public String getXML() { - String xml = xmlBuffer.toString(); - return xml; - } - - /** * {@inheritDoc} */ @Override Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -38,31 +38,9 @@ * Last update : $Date: 5 mars 2009 $ * By : $Author: chatellier $ */ -public class SensitivityScenariosXMLVisitor implements SensitivityScenariosVisitor { +public class SensitivityScenariosXMLVisitor extends AbstractXMLVisitor implements SensitivityScenariosVisitor { - /** XML text buffer. */ - protected StringBuffer xmlBuffer; - /** - * Constructor. - * - * Init xml buffer. - */ - public SensitivityScenariosXMLVisitor() { - xmlBuffer = new StringBuffer(); - } - - /** - * Get xml buffer content. - * - * @return content as string - */ - public String getXML() { - String xml = xmlBuffer.toString(); - return xml; - } - - /** * {@inheritDoc} */ @Override Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,29 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ +/** + * Design plan and scenario xml import/export. + */ +package fr.ifremer.isisfish.mexico.xml; + Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/rule/RuleHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,6 +34,7 @@ import org.nuiton.topia.TopiaContext; import org.nuiton.topia.persistence.TopiaEntity; +import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.datastore.RegionStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.util.ConverterUtil; @@ -69,7 +70,7 @@ * @param region le topia context dont on a besoin * @param props les propriétés contenant les paramètres de la règle * - * @deprecated use {@link #populateRule(int, TopiaContext , Rule, Properties)} instead. + * @deprecated since 3.3.0.0, use {@link #populateRule(int, TopiaContext , Rule, Properties)} instead. */ @Deprecated public static void populateRule(int ruleIndex, RegionStorage region, Rule rule, Properties props) { @@ -123,4 +124,36 @@ } } } + + /** + * Permet de mettre les parametres de la regle sous une forme String pour + * pouvoir les relire ensuite. + * + * @param ruleIndex l'index de la rule + * @param context le context + * @param rule La regle dont on souhaite mettre les parametres dans l'objet + * Properties retourne + * @return L'objet Properties contenant les valeurs des parametres de la + * regle + */ + public static Properties getRuleAsProperties(int ruleIndex, TopiaContext context, Rule rule) { + Properties result = new Properties(); + ConvertUtilsBean beanUtils = ConverterUtil.getConverter(context); + for (String paramName : RuleStorage.getParameterNames(rule).keySet()) { + String paramValueString; + try { + Object value = RuleStorage.getParameterValue(rule, paramName); + paramValueString = beanUtils.convert(value); + if (paramValueString != null) { + result.setProperty("rule." + ruleIndex + ".parameter." + paramName, paramValueString); + } + } catch (IsisFishException eee) { + if (log.isWarnEnabled()) { + log.warn("Can't convert parameter value to String: " + paramName, eee); + } + } + } + + return result; + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/PopulationMonitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/PopulationMonitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/PopulationMonitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -159,8 +159,8 @@ if (result != null) { // change semantics with list from argument to ensure that // semantics don't used too old context - result.setSemantics(0, pop.getPopulationGroup()); - result.setSemantics(1, pop.getPopulationZone()); + result.setSemantic(0, pop.getPopulationGroup()); + result.setSemantic(1, pop.getPopulationZone()); } return result; @@ -173,14 +173,20 @@ /** * Return reproduction. * - * @return the reproduction. + * @param date date + * @param pop population + * @return the reproduction */ public MatrixND getReproduction(Date date, Population pop) { return this.reproductions.get(pop).get(date); } /** - * @param repro The reproduction to set. + * Set new reproduction. + * + * @param date date + * @param pop population + * @param repro reproduction to set */ public void setReproduction(Date date, Population pop, MatrixND repro) { reproductions.get(pop).put(date, repro); @@ -260,7 +266,7 @@ MatrixND matRepro = repro.copy(); matRepro = matRepro.mults(coeff); - matRepro.setSemantics(0, zoneRepros); + matRepro.setSemantic(0, zoneRepros); MatrixND mapping = pop.getMappingZoneReproZoneRecru(); for (Zone zoneRepro : zoneRepros) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -79,8 +79,6 @@ /** Context value used in equation. */ protected Map<String, Double> contextEquationValue = new HashMap<String, Double>(); - /** Operator used in equation values */ - protected Map<String, String> contextEquationOperator = new HashMap<String, String>(); private static ThreadLocal<SimulationContext> simulationContext = new ThreadLocal<SimulationContext>() { protected synchronized SimulationContext initialValue() { @@ -329,15 +327,13 @@ } /** - * Add value/key pair into context. + * Add value/key pair into context (computed value). * * @param key key * @param value value - * @param operator operator */ - public void setValue(String key, Double value, String operator) { + public void setComputeValue(String key, Double value) { contextEquationValue.put(key, value); - contextEquationOperator.put(key, operator); } /** @@ -351,30 +347,16 @@ double result = defaultValue; - if (contextEquationValue.containsKey(key) && contextEquationOperator.containsKey(key)) { + if (contextEquationValue.containsKey(key)) { Double value = contextEquationValue.get(key); - String operator = contextEquationOperator.get(key); if (log.isTraceEnabled()) { log.trace("Found key '" + key + "' current value = " + value); } - - if ("+".equals(operator)) { - result = value + defaultValue; - } - else if ("-".equals(operator)) { - result = value - defaultValue; - } - else if ("*".equals(operator)) { - result = value * defaultValue; - } - else if ("/".equals(operator)) { - result = value / defaultValue; - } - else { - throw new IllegalArgumentException("Unknown operator '" + operator + "'"); - } + + // since 3.4.0.0, operator is always * + result = value * defaultValue; } else { if (log.isTraceEnabled()) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -177,17 +177,17 @@ protected Boolean onlyExport; /** Le niveau de log du simulateur à utiliser pendant la simulation. Par defaut info. */ - protected String simulLogLevel = "info"; + protected String simulLogLevel; /** Le niveau de log des scripts à utiliser pendant la simulation. Par defaut info. */ - protected String scriptLogLevel = "info"; + protected String scriptLogLevel; /** Le niveau de log des librairies à utiliser pendant la simulation. Par defaut error. */ - protected String libLogLevel = "error"; + protected String libLogLevel; /** La region corespondant au parametre {@link #regionName}. */ protected transient RegionStorage region; /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#check() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#check() */ @Override public List<String> check() { @@ -199,7 +199,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getIsisFishVersion() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getIsisFishVersion() */ @Override public String getIsisFishVersion() { @@ -216,7 +216,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setIsisFishVersion(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setIsisFishVersion(java.lang.String) */ @Override public void setIsisFishVersion(String isisFishVersion) { @@ -224,7 +224,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getDescription() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getDescription() */ @Override public String getDescription() { @@ -241,7 +241,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setDescription(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setDescription(java.lang.String) */ @Override public void setDescription(String description) { @@ -249,7 +249,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getRegion() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getRegion() */ @Override public RegionStorage getRegion() { @@ -268,7 +268,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getNumberOf(fr.ifremer.isisfish.entities.Population) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getNumberOf(fr.ifremer.isisfish.entities.Population) */ @Override public MatrixND getNumberOf(Population pop) { @@ -495,7 +495,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getExtraRules() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getExtraRules() */ @Override public List<String> getExtraRules() { @@ -508,7 +508,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#addExtraRules(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#addExtraRules(java.lang.String) */ @Override public void addExtraRules(String... extraRules) { @@ -516,7 +516,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getPopulations() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getPopulations() */ @Override public List<Population> getPopulations() { @@ -580,7 +580,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setPopulations(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setPopulations(java.util.List) */ @Override public void setPopulations(List<Population> populations) { @@ -588,7 +588,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getStrategies() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getStrategies() */ @Override public List<Strategy> getStrategies() { @@ -649,7 +649,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setStrategies(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setStrategies(java.util.List) */ @Override public void setStrategies(List<Strategy> strategies) { @@ -657,7 +657,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#addAnalysePlan(fr.ifremer.isisfish.simulator.AnalysePlan) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#addAnalysePlan(fr.ifremer.isisfish.simulator.AnalysePlan) */ @Override public void addAnalysePlan(AnalysePlan plan) { @@ -665,7 +665,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#removeAnalysePlan(fr.ifremer.isisfish.simulator.AnalysePlan) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#removeAnalysePlan(fr.ifremer.isisfish.simulator.AnalysePlan) */ @Override public boolean removeAnalysePlan(AnalysePlan plan) { @@ -673,7 +673,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getAnalysePlans() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getAnalysePlans() */ @Override public List<AnalysePlan> getAnalysePlans() { @@ -711,7 +711,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setAnalysePlans(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setAnalysePlans(java.util.List) */ @Override public void setAnalysePlans(List<AnalysePlan> plans) { @@ -719,7 +719,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isIndependentPlan() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isIndependentPlan() */ @Override public boolean isIndependentPlan() { @@ -734,7 +734,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#clearPlans() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#clearPlans() */ @Override public void clearPlans() { @@ -744,7 +744,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#addRule(fr.ifremer.isisfish.rule.Rule) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#addRule(fr.ifremer.isisfish.rule.Rule) */ @Override public void addRule(Rule rule) { @@ -752,7 +752,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#removeRule(fr.ifremer.isisfish.rule.Rule) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#removeRule(fr.ifremer.isisfish.rule.Rule) */ @Override public boolean removeRule(Rule rule) { @@ -760,7 +760,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getRules() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getRules() */ @Override public List<Rule> getRules() { @@ -818,7 +818,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setRules(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setRules(java.util.List) */ @Override public void setRules(List<Rule> rules) { @@ -826,7 +826,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#clearRules() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#clearRules() */ @Override public void clearRules() { @@ -836,7 +836,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getUseOptimization() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getUseOptimization() */ @Override public boolean getUseOptimization() { @@ -852,7 +852,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setUseOptimization(boolean) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setUseOptimization(boolean) */ @Override public void setUseOptimization(boolean useOptimization) { @@ -860,7 +860,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getUseStatistic() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getUseStatistic() */ @Override public boolean getUseStatistic() { @@ -876,7 +876,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setUseStatistic(boolean) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setUseStatistic(boolean) */ @Override public void setUseStatistic(boolean useStatistic) { @@ -884,7 +884,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getExportNames() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getExportNames() */ @Override public List<String> getExportNames() { @@ -905,7 +905,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setExportNames(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setExportNames(java.util.List) */ @Override public void setExportNames(List<String> exportNames) { @@ -913,7 +913,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getNumberOfSensitivitySimulation() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getNumberOfSensitivitySimulation() */ @Override public int getNumberOfSensitivitySimulation() { @@ -932,7 +932,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setNumberOfSensitivitySimulation(int) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setNumberOfSensitivitySimulation(int) */ @Override public void setNumberOfSensitivitySimulation( @@ -941,7 +941,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getSensitivityCalculator() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getSensitivityCalculator() */ @Override public SensitivityCalculator getSensitivityCalculator() { @@ -970,7 +970,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setSensitivityCalculator(fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setSensitivityCalculator(fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator) */ @Override public void setSensitivityCalculator( @@ -979,7 +979,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getSensitivityExport() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getSensitivityExport() */ @Override public List<SensitivityExport> getSensitivityExport() { @@ -1043,7 +1043,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setSensitivityExport(java.util.List) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setSensitivityExport(java.util.List) */ @Override public void setSensitivityExport(List<SensitivityExport> sensitivityExport) { @@ -1051,7 +1051,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getUseAnalysePlan() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getUseAnalysePlan() */ @Override public boolean getUseAnalysePlan() { @@ -1068,7 +1068,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setUseAnalysePlan(boolean) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setUseAnalysePlan(boolean) */ @Override public void setUseAnalysePlan(boolean useAnalysePlan) { @@ -1076,7 +1076,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getAnalysePlanNumber() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getAnalysePlanNumber() */ @Override public int getAnalysePlanNumber() { @@ -1094,7 +1094,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setAnalysePlanNumber(int) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setAnalysePlanNumber(int) */ @Override public void setAnalysePlanNumber(int analysePlanNumber) { @@ -1102,7 +1102,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getNumberOfYear() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getNumberOfYear() */ @Override public int getNumberOfYear() { @@ -1119,7 +1119,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setNumberOfYear(int) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setNumberOfYear(int) */ @Override public void setNumberOfYear(int numberOfYear) { @@ -1127,7 +1127,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getUsePreScript() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getUsePreScript() */ @Override public boolean getUsePreScript() { @@ -1145,7 +1145,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setUsePreScript(boolean) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setUsePreScript(boolean) */ @Override public void setUsePreScript(boolean usePreScript) { @@ -1153,7 +1153,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getPreScript() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getPreScript() */ @Override public String getPreScript() { @@ -1171,7 +1171,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setPreScript(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setPreScript(java.lang.String) */ @Override public void setPreScript(String preScript) { @@ -1179,7 +1179,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getRegionName() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getRegionName() */ @Override public String getRegionName() { @@ -1197,7 +1197,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setRegionName(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setRegionName(java.lang.String) */ @Override public void setRegionName(String regionName) { @@ -1205,7 +1205,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getSimulatorName() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getSimulatorName() */ @Override public String getSimulatorName() { @@ -1222,7 +1222,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setSimulatorName(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setSimulatorName(java.lang.String) */ @Override public void setSimulatorName(String simulatorName) { @@ -1230,7 +1230,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getResultEnabled() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getResultEnabled() */ @Override public Collection<String> getResultEnabled() { @@ -1252,7 +1252,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setResultEnabled(java.util.Collection) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setResultEnabled(java.util.Collection) */ @Override public void setResultEnabled(Collection<String> resultEnabled) { @@ -1260,7 +1260,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getTagValue() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getTagValue() */ @Override public Map<String, String> getTagValue() { @@ -1283,7 +1283,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setTagValue(java.util.Map) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setTagValue(java.util.Map) */ @Override public void setTagValue(Map<String, String> tagValue) { @@ -1291,7 +1291,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getSimulLogLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getSimulLogLevel() */ @Override public String getSimulLogLevel() { @@ -1309,7 +1309,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setSimulLogLevel(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setSimulLogLevel(java.lang.String) */ @Override public void setSimulLogLevel(String logLevel) { @@ -1321,7 +1321,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getScriptLogLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getScriptLogLevel() */ @Override public String getScriptLogLevel() { @@ -1339,7 +1339,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setScriptLogLevel(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setScriptLogLevel(java.lang.String) */ @Override public void setScriptLogLevel(String logLevel) { @@ -1351,16 +1351,15 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#getLibLogLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#getLibLogLevel() */ @Override public String getLibLogLevel() { if (libLogLevel == null) { if (propertiesParameters != null) { - libLogLevel = propertiesParameters.getProperty("libLogLevel", - "error"); + libLogLevel = propertiesParameters.getProperty("libLogLevel", "error"); } else { - libLogLevel = "info"; + libLogLevel = "error"; } } @@ -1368,7 +1367,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#setLibLogLevel(java.lang.String) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#setLibLogLevel(java.lang.String) */ @Override public void setLibLogLevel(String logLevel) { @@ -1379,7 +1378,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isSimulErrorLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isSimulErrorLevel() */ @Override public boolean isSimulErrorLevel() { @@ -1387,7 +1386,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isSimulWarnLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isSimulWarnLevel() */ @Override public boolean isSimulWarnLevel() { @@ -1395,7 +1394,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isSimulInfoLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isSimulInfoLevel() */ @Override public boolean isSimulInfoLevel() { @@ -1403,7 +1402,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isSimulDebugLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isSimulDebugLevel() */ @Override public boolean isSimulDebugLevel() { @@ -1411,7 +1410,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isScriptErrorLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isScriptErrorLevel() */ @Override public boolean isScriptErrorLevel() { @@ -1419,7 +1418,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isScriptWarnLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isScriptWarnLevel() */ @Override public boolean isScriptWarnLevel() { @@ -1427,7 +1426,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isScriptInfoLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isScriptInfoLevel() */ @Override public boolean isScriptInfoLevel() { @@ -1435,7 +1434,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isScriptDebugLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isScriptDebugLevel() */ @Override public boolean isScriptDebugLevel() { @@ -1443,7 +1442,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isLibErrorLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isLibErrorLevel() */ @Override public boolean isLibErrorLevel() { @@ -1451,7 +1450,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isLibWarnLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isLibWarnLevel() */ @Override public boolean isLibWarnLevel() { @@ -1459,7 +1458,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isLibInfoLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isLibInfoLevel() */ @Override public boolean isLibInfoLevel() { @@ -1467,7 +1466,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#isLibDebugLevel() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#isLibDebugLevel() */ @Override public boolean isLibDebugLevel() { @@ -1475,7 +1474,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#copy() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#copy() */ @Override public SimulationParameter copy() { @@ -1536,7 +1535,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#deepCopy() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#deepCopy() */ @Override public SimulationParameter deepCopy() { @@ -1547,7 +1546,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#toString() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#toString() */ @Override public String toString() { @@ -1644,7 +1643,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#toProperties() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#toProperties() */ @Override public Properties toProperties() { @@ -1824,7 +1823,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#fromProperties(java.util.Properties) + * @see fr.ifremer.isisfish.simulator.SimulationParameter#fromProperties(java.util.Properties) */ @Override public void fromProperties(Properties props) { @@ -1836,7 +1835,7 @@ } /* - * @see fr.ifremer.isisfish.simulator.SimulationParameter2#reloadContextParameters() + * @see fr.ifremer.isisfish.simulator.SimulationParameter#reloadContextParameters() */ @Override public void reloadContextParameters() throws TopiaException { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationPreScript.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationPreScript.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationPreScript.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -77,10 +77,10 @@ bsh.eval("import org.nuiton.topia.*;"); bsh.eval("import org.nuiton.topia.persistence.*;"); bsh.eval("import fr.ifremer.isisfish.*;"); - bsh.eval("import java.util.*;"); bsh.eval("import fr.ifremer.isisfish.types.*;"); bsh.eval("import fr.ifremer.isisfish.types.Date;"); bsh.eval("import fr.ifremer.isisfish.entities.*;"); + bsh.eval("import java.util.*;"); bsh.eval(presimulationScript); tx.commitTransaction(); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,6 +36,7 @@ import java.util.Arrays; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -133,8 +134,7 @@ control.setStarted(true); // replace prescript if specified on method - if (simulationPrescript != null - && !simulationPrescript.trim().isEmpty()) { + if (StringUtils.isNotBlank(simulationPrescript)) { param.setUsePreScript(true); param.setPreScript(simulationPrescript); } @@ -295,8 +295,7 @@ // on leve un runtime, car normalement cette erreur est pratiquement // impossible car on creer l'url a partir d'un File ce qui ne pose // noralement pas de probleme - throw new IsisFishRuntimeException(_( - "isisfish.error.change.classloader", directory), eee); + throw new IsisFishRuntimeException(_("isisfish.error.change.classloader", directory), eee); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -27,6 +27,7 @@ import static org.nuiton.i18n.I18n._; +import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -44,7 +45,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.FileUtil; -import org.nuiton.util.MD5; +import org.nuiton.util.MD5InputStream; +import org.nuiton.util.StringUtil; import org.nuiton.util.ZipUtil; import com.jcraft.jsch.JSch; @@ -540,8 +542,7 @@ port = Integer.parseInt(sPort); } catch (NumberFormatException e) { if (log.isWarnEnabled()) { - log.warn(_( - "isisfish.error.simulation.remote.wrongportvalue", + log.warn(_("isisfish.error.simulation.remote.wrongportvalue", sPort)); } } @@ -764,7 +765,7 @@ } if (!StringUtils.isEmpty(md5sum)) { - String localMd5 = MD5.asHex(MD5.getHash(localFile)); + String localMd5 = StringUtil.asHex(MD5InputStream.hash(new BufferedInputStream(new FileInputStream(localFile)))); if (!localMd5.equals(md5sum)) { if (log.isWarnEnabled()) { log.warn("Warning md5 checksum failed (got " + localMd5 + ", expected : " + md5sum + ")"); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -473,11 +473,9 @@ // if not finished, re-add it at end if (jobIsFinished) { - if (log.isInfoEnabled()) { log.info("Job " + job.getId() + " finished"); } - doPostSimulationOperation(job, launcher); } @@ -549,7 +547,6 @@ else { // cas d'une simulation arretee par exception - File informationFile = SimulationStorage.getSimulationInformationFile(simulationRoot); SimulationInformation information = new SimulationInformation(informationFile); if (StringUtils.isNotEmpty(information.getException())) { @@ -570,8 +567,11 @@ /** * Operation to do after simulation end. * - * - get simulation result - * - do result export + * <ul> + * <li>get simulation result</li> + * <li>do registred post actions</li> + * <li>do sensitivity analisys second pass</li> + * </ul> * * @param job job * @param launcher {@link SimulatorLauncher} that manage simulation Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -32,8 +32,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -49,16 +47,22 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.ConvertUtils; +import org.apache.commons.beanutils.ConvertUtilsBean; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.mutable.MutableInt; import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.math.matrix.MatrixND; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.util.FileUtil; import org.nuiton.util.ListenerSet; import org.nuiton.util.ObjectUtil; +import org.nuiton.util.StringUtil; import org.nuiton.util.ZipUtil; import fr.ifremer.isisfish.IsisFish; @@ -74,28 +78,26 @@ import fr.ifremer.isisfish.export.SensitivityExport; import fr.ifremer.isisfish.mexico.MexicoHelper; import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.rule.RuleHelper; import fr.ifremer.isisfish.simulator.AnalysePlan; import fr.ifremer.isisfish.simulator.AnalysePlanContext; import fr.ifremer.isisfish.simulator.SimulationControl; import fr.ifremer.isisfish.simulator.SimulationException; import fr.ifremer.isisfish.simulator.SimulationParameter; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; +import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.Scenario; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityScenarios; -import fr.ifremer.isisfish.util.ClasspathTemplateLoader; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; import fr.ifremer.isisfish.util.CompileHelper; import fr.ifremer.isisfish.util.ConverterUtil; -import freemarker.cache.TemplateLoader; -import freemarker.ext.beans.BeansWrapper; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; /** * Cette classe est responsable de conservation de toutes les simulations faites - * ou a faire. Pour ajouter une nouvelle simulation on appelle la methode - * {@link #submit}. + * ou a faire. Pour ajouter une nouvelle simulation on appelle une des méthodes + * {@code submit}. * <p> * Cette classe sert aussi de modele pour le moniteur de queue * <p> @@ -126,12 +128,6 @@ protected static SimulationService instance = new SimulationService(); - /** Freemarker configuration used to get prescripts content. */ - protected Configuration freemarkerConfiguration; - - /** Freemarker pre script template. */ - protected static final String SENSITIVITY_PRE_SCRIPT = "templates/prescript/factorprescript.ftl"; - /** * Retourne l'instance du {@link SimulationService} a utiliser * @return l'instance a utiliser @@ -274,7 +270,8 @@ /** * Ajoute le job au job en cours previent s'il n'etait pas deja present - * les listener {@link SimulationServiceListener#simulationStart}. + * les listeners + * {@link SimulationServiceListener#simulationStart(SimulationService, SimulationJob)}. * @param job */ protected synchronized void fireStartEvent(SimulationJob job) { @@ -291,8 +288,8 @@ * Supprime le job de la liste des jobs en cours et l'ajoute le job si * besoin a la liste des jobs faits (s'il y a une erreur ou qu'il ne sagit * pas d'une simulation lancer par un plan d'analyse). - * Les listener sont prevenu par la methode - * {@link SimulationServiceListener#simulationStop}. + * Les listener sont prevenu par la méthode + * {@link SimulationServiceListener#simulationStop(SimulationService, SimulationJob)}. * @param job */ protected synchronized void fireStopEvent(SimulationJob job) { @@ -443,15 +440,21 @@ // get a TopiaContext on region database, for discret domain // to get original database value (Nominal value) RegionStorage regionStorage = RegionStorage.getRegion(param.getRegionName()); - TopiaContext context = regionStorage.getStorage().beginTransaction(); - sensitivitycalculator.setTopiaContext(context); + TopiaContext context = null; + try { + context = regionStorage.getStorage().beginTransaction(); + fillDesignPlanNominalValue(context, designPlan); + } finally { + if (context != null) { + context.closeContext(); + } + } + // Sensitivity scenario returned contains same factor references + // as input design plan. Factor group are still present SensitivityScenarios sensitivityScenarios = sensitivitycalculator .compute(designPlan, masterExportDirectory); - // close context opened for nominal values - context.closeContext(); - // ajout des parametres de simulation localParameters.setSensitivityCalculator(sensitivitycalculator); localParameters.setNumberOfSensitivitySimulation(sensitivityScenarios.getScenarios().size()); @@ -512,65 +515,170 @@ } } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't get scenarios from calculator", e); - } + throw new IsisFishRuntimeException("Can't get scenarios from calculator", e); } } /** - * Get freemarker configuration. + * Explore design plan factor tree, and set factor nominal value + * for each factor. + * + * Also fix factor name for R (without special chars in name) + * + * @param context opened database context + * @param designPlan design plan */ - protected Configuration getFreemarkerConfiguration() { - Configuration configuration = new Configuration(); + protected void fillDesignPlanNominalValue(TopiaContext context, DesignPlan designPlan) { + // take care only on first level of factor tree + for (Factor factor : designPlan.getFactors()) { + // get nominal value + String path = factor.getPath(); + if (StringUtils.contains(path, "#")) { + String topiaId = path.substring(0, path.lastIndexOf("#")); + String propertyName=path.substring(path.lastIndexOf("#") + 1); + try { + TopiaEntity entity = context.findByTopiaId(topiaId); + Object result = BeanUtils.getProperty(entity, propertyName); + factor.setNominalValue(result); + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("An error occurred while trying to get nominal value", ex); + } + } + } else { + factor.setNominalValue("NaN"); + } + + // also fix factor name for sensitivity calculator + String name = factor.getName(); + name = StringUtil.unaccent(name); + name = name.replaceAll("\\W", "_"); + factor.setName(name); + } + } - // needed to overwrite "Defaults to default system encoding." - // fix encoding issue on some systems - configuration.setDefaultEncoding("utf-8"); - - // specific template loader to get template from jars (classpath) - TemplateLoader templateLoader = new ClasspathTemplateLoader(); - configuration.setTemplateLoader(templateLoader); - - configuration.setObjectWrapper(new BeansWrapper()); - - return configuration; + /** Permet de manipuler un int entre plusieurs appele de methodes recursive. */ + public static class Counter { + protected int counter = 0; + public void inc() { + counter++; + } + public int getCounter() { + return counter; + } } /** * Generate prescript to set factor values before simulation start. * - * @param scenario + * @param scenario to generate prescript * @return simulation pre script with correct values - * @throws IOException if pre script can't be made - * @throws TemplateException if pre script can't be made */ - protected String generatePreScript(Scenario scenario) throws IOException, - TemplateException { + protected String generatePreScript(Scenario scenario) { + ConvertUtilsBean beanUtils = ConverterUtil.getConverter(null); - // init one at first call - if (freemarkerConfiguration == null) { - freemarkerConfiguration = getFreemarkerConfiguration(); - } + // n'utilise plus freemarker, car il y avait plus d'instruction + // freemarker compliqué que de code a afficher + StringBuffer buffer = new StringBuffer(); + buffer.append("import org.apache.commons.beanutils.BeanUtils;\n"); + buffer.append("import org.apache.commons.beanutils.ConvertUtilsBean;\n"); + buffer.append("import fr.ifremer.isisfish.util.ConverterUtil;\n"); + buffer.append("import fr.ifremer.isisfish.simulator.SimulationParameter;\n"); + buffer.append("ConvertUtilsBean beanUtils = ConverterUtil.getConverter(db);\n"); + buffer.append("SimulationParameter params = context.getSimulationStorage().getParameter();\n"); - Writer out = new StringWriter(); - Template template = freemarkerConfiguration - .getTemplate(SENSITIVITY_PRE_SCRIPT); - Map<String, Object> root = new HashMap<String, Object>(); - root.put("scenario", scenario); - root.put("beanUtils", ConverterUtil.getConverter(null)); - - template.process(root, out); - out.flush(); - String scriptContent = out.toString(); - + generatePreScript(beanUtils, buffer, new Counter(), scenario.getFactors()); + + String scriptContent = buffer.toString(); if (log.isTraceEnabled()) { log.trace("Simulation prescript content = " + scriptContent); } - return scriptContent; } + /** + * Generate prescript for a factor list that can be called recursively to + * manage factor group. + * + * @param beanUtils beanUtils converter + * @param buffer buffer to fill + * @param counter call counter used to avoid variables name collision + * @param factors factor list to manage + */ + protected void generatePreScript(ConvertUtilsBean beanUtils, StringBuffer buffer, Counter counter, Collection<Factor> factors) { + + for (Factor factor : factors) { + if (factor instanceof FactorGroup) { + buffer.append("/* factor group : ").append(factor.getName()).append(" */\n"); + FactorGroup factorGroup = (FactorGroup)factor; + generatePreScript(beanUtils, buffer, counter, factorGroup.getFactors()); + } + else { + int factorIndex = counter.getCounter(); + buffer.append("/* factor : ").append(factor.getName()).append(" */\n"); + + // cas special 1 : population de départ + if (factor.getPath().matches("parameters.population\\.\\w+\\.number")) { + String paramName = StringUtils.removeStart(factor.getPath(), "parameters."); + // pas de convert, c'est fait comme ca dans + // SimulationParameters.toProperties(); + MatrixND matrix = (MatrixND)factor.getValue(); + Object stringValue = String.valueOf(matrix.toList()); + buffer.append("params.setProperty(\"").append(paramName).append("\",\"").append(stringValue).append("\");\n"); + } + // cas special 2 : regles + else if (factor.getPath().equals("parameters.rules")) { + List<Rule> rules = (List<Rule>)factor.getValue(); + List<String> rulesNames = new ArrayList<String>(); + int ruleIndex = 0; + for (Rule rule : rules) { + rulesNames.add(rule.getClass().getSimpleName()); + Properties rulesProps = RuleHelper.getRuleAsProperties(ruleIndex++, null, rule); + for (String rulesProp : rulesProps.stringPropertyNames()) { + String value = rulesProps.getProperty(rulesProp); + buffer.append("params.setProperty(\"").append(rulesProp).append("\",\"").append(value).append("\");\n"); + } + } + buffer.append("params.setProperty(\"rules\",\"").append(StringUtils.join(rulesNames, ",")).append("\");\n"); + } + // cas special 3 : facteur sur les parametres des regles + else if (factor.getPath().startsWith("parameters.rule.")) { + String paramName = StringUtils.removeStart(factor.getPath(), "parameters."); + String stringValue = ConvertUtils.convert(factor.getValue()); + buffer.append("params.setProperty(\"").append(paramName).append("\",\"").append(stringValue).append("\");\n"); + } + // cas special 4 : equation + else if (factor.getDomain() instanceof EquationContinuousDomain) { + buffer.append("context.setComputeValue(\"").append(factor.getName()); + buffer.append("\",").append(factor.getValue()).append(");\n"); + } + // cas pas si special + else { + Object value = factor.getValue(); + String stringValue = beanUtils.convert(value); + String path = factor.getPath(); + String topiaId = path.substring(0, path.lastIndexOf('#')); + String property = path.substring(path.lastIndexOf('#') + 1); + // Double value123 = beanUtils.convert("mystringvalue", Double.class); + buffer.append(value.getClass().getName()).append(" value"); + buffer.append(factorIndex).append(" = beanUtils.convert(\""); + buffer.append(stringValue).append("\", ").append(value.getClass().getName()); + buffer.append(".class);\n"); + // TopiaEntity entity123 = db.findByTopiaId(topiaId); + buffer.append("TopiaEntity entity").append(factorIndex); + buffer.append(" = db.findByTopiaId(\"").append(topiaId); + buffer.append("\");\n"); + // BeanUtils.setProperty(entity123, "property", value123); + buffer.append("BeanUtils.setProperty(entity").append(factorIndex); + buffer.append(", \"").append(property).append("\", "); + buffer.append("value").append(factorIndex).append(");\n"); + } + } + + counter.inc(); + } + } + protected void submit(SimulationJob job) { SimulatorLauncher launcher = job.getLauncher(); // on ajoute a la queue qui utilise le launcher defini dans le job @@ -1128,7 +1236,7 @@ // // Convertion // - CompileHelper.convertToUnicode(fileToConvert); + //CompileHelper.convertToUnicode(fileToConvert); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,44 +30,30 @@ import java.util.Collection; import java.util.List; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.export.SensitivityExport; -import org.apache.commons.beanutils.BeanUtils; +import javax.swing.Box; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.j2r.REngine; import org.nuiton.j2r.RException; import org.nuiton.j2r.RProxy; +import org.nuiton.util.FileUtil; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.export.SensitivityExport; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.util.FileUtil; -import javax.swing.*; - public abstract class AbstractSensitivityCalculator implements SensitivityCalculator { /** to use log facility, just put in your code: log.info("..."); */ private static Log log = LogFactory .getLog(AbstractSensitivityCalculator.class); - - /** Topia context used for discrete domain nominal value compute. */ - protected TopiaContext context; - - /** - * Set topia context on current region to nominal value compute. - * - * @param context context - */ - @Override - public void setTopiaContext(TopiaContext context) { - this.context = context; - } /** * Method to create the isis.factors dataframe in R. @@ -77,7 +63,7 @@ * destination RData file. The RData file will be named directory.RData and * saved in the directory parent. * - * @throws SensitivityException + * @throws SensitivityException if an error occur while talking to R */ public void setIsisFactorsR(DesignPlan plan, File outputdirectory) throws SensitivityException { @@ -101,7 +87,7 @@ "\"Bsup\"=Bsup)"; //Create the vectors - List<Factor<?, ?>> factors = plan.getFactors(); + List<Factor> factors = plan.getFactors(); for (int i = 0; i < factors.size(); i++) { Factor factor = factors.get(i); if (i != 0) { @@ -115,58 +101,25 @@ //Factor names factorNames += "\"" + factor.getName() + "\""; - if (factor.getDomain() instanceof MatrixContinuousDomain) { + if (factor.getDomain() instanceof ContinuousDomain) { //Continu values, binf values, bsup values and discrete factors attributes - nominalValues += getNominalValue(factor); + nominalValues += "\"" + factor.getNominalValue() + "\""; //Continu values continuValues += "TRUE"; //Binf values - binfValues += ((MatrixContinuousDomain) factor.getDomain()) - .getRealMinBound(); - - //Bsup values - bsupValues += ((MatrixContinuousDomain) factor.getDomain()) - .getRealMaxBound(); - - } else if (factor.getDomain() instanceof EquationContinuousDomain) { - //Continu values, binf values, bsup values and discrete factors attributes - - nominalValues += ((EquationContinuousDomain) factor.getDomain()) - .getReferenceValue(); - - //Continu values - continuValues += "TRUE"; - - //Binf values - binfValues += ((EquationContinuousDomain) factor.getDomain()) - .getValueForIdentifier(0.0); - - //Bsup values - bsupValues += ((EquationContinuousDomain) factor.getDomain()) - .getValueForIdentifier(1.0); - } else if (factor.getDomain() instanceof ContinuousDomain) { - //Continu values, binf values, bsup values and discrete factors attributes - - nominalValues += getNominalValue(factor); - - //Continu values - continuValues += "TRUE"; - - //Binf values - binfValues += ((ContinuousDomain) factor.getDomain()) - .getMinBound(); + .getCalculatorMinBound(); //Bsup values bsupValues += ((ContinuousDomain) factor.getDomain()) - .getMaxBound(); + .getCalculatorMaxBound(); } else { - nominalValues += getNominalValue(factor); + nominalValues += factor.getNominalValue(); //Continu values continuValues += "FALSE"; @@ -212,7 +165,7 @@ for (Factor factor:factors) { if (factor.getDomain() instanceof DiscreteDomain) { String attributeValues = "list("; - Collection values = ((DiscreteDomain) factor.getDomain()) + Collection<Object> values = ((DiscreteDomain) factor.getDomain()) .getValues().values(); for (Object j:values) { attributeValues += j + ","; @@ -241,31 +194,6 @@ } - protected String getNominalValue(Factor factor){ - String path = factor.getPath(); - String topiaId = path.substring(0,path.lastIndexOf("#")); - String propertyName=path.substring(path.lastIndexOf("#") + 1); - - Domain domain =factor.getDomain(); - - if (domain instanceof MatrixContinuousDomain){ - return "1.0"; - } - - Object value = null; - try { - TopiaEntity entity = context.findByTopiaId(topiaId); - value = BeanUtils.getProperty(entity, propertyName); - } catch (Exception ee) { - log.error("An error occurred while trying to get nominal value",ee); - } - if (value == null){ - return null; - } - log.info("Nominal value :" + value); - return value.toString(); - } - protected String editRInstruction(String rCall){ JLabel label = new JLabel( "Modifier le code R envoyé si vous le souhaitez"); @@ -283,7 +211,7 @@ return text.getText(); } - protected void testNoDiscrete(List<Factor<?,?>> factors) throws SensitivityException{ + protected void testNoDiscrete(List<Factor> factors) throws SensitivityException{ for (Factor factor:factors) { if (factor.getDomain() instanceof DiscreteDomain) { throw new SensitivityException(factor.getName() + Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -26,14 +26,13 @@ package fr.ifremer.isisfish.simulator.sensitivity; import java.io.Serializable; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import fr.ifremer.isisfish.simulator.sensitivity.visitor.DesignPlanVisitor; /** - * Design plan contenant toutes les - * valeur de facteur possible. + * Design plan contenant toutes les valeurs de facteurs possible. * * @author chatellier * @version $Revision: 1.0 $ @@ -46,44 +45,60 @@ /** serialVersionUID. */ private static final long serialVersionUID = 977975461743758075L; - /** Liste des facteurs a utiliser */ - protected List<Factor<?, ?>> factors; - + /** Groupe de facteur principal du design plan. */ + protected FactorGroup factorGroup; + /** * Constructor. */ public DesignPlan() { - factors = new ArrayList<Factor<?, ?>>(); + factorGroup = new FactorGroup(null); } /** - * Get factors list. + * Get factors list, first level of factor groups (not modifiable). * * @return factors list */ - public List<Factor<?, ?>> getFactors() { - return factors; + public List<Factor> getFactors() { + return Collections.unmodifiableList(factorGroup.getFactors()); } /** - * Set factors list. + * Return design plan main factor group. * - * @param factors the factors list to set + * @return design plan factor group */ - public void setFactors(List<Factor<?, ?>> factors) { - this.factors = factors; + public FactorGroup getFactorGroup() { + return factorGroup; } /** + * Add factor. + * + * @param f factor to add + */ + public void addFactor(Factor f) { + factorGroup.addFactor(f); + } + + /** + * Set factors group. + * + * @param factorGroup main factor group + */ + public void setFactorGroup(FactorGroup factorGroup) { + this.factorGroup = factorGroup; + } + + /** * Accept a new visitor. * * @param visitor */ public void accept(DesignPlanVisitor visitor) { visitor.start(this); - for (Factor<?, ?> factor : factors) { - visitor.visit(this, factor); - } + visitor.visit(this, factorGroup); visitor.end(this); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -40,9 +40,6 @@ * Le domain peut etre : * - discret : i.e un ensemble de valeurs * - continu : i.e, une borne min, max - * - * @param <E> type des valeurs gérées par le domaine - * @param <F> type des labels * * @see DiscreteDomain * @see ContinuousDomain @@ -53,7 +50,7 @@ * Last update : $Date: 24 févr. 2009 $ * By : $Author: chatellier $ */ -public interface Domain<E extends Serializable, F extends Serializable> extends Serializable { +public interface Domain extends Serializable, Cloneable { /** * Return value associated to identifier. @@ -61,20 +58,20 @@ * @param identifier * @return found value or <tt>null</tt> if not found */ - E getValueForIdentifier(F identifier); - + Object getValueForIdentifier(Object identifier); + /** * Accept a new visitor. * * @param visitor */ public void accept(DomainVisitor visitor); - + /** * Clone the domain * * @return the domain cloned */ - - public Domain<E, F> clone(); + public Domain clone(); + } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,6 +25,7 @@ package fr.ifremer.isisfish.simulator.sensitivity; +import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; import java.io.Serializable; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; @@ -34,9 +35,6 @@ /** * Facteur de variation des parametres de simulation. * - * @param <E> type des valeurs gérées par le facteur - * @param <F> type des labels - * * La classe doit être {@link Serializable} avec ses valeurs pour permettre * l'export XML. * @@ -45,7 +43,7 @@ * * Last update : $Date: 19 févr. 2009 $ By : $Author: chatellier $ */ -public class Factor<E extends Serializable, F extends Serializable> implements Serializable, Cloneable { +public class Factor implements Serializable, Cloneable { /** serialVersionUID. */ private static final long serialVersionUID = 1643804268013964453L; @@ -61,23 +59,36 @@ protected String comment; /** + * The identifier used to compute value. + */ + protected Object identifier; + + /** * Domaine du facteur. * * Ensemble des valeurs possibles a prendre en compte. La clé est un label * qui permet d'identifier la valeur. * - * Le domain peut etre : - discret : i.e un ensemble de valeurs - continu : - * i.e, une borne min, max + * Le domain peut etre : + * <ul> + * <li>discret : i.e un ensemble de valeurs</li> + * <li>continu : i.e, une borne min, max</li> + * </ul> * * @see ContinuousDomain * @see DiscreteDomain */ - protected Domain<E,F> domain; + protected Domain domain; /** + * Value that this factor got in the database + */ + protected Object nominalValue; + + /** * Factor value. */ - protected E value; + protected Object value; /** * Path permettant d'identifier l'objet et la propriete de l'objet a mettre @@ -90,22 +101,11 @@ protected String path; /** - * Constructor. - * - * Protected, name is mandatory. - */ - protected Factor() { - - } - - /** * Constructor with name. * - * @param name - * factor name + * @param name factor name */ public Factor(String name) { - this(); this.name = name; } @@ -121,8 +121,7 @@ /** * Set name. * - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -151,17 +150,16 @@ * * @return the domain */ - public Domain<E,F> getDomain() { + public Domain getDomain() { return domain; } /** * Set domain. * - * @param domain - * the domain to set + * @param domain the domain to set */ - public void setDomain(Domain<E,F> domain) { + public void setDomain(Domain domain) { this.domain = domain; } @@ -170,27 +168,41 @@ * * @return the value */ - public E getValue() { + public Object getValue() { return value; } /** + * Get the factor value for displaying (for example in R). + * + * @return the value + */ + public Object getDisplayedValue() { + if (domain instanceof MatrixContinuousDomain) { + return identifier; + } else { + return getValue(); + } + } + + /** * Set value. * - * @param value - * new value + * Unused (or only for test ?). + * + * @param value new value */ - public void setValue(E value) { + public void setValue(Object value) { this.value = value; } /** * Set value for label. * - * @param valueIdentifier - * new value identifier to get + * @param valueIdentifier new value identifier to get */ - public void setValueForIdentifier(F valueIdentifier) { + public void setValueForIdentifier(Object valueIdentifier) { + identifier = valueIdentifier; value = domain.getValueForIdentifier(valueIdentifier); } @@ -214,6 +226,15 @@ this.path = path; } + public Object getNominalValue() { + return nominalValue; + } + + public void setNominalValue(Object nominalValue) { + this.nominalValue = nominalValue; + } + + /** * Accept a new visitor. * @@ -231,19 +252,22 @@ @Override public Object clone() { - Factor<E,F> f = new Factor<E,F>(); - - f.domain = domain.clone(); - f.name = name; - f.path = path; - // FIXME make real clone() for value - f.value = value; + Factor f; + try { + f = (Factor)super.clone(); + if (domain != null) { + f.domain = domain.clone(); + } + } catch (CloneNotSupportedException e) { + throw new RuntimeException("Error on clone()", e); + } + return f; } @Override public String toString() { - return name; + return "Factor : " + name + "(" + comment + ")"; } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,280 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.simulator.sensitivity; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; +import fr.ifremer.isisfish.simulator.sensitivity.visitor.FactorGroupVisitor; + +/** + * Factor group. Used for group screening. + * + * A factor mixed can accept both discrete and continuous factors (used + * for convenience : factor tree root). + * + * A factor group without factors is untyped. + * + * @author chatellier + * @version $Revision$ + * + * @since 3.4.0.0 + * + * Last update : $Date$ + * By : $Author$ + */ +public class FactorGroup extends Factor { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1893573810633639712L; + + /** Factors collection. */ + protected List<Factor> factors; + + protected static class FactorComparator implements Comparator<Factor> { + @Override + public int compare(Factor o1, Factor o2) { + int result = 1; + + if (o1 instanceof FactorGroup) { + if (o2 instanceof FactorGroup) { + result = o1.getName().compareTo(o2.getName()); + } + else { + result = -1; + } + } + else { // factor + if (o2 instanceof Factor) { + result = o1.getName().compareTo(o2.getName()); + } + } + return result; + } + }; + + /** + * Init factor group. + * + * @param name group name + */ + public FactorGroup(String name) { + super(name); + factors = new ArrayList<Factor>(); + } + + /** + * Add all checked factors. + * + * @param allFactors factors to add + */ + public void addAllFactors(List<Factor> allFactors) { + + factors.addAll(allFactors); + + // sort : factor group, by name, and factor by name + Collections.sort(factors, new FactorComparator()); + } + + /** + * Check factor type and add it into factor collection. + * + * @param factor + */ + public void addFactor(Factor factor) { + + factors.add(factor); + + // sort : factor group, by name, and factor by name + Collections.sort(factors, new FactorComparator()); + } + + /* + * Check factor type with other factor collection types. + * + * @param factorsList factors list to check + * @param factor factor to check + * @throws IllegalArgumentException if factor doesn't match other factor type + * + protected void checkFactor(List<Factor> factorsList, Factor factor) { + // basiquement, il doit être du même type que le + // premier element + if (factor.getDomain() == null) { + throw new IllegalArgumentException("Factor domain is null"); + } + + // on va dire, que si c'est le premier, il est du meme + // type que lui meme + if (!factorsList.isEmpty()) { + Factor first = factorsList.get(0); + + // les deux sont discret ou continue + if ((first.getDomain() instanceof DiscreteDomain && !(factor.getDomain() instanceof DiscreteDomain)) || + (first.getDomain() instanceof ContinuousDomain && !(factor.getDomain() instanceof ContinuousDomain))) { + throw new IllegalArgumentException( + "Factor type is not in same type as other factor in group"); + } + } + }*/ + + /** + * Remove single factor. + * + * @param factor factor to remove + */ + public void remove(Factor factor) { + factors.remove(factor); + } + + /** + * Remove factors collection. + * + * @param allFactors factors to remove + */ + public void removeAll(Collection<Factor> allFactors) { + factors.removeAll(allFactors); + } + + /** + * Get groups factors. + * + * @return unmodifiable factors list + */ + public List<Factor> getFactors() { + return Collections.unmodifiableList(factors); + } + + /** + * Clear all factor group sub factors. + */ + public void clearFactors() { + factors.clear(); + } + + /** + * Convenient method to access specific factor. + * + * @param index index + * @return factor at index + */ + public Factor get(int index) { + return factors.get(index); + } + + /** + * Get factor list size. + * + * @return factor list size + */ + public int size() { + return factors.size(); + } + + /** + * Returns the index of the first occurrence of the specified element in this + * group. + * @param o element to search for + * @return the index of the first occurrence of the specified element in this + * group, or -1 if this list does not contain the element + */ + public int indexOf(Object o) { + return factors.indexOf(o); + } + + /** + * Return {@code true} if factor group has at least one factor + * and this factor is discrete. + * + * @return {@code true} if factor group is discrete + */ + public boolean isDiscrete() { + boolean result = false; + if (!factors.isEmpty()) { + Domain domain = factors.get(0).getDomain(); + result = domain instanceof DiscreteDomain; + } + return result; + } + + /** + * Return {@code true} if factor group has at least one factor + * and this factor is continuous. + * + * @return {@code true} if factor group is continuous + */ + public boolean isContinuous() { + boolean result = false; + if (!factors.isEmpty()) { + Domain domain = factors.get(0).getDomain(); + result = domain instanceof ContinuousDomain; + } + return result; + } + + /** + * Return factor group domain depending of factor group type (discrete/continuous). + * + * @return factor group domain + */ + @Override + public Domain getDomain() { + Domain domain = null; + if (isContinuous()) { + domain = new ContinuousDomain(0.0, 1.0); + } + else if (isDiscrete()) { + // les domaines doivent avoir les même domaines + // et pour l'utilisation quand fera l'appelant + // de getDomain(), on peut en retourner un au hazard + domain = factors.get(0).getDomain(); + } + // else pas de factor dans le group + return domain; + } + + /** + * Accept a new visitor. + * + * @param visitor + */ + public void accept(FactorGroupVisitor visitor) { + visitor.start(this); + for (Factor factor : factors) { + visitor.visit(this, factor); + } + visitor.end(this); + } + + @Override + public String toString() { + return "FactorGroup(" + name + ")"; + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -69,8 +69,7 @@ */ public boolean addFactor(Factor factor) { - Factor factorCopy = (Factor) factor - .clone(); + Factor factorCopy = (Factor) factor.clone(); boolean success = factors.add(factorCopy); return success; @@ -93,7 +92,7 @@ public void setFactors(List<Factor> factors) { this.factors = factors; } - + /** * Accept a new visitor. * @@ -101,7 +100,7 @@ */ public void accept(ScenarioVisitor visitor) { visitor.start(this); - for(Factor factor : factors) { + for (Factor factor : factors) { visitor.visit(this, factor); } visitor.end(this); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -28,8 +28,6 @@ import java.io.File; import java.util.List; -import org.nuiton.topia.TopiaContext; - import fr.ifremer.isisfish.datastore.SimulationStorage; /** @@ -46,13 +44,6 @@ public interface SensitivityCalculator { /** - * Set topia context on current region to nominal value compute. - * - * @param context context - */ - void setTopiaContext(TopiaContext context); - - /** * Return calculator description. * * @return calculator description Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,18 +25,25 @@ package fr.ifremer.isisfish.simulator.sensitivity.domain; -import java.io.Serializable; - +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.simulator.sensitivity.Domain; import fr.ifremer.isisfish.simulator.sensitivity.visitor.DomainVisitor; /** - * Domaine continu. - * - * Composé d'un borne min et max. * - * @param <E> type des valeurs gérées par le domaine - * @param <F> type des labels + * All the continuous domains can be of 2 different types (min/max or + * percentage). + * + * A min/max domain can take 2 values : {@link #minBound} and {@link #maxBound}. + * A percentage domain got 2 values {@link #coefficient} and + * {@link #referenceValue} that are the basis to calculate the {@link #minBound} + * and {@link #maxBound} values. + * + * A continuous domain also got a cardinality, either filled in by the user or + * the sensitivity method if it manages it. + * + * To do sensitivity calculations, you MUST use {@link #getCalculatorMinBound()}, + * {@link #getCalculatorMaxBound()}. * * @author chatellier * @version $Revision: 1.0 $ @@ -44,25 +51,34 @@ * Last update : $Date: 24 févr. 2009 $ * By : $Author: chatellier $ */ -public class ContinuousDomain<E extends Serializable, F extends Serializable> implements Domain<E,F> { +public class ContinuousDomain implements Domain { /** serialVersionUID. */ private static final long serialVersionUID = -2037768174807839046L; - /** Borne inférieure */ - protected double minBound; + /** Min value. */ + protected Object minBound; - /** Borne supérieure */ - protected double maxBound; + /** Max value. */ + protected Object maxBound; + /** Value used to create the factor. */ + protected Object referenceValue; + + /** Coefficient in percent */ + protected Double coefficient; + /** Cardinality */ protected int cardinality; + /** Flag to know the type of the domain **/ + protected boolean percentageType; + /** - * Empty constructor. + * Min/max type constructor. */ public ContinuousDomain() { - + this(false); } /** @@ -71,54 +87,168 @@ * @param minBound min bound * @param maxBound max bound */ - public ContinuousDomain(double minBound, double maxBound) { + public ContinuousDomain(Object minBound, Object maxBound) { this(); this.minBound = minBound; this.maxBound = maxBound; } + + /** + * Constructor with type. + * + * @param percentageType if {@code true} percentage type + */ + public ContinuousDomain(boolean percentageType) { + this.percentageType = percentageType; + } + + /** + * Return factor type (min/max or percentage). + * + * @return {@code true} if percentage type + */ + public boolean isPercentageType() { + return percentageType; + } + + /** + * Set domain type (min/max or percentage). + * + * @param percentageType new type value + */ + public void setPercentageType(boolean percentageType) { + this.percentageType = percentageType; + } /** - * @return the minBound + * Return the minimum bound of the domain. Do not use this value for + * sensitivity calculation, prefer using {@link #getCalculatorMinBound}. + * + * @return the minimum bound */ - public double getMinBound() { - return minBound; + public Object getMinBound() { + Object result; + if (isPercentageType()) { + result = ((Double)referenceValue + (((Double)referenceValue * coefficient) * ((2 * getCalculatorMinBound() - 1)))); + } else { + result = minBound; + } + return result; } + + /** + * Return the minimum bound for sensitivity calculators. It always returns 0. + * + * @return the minimum bound for sensitivity analysis. + */ + public double getCalculatorMinBound() { + return 0; + } /** - * @param minBound the minBound to set + * Set the minimum bound of the domain. + * + * @param minBound the minimum bound. */ - public void setMinBound(double minBound) { + public void setMinBound(Object minBound) { this.minBound = minBound; } /** - * @return the maxBound + * Return the maximum bound of the domain. Do not use this value for + * sensitivity calculation, prefer using {@link #getCalculatorMaxBound}. + * + * @return the maximum bound */ - public double getMaxBound() { - return maxBound; + public Object getMaxBound() { + Object result; + if (isPercentageType()) { + result = ((Double) referenceValue + + (((Double) referenceValue * coefficient) + * ((2 * getCalculatorMaxBound() - 1)))); + } else { + result = maxBound; + } + return result; } + + /** + * Return the minimum bound for sensitivity calculators. It always returns 1. + * + * @return the maximum bound for sensitivity analysis. + */ + public double getCalculatorMaxBound() { + return 1; + } /** + * Set max value. + * * @param maxBound the maxBound to set */ - public void setMaxBound(double maxBound) { + public void setMaxBound(Object maxBound) { this.maxBound = maxBound; } + /** - * {@inheritDoc}. + * Get coefficient. * - * In continuous domain, just return identifier + * @return the coefficient */ - public E getValueForIdentifier(F identifier) { - // FIXME test cast - return (E)identifier; + public Double getCoefficient() { + return coefficient; } /** + * Set coefficient. + * + * @param coefficient the coefficient to set + */ + public void setCoefficient(Double coefficient) { + this.coefficient = coefficient; + } + + /** + * Get reference value. + * + * @return the reference value + */ + public Object getReferenceValue() { + return referenceValue; + } + + /** + * Set reference value. + * + * @param referenceValue the reference value.to set + */ + public void setReferenceValue(Object referenceValue) { + this.referenceValue = referenceValue; + } + + /** + * {@inheritDoc}. + */ + public Object getValueForIdentifier(Object identifier) { + + Double result; + + if (isPercentageType()) { + // since 3.4.0.0, operator is always * + result = ((Double)referenceValue + (((Double)referenceValue * coefficient) + * ((2 * (Double)identifier - 1)))); + } else { + result = ((Double)identifier * ((Double)maxBound - (Double)minBound)) + + (Double)minBound; + } + return result; + } + + /** * Accept a new visitor. * - * @param visitor + * @param visitor the visitor */ public void accept(DomainVisitor visitor) { visitor.start(this); @@ -137,17 +267,20 @@ /** * Set cardinality * - * @param cardinality + * @param cardinality the domain cardinality */ public void setCardinality(int cardinality) { this.cardinality = cardinality; } - public ContinuousDomain<E,F> clone(){ - ContinuousDomain<E,F> cloned = new ContinuousDomain<E,F>(); - cloned.setCardinality(this.cardinality); - cloned.setMaxBound(this.maxBound); - cloned.setMinBound(this.minBound); + @Override + public ContinuousDomain clone() { + ContinuousDomain cloned; + try { + cloned = (ContinuousDomain)super.clone(); + } catch (CloneNotSupportedException e) { + throw new IsisFishRuntimeException("Can't clone domain", e); + } return cloned; } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,45 +25,40 @@ package fr.ifremer.isisfish.simulator.sensitivity.domain; -import java.io.Serializable; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.simulator.sensitivity.Domain; import fr.ifremer.isisfish.simulator.sensitivity.visitor.DomainVisitor; /** - * Domain discret. + * Un domain discret a un ensemble de valeur. + * Chaque valeur est identifiée par un label pour sont utilisation par les + * script d'AS. * - * Ensemble de valeurs. - * - * @param <E> type des valeurs gérées par le domaine - * @param <F> type des labels - * * @author chatellier * @version $Revision: 1.0 $ * * Last update : $Date: 24 févr. 2009 $ * By : $Author: chatellier $ */ -public class DiscreteDomain<E extends Serializable, F extends Serializable> implements Domain<E,F> { +public class DiscreteDomain implements Domain { /** serialVersionUID. */ private static final long serialVersionUID = -192647757737396585L; /** * Value for this domain. - * - * Each "E" values is identified by a Serializable identifier. */ - protected SortedMap<F, E> values; - + protected SortedMap<Object, Object> values; + /** * Constructor. */ public DiscreteDomain() { - values = new TreeMap<F, E>(); + values = new TreeMap<Object, Object>(); } /** @@ -71,7 +66,7 @@ * * @return the values */ - public SortedMap<F, E> getValues() { + public SortedMap<Object, Object> getValues() { return values; } @@ -80,7 +75,7 @@ * * @param values the values */ - public void setValues(SortedMap<F, E> values) { + public void setValues(SortedMap<Object, Object> values) { this.values = values; } @@ -89,15 +84,17 @@ * * @throws IllegalArgumentException if identifier is not a valid key */ - public E getValueForIdentifier(F identifier) throws IllegalArgumentException{ - - if( values == null || !values.containsKey(identifier)) { - throw new IllegalArgumentException("Can't get value for identifier " + identifier); + public Object getValueForIdentifier(Object identifier) + throws IllegalArgumentException { + + if (values == null || !values.containsKey(identifier)) { + throw new IllegalArgumentException( + "Can't get value for identifier " + identifier); } - + return values.get(identifier); } - + /** * Accept a new visitor. * @@ -105,16 +102,22 @@ */ public void accept(DomainVisitor visitor) { visitor.start(this); - for(Map.Entry<F, E> value : values.entrySet()) { + for (Map.Entry<Object, Object> value : values.entrySet()) { visitor.visit(this, value.getKey(), value.getValue()); } visitor.end(this); } - - public DiscreteDomain<E,F> clone(){ - DiscreteDomain<E,F> cloned = new DiscreteDomain<E,F>(); - cloned.setValues(this.values); + + @Override + public DiscreteDomain clone() { + DiscreteDomain cloned = null; + try { + cloned = (DiscreteDomain)super.clone(); + // special copy for values + cloned.setValues(new TreeMap<Object, Object>(this.values)); + } catch (CloneNotSupportedException e) { + throw new IsisFishRuntimeException("Can't clone domain", e); + } return cloned; - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -36,8 +36,7 @@ * * Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $ */ -public class EquationContinuousDomain extends - ContinuousDomain<Double,Double> { +public class EquationContinuousDomain extends ContinuousDomain { /** serialVersionUID. */ private static final long serialVersionUID = -2037768174807839046L; @@ -45,31 +44,20 @@ /** Variable name (must be java valid identifier) */ protected String variableName; - /** Operation. (=,+,-,/) */ - protected String operator; - - /** Coefficient in percent */ - protected Double coefficient; - - /** Reference value*/ - protected Double referenceValue; - - /** Value used to create the equation */ - protected Double value; - /** - * Empty constructor. + * Min/max type constructor. */ public EquationContinuousDomain() { - + super(); } - - @Override - public String toString() { - String result = "variableName=" + variableName + " operator=" + operator + - " coefficient=" + coefficient + " referenceValue=" + referenceValue + - " value=" + value; - return result; + + /** + * Constructor with type. + * + * @param percentageType if {@code true} percentage type + */ + public EquationContinuousDomain(boolean percentageType) { + super(percentageType); } /** @@ -84,141 +72,29 @@ /** * Set variable name. * - * @param variableName - * the variableName to set + * @param variableName the variableName to set */ public void setVariableName(String variableName) { this.variableName = variableName; } - - /** - * Get operator. - * - * @return the operator - */ - public String getOperator() { - return operator; - } - - /** - * Set operator. - * - * @param operator - * the operator to set - */ - public void setOperator(String operator) { - this.operator = operator; - } - - /** - * Get coefficient. - * - * @return the coefficient - */ - public Double getCoefficient() { - return coefficient; - } - - /** - * Set coefficient. - * - * @param coefficient the coefficient to set - */ - public void setCoefficient(Double coefficient) { - this.coefficient = coefficient; - } - - /** - * Get reference value. - * - * @return the reference value - */ - public Double getReferenceValue() { - return referenceValue; - } - - /** - * Set reference value. - * - * @param referenceValue the reference value.to set - */ - public void setReferenceValue(Double referenceValue) { - this.referenceValue = referenceValue; - } - /** - * {@inheritDoc}. - * - * In equation continuous domain, always return 0 - */ @Override - public double getMinBound() { - return 0; - } - - /** - * {@inheritDoc}. - * - * In equation continuous domain, always return 1 - */ - @Override - public double getMaxBound() { - return 1; - } - - /** - * {@inheritDoc}. - * - * In equation continuous domain, value appear in continuous domain values - * only. Here : return identifier. - */ - @Override - public Double getValueForIdentifier(Double identifier) { - - this.value = identifier; - - if (operator.equals("+")) { - return ((Double) (referenceValue + ((referenceValue + coefficient) * ((2 * value - 1))))); - } else if (operator.equals("-")) { - return ((Double) (referenceValue + ((referenceValue - coefficient) * ((2 * value - 1))))); - } else if (operator.equals("*")) { - return ((Double) (referenceValue + ((referenceValue * coefficient) * ((2 * value - 1))))); - } else if (operator.equals("/")) { - return ((Double) (referenceValue + ((referenceValue / coefficient) * ((2 * value - 1))))); - } - return identifier; - } - - /** - * Get value used to create the equation. - * - * @return the value - */ - public Double getValue() { - return this.value; - } - - /** - * Set value used to create the equation. - * - * @param value - * the value to set - */ - public void setValue(Double value) { - this.value = value; - } - - public EquationContinuousDomain clone(){ - EquationContinuousDomain cloned = new EquationContinuousDomain(); + public EquationContinuousDomain clone() { + EquationContinuousDomain cloned = (EquationContinuousDomain)super.clone(); cloned.setCardinality(this.cardinality); cloned.setMaxBound(this.maxBound); cloned.setMinBound(this.minBound); cloned.setCoefficient(this.coefficient); - cloned.setOperator(this.operator); - cloned.setValue(this.value); cloned.setReferenceValue(this.referenceValue); cloned.setVariableName(this.variableName); return cloned; } + @Override + public String toString() { + String result = "variableName=" + variableName + + " coefficient=" + coefficient + " referenceValue=" + referenceValue + + " min=" + minBound + "max=" + maxBound; + return result; + } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationDiscreteDomain.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationDiscreteDomain.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationDiscreteDomain.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationDiscreteDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,46 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.simulator.sensitivity.domain; + +import fr.ifremer.isisfish.entities.Equation; + +/** + * Factor domain for {@link Equation}s. + * + * @author chatellier + * @version $Revision$ + * + * @since 3.4.0.0 + * + * Last update : $Date$ + * By : $Author$ + */ +public class EquationDiscreteDomain extends DiscreteDomain { + + /** serialVersionUID. */ + private static final long serialVersionUID = -5611785362638191719L; + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -31,214 +31,102 @@ /** * Domaine continu portant sur une matrice. * - * Composé d'un borne min et max et d'une matrice. - * * @author chatellier * @version $Revision: 1.0 $ * * Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $ */ -public class MatrixContinuousDomain extends ContinuousDomain<MatrixND, Double> { +public class MatrixContinuousDomain extends ContinuousDomain { /** serialVersionUID. */ private static final long serialVersionUID = -2037768174807839046L; - /** Matrix */ - protected MatrixND matrix; - - /** Coefficient. */ - protected double coefficient; - - /** Operation. (=,+,-,/) */ - protected String operator; - - /** Value used to create the matrix */ - protected double value; - /** - * Empty constructor. + * Min/max type constructor. */ public MatrixContinuousDomain() { - + super(); } - + /** - * Get matrix. + * Constructor with type. * - * @return the matrix + * @param percentageType if {@code true} percentage type */ - public MatrixND getMatrix() { - return matrix; + public MatrixContinuousDomain(boolean percentageType) { + super(percentageType); } - /** - * Set matrix. - * - * @param matrix - * the matrix to set - */ - public void setMatrix(MatrixND matrix) { - this.matrix = matrix; + @Override + public Object getValueForIdentifier(Object identifier) { + return getValueForIdentifier((Double)identifier); } - + /** - * @return the coefficient - */ - public double getCoefficient() { - return coefficient; - } - - /** - * @param coefficient - * the coefficient to set - */ - public void setCoefficient(double coefficient) { - this.coefficient = coefficient; - } - - /** - * Get operator. + * In matrix continuous domain, return a new matrix. * - * @return the operator + * @param identifier identifier + * @return a new computed matrix */ - public String getOperator() { - return operator; + public MatrixND getValueForIdentifier(final Double identifier) { + MatrixND temp = ((MatrixND)getReferenceValue()).copy(); + + // since 3.4.0.0, operator is always * + temp.map(new MapFunction() { + public double apply(double val) { + return (val + ((val * coefficient) * ((2 * identifier - 1)))); + } + }); + return temp; } - /** - * Set operator. - * - * @param operator - * the operator to set - */ - public void setOperator(String operator) { - this.operator = operator; - } - - /** - * {@inheritDoc}. - * - * In matrix continuous domain, always return 0 - */ @Override - public double getMinBound() { - return 0; + public MatrixContinuousDomain clone() { + MatrixContinuousDomain cloned = (MatrixContinuousDomain)super.clone(); + return cloned; } /** - * {@inheritDoc}. + * {@inheritDoc} * - * In matrix continuous domain, always return 1 + * @return the minimum bound */ - @Override - public double getMaxBound() { - return 1; - } + public Object getMinBound() { - /** - * {@inheritDoc}. - * - * In continuous domain, just return identifier - */ - public MatrixND getValueForIdentifier(final Double identifier) { - this.value = identifier; - MatrixND temp = this.matrix.copy(); - if (operator.equals("+")) { + if (minBound == null) { + MatrixND temp = ((MatrixND) getReferenceValue()).copy(); + + // since 3.4.0.0, operator is always * temp.map(new MapFunction() { public double apply(double val) { - return (val + ((val + coefficient) * ((2 * value - 1)))); + return (val + ((val * coefficient) * ((2 * getCalculatorMinBound() - 1)))); } }); - } else if (operator.equals("-")) { - temp.map(new MapFunction() { - public double apply(double val) { - return (val + ((val - coefficient) * ((2 * value - 1)))); - } - }); - } else if (operator.equals("*")) { - temp.map(new MapFunction() { - public double apply(double val) { - return (val + ((val * coefficient) * ((2 * value - 1)))); - } - }); - } else if (operator.equals("/")) { - temp.map(new MapFunction() { - public double apply(double val) { - return (val + ((val / coefficient) * ((2 * value - 1)))); - } - }); + return temp; + } else { + return minBound; } - return temp; } /** - * Get value used to create the matrix. + * {@inheritDoc} * - * @return the value + * @return the maximum bound */ - public Double getValue() { - return this.value; - } + public Object getMaxBound() { - /** - * Set value used to create the matrix. - * - * @param value - * the value to set - */ - public void setValue(Double value) { - this.value = value; - } + if (maxBound == null) { + MatrixND temp = ((MatrixND) getReferenceValue()).copy(); - public MatrixContinuousDomain clone() { - MatrixContinuousDomain cloned = new MatrixContinuousDomain(); - cloned.setCardinality(this.cardinality); - cloned.setMaxBound(this.maxBound); - cloned.setMinBound(this.minBound); - cloned.setCoefficient(this.coefficient); - cloned.setMatrix(this.matrix); - cloned.setOperator(this.operator); - cloned.setValue(this.value); - return cloned; - } - - /** - * Get the minimum bound of the coefficient used to create the matrix. As - * the getMinBound for use in R always return 0. - * - * @return the real minimum bound - */ - public Double getRealMinBound() { - if (operator.equals("+")) { - return (1.0 + ((1.0 + coefficient) * ((2 * 0.0 - 1)))); - } else if (operator.equals("-")) { - return (1.0 + ((1.0 - coefficient) * ((2 * 0.0 - 1)))); - } else if (operator.equals("*")) { - return (1.0 + ((1.0 * coefficient) * ((2 * 0.0 - 1)))); - } else if (operator.equals("/")) { - return (1.0 + ((1.0 / coefficient) * ((2 * 0.0 - 1)))); + // since 3.4.0.0, operator is always * + temp.map(new MapFunction() { + public double apply(double val) { + return (val + ((val * coefficient) * ((2 * getCalculatorMaxBound() - 1)))); + } + }); + return temp; } else { - return null; + return maxBound; } } - - /** - * Get the maximal bound of the coefficient used to create the matrix. As - * the getMaxBound for use in R always return 1. - * - * @return the real maximum bound - */ - public Double getRealMaxBound() { - if (operator.equals("+")) { - return (1.0 + ((1.0 + coefficient) * ((2 * 1.0 - 1)))); - } else if (operator.equals("-")) { - return (1.0 + ((1.0 - coefficient) * ((2 * 1.0 - 1)))); - } else if (operator.equals("*")) { - return (1.0 + ((1.0 * coefficient) * ((2 * 1.0 - 1)))); - } else if (operator.equals("/")) { - return (1.0 + ((1.0 / coefficient) * ((2 * 1.0 - 1)))); - } else { - return null; - } - } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDiscreteDomain.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDiscreteDomain.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDiscreteDomain.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDiscreteDomain.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,46 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.simulator.sensitivity.domain; + +import fr.ifremer.isisfish.rule.Rule; + +/** + * Factor domain for {@link Rule}s. + * + * @author chatellier + * @version $Revision$ + * + * @since 3.4.0.0 + * + * Last update : $Date$ + * By : $Author$ + */ +public class RuleDiscreteDomain extends DiscreteDomain { + + /** serialVersionUID. */ + private static final long serialVersionUID = -5611785362638191719L; + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -26,7 +26,7 @@ package fr.ifremer.isisfish.simulator.sensitivity.visitor; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; /** * DesignPlan visitor. @@ -50,9 +50,9 @@ * Visit factor. * * @param designPlan design plan - * @param factor factor + * @param factorGroup factor group */ - void visit(DesignPlan designPlan, Factor factor); + void visit(DesignPlan designPlan, FactorGroup factorGroup); /** * End. Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,8 +25,6 @@ package fr.ifremer.isisfish.simulator.sensitivity.visitor; -import java.io.Serializable; - import fr.ifremer.isisfish.simulator.sensitivity.Domain; /** @@ -45,22 +43,21 @@ * * @param domain domain */ - void start(Domain<? extends Serializable, ? extends Serializable> domain); + void start(Domain domain); /** * Visit domain value or property. * - * @param <E> domain element type * @param domain domain * @param label value label or property name * @param value value */ - <E extends Serializable, F extends Serializable> void visit(Domain<E,F> domain, F label, E value); + void visit(Domain domain, Object label, Object value); /** * End. * * @param domain domain */ - void end(Domain<? extends Serializable, ? extends Serializable> domain); + void end(Domain domain); } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorGroupVisitor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorGroupVisitor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorGroupVisitor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorGroupVisitor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,63 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.simulator.sensitivity.visitor; + +import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; + +/** + * Factor group visitor. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public interface FactorGroupVisitor { + + /** + * Start. + * + * @param factorGroup factorGroup + */ + void start(FactorGroup factorGroup); + + /** + * Visit domain. + * + * @param factorGroup factorGroup + * @param factor factor + */ + void visit(FactorGroup factorGroup, Factor factor); + + /** + * End. + * + * @param factorGroup factorGroup + */ + void end(FactorGroup factorGroup); +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/RangeOfValues.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/RangeOfValues.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/RangeOfValues.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -45,12 +45,17 @@ /** serialVersionUID. */ private static final long serialVersionUID = 1L; - static final public String [] TYPES = new String[]{"String", "Integer", "Float"}; + public static final String TYPE_STRING = "String"; + public static final String TYPE_INTEGER = "Integer"; + public static final String TYPE_FLOAT = "Float"; + + static final public String [] TYPES = new String[]{TYPE_STRING, TYPE_INTEGER, TYPE_FLOAT}; + static public String [] getPossibleTypes() { return TYPES; } - protected String type = "String"; + protected String type = TYPE_STRING; protected boolean continueRange = false; protected String values = ""; protected List possibleValues = null; @@ -196,7 +201,7 @@ return result; } - /* (non-Javadoc) + /* * @see java.lang.Object#toString() */ @Override @@ -206,5 +211,3 @@ } } - - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -44,7 +44,6 @@ import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.engine.SessionImplementor; -import org.hibernate.lob.ClobImpl; import org.hibernate.type.Type; import org.hibernate.usertype.CompositeUserType; @@ -362,7 +361,7 @@ switch (property) { case 0 : return matrix.getName(); case 1 : return matrix.getDim(); - case 2 : return matrix.getDimensionName(); + case 2 : return matrix.getDimensionNames(); case 3 : return matrix.getSemantics(); case 4 : return matrix.toList(); default : throw new HibernateException("Property index invalid : " + property); @@ -374,11 +373,11 @@ switch (property) { case 0 : matrix.setName((String)value); break; case 1 : throw new HibernateException("Modification of the dimension forbidden"); - case 2 : matrix.setDimensionName((String[])value); break; + case 2 : matrix.setDimensionNames((String[])value); break; case 3 : int index = 0; for (List semantics : (List[])value) { - matrix.setSemantics(index, semantics); + matrix.setSemantic(index, semantics); index++; } break; @@ -407,9 +406,9 @@ List datas = MatrixHelper.convertStringToList(datasAsString); matrix = MatrixFactory.getInstance().create(name, dim); - matrix.setDimensionName(dimNames); + matrix.setDimensionNames(dimNames); for (int i=0; i<semantics.length; i++) { - matrix.setSemantics(i, semantics[i]); + matrix.setSemantic(i, semantics[i]); } matrix.fromList(datas); session.getPersistenceContext(); @@ -423,14 +422,17 @@ st.setString(index + 1, null); st.setString(index + 2, null); st.setString(index + 3, null); - st.setClob(index + 4, new ClobImpl("")); + // 3.3.2 : st.setClob(index + 4, new ClobImpl("")); + st.setClob(index + 4, Hibernate.createClob("")); + } else { MatrixND matrix = MatrixFactory.getInstance().create((MatrixND)value); st.setString(index, matrix.getName()); st.setString(index + 1, getDimToString(matrix.getDim())); - st.setString(index + 2, getDimNamesToString(matrix.getDimensionName())); + st.setString(index + 2, getDimNamesToString(matrix.getDimensionNames())); st.setString(index + 3, getSemanticsToString(matrix.getSemantics())); - st.setClob(index + 4, new ClobImpl(matrix.toList().toString())); + // 3.3.2 : st.setClob(index + 4, new ClobImpl()); + st.setClob(index + 4, Hibernate.createClob(matrix.toList().toString())); } } @@ -439,7 +441,7 @@ return new Serializable[] { matrix.getName(), getDimToString(matrix.getDim()), - getDimNamesToString(matrix.getDimensionName()), + getDimNamesToString(matrix.getDimensionNames()), getSemanticsToString(matrix.getSemantics()), matrix.toList().toString() }; @@ -453,9 +455,9 @@ List[] semantics = getSemanticsFromString(name, (String)o[3], session); List datas = MatrixHelper.convertStringToList((String)o[4]); MatrixND matrix = MatrixFactory.getInstance().create(name, dim); - matrix.setDimensionName(dimNames); + matrix.setDimensionNames(dimNames); for (int i=0; i<semantics.length; i++) { - matrix.setSemantics(i, semantics[i]); + matrix.setSemantic(i, semantics[i]); } matrix.fromList(datas); return matrix; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/ApplicationMonitorUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/ApplicationMonitorUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/ApplicationMonitorUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,32 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2006 - 2010 Ifremer, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-2.0.html>. - #L% - --> -<JFrame visible="true" size='{new Dimension(400,400)}' title="isisfish.monitor.title" - layout='{new BorderLayout()}'> - <org.nuiton.widget.ApplicationMonitor - smtpServer="fr.ifremer.isisfish.IsisConfig.getSmtpServer()" - emailFrom="fr.ifremer.isisfish.IsisConfig.getUserMail()" - emailTo="fr.ifremer.isisfish.IsisConfig.BUG_REPORT_EMAIL" - /> -</JFrame> Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,113 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2006 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; - -/** - * Welcome.java - * - * Created: 22 août 2006 10:50:49 - * - * @author poussin - * @version $Revision: 1302 $ - * - * Last update: $Date: 2008-08-18 15:42:57 +0200 (Mon, 18 Aug 2008) $ - * by : $Author: bpoussin $ - * - * @deprecated (since 20091414) use xxxAction class instead) - */ -public class Common { - - /** Class logger. */ - private static Log log = LogFactory.getLog(Common.class); - - /** - * Return regions. - * - * @return regions - */ - public static Object[] getRegionItem() { - List<String> regionNames = new ArrayList<String>(); - - // FIXME chatellier : Ajout d'une entrée vide pour forcer la sélection - // et que le changement lance un evenement sur la liste - regionNames.add(" "); - - regionNames.addAll(RegionStorage.getRegionNames()); - Object[] result = regionNames.toArray(); - return result; - } - - /** - * Return old simulations. - * - * @return old simulations - */ - public static Object[] getOldSimulationItem() { - - //try { - List<String> oldSimul = new ArrayList<String>(); - - //FilterModel<SimulationProperties, String> filterModel; - // keep in context list of old simulation names (for filter process) - oldSimul.addAll(SimulationStorage.getSimulationNames()); - - // TODO filering disabled since it's read all simulation - // TODO can take more than 20m with a lot of simulations... - - // create filter model - //filterModel = SimulationFilterUtil.createFilterModel(oldSimul); - // to used directly model.getFilteredResult() in xml - // we must fill filterModel result with original items - //filterModel.selectAll(); - Object[] result = oldSimul.toArray(); - - // FIXME chatellier : Ajout d'une entrée vide pour forcer la sélection - // et que le changement lance un evenement sur la liste - oldSimul.add(0, " "); - - return result; - /*} catch (ParseException ex) { - if (log.isErrorEnabled()) { - log.error("Can't get old simulations", ex); - } - } catch (IOException ex) { - if (log.isErrorEnabled()) { - log.error("Can't get old simulations", ex); - } - } - return null;*/ - } - -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/CommonHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,69 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXUtil; +import fr.ifremer.isisfish.ui.WelcomePanelUI; + +/** + * Common action for all handler. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class CommonHandler { + + /** + * Set main application status bar context. + * + * @param context context + * @param s string to set + */ + protected void setStatusMessage(JAXXContext context, String s) { + WelcomePanelUI root = context.getContextValue(WelcomePanelUI.class, JAXXUtil.PARENT); + if (root != null) { + root.setStatusMessage(s); + } + } + + /** + * Set main application status bar context. + * + * @param context context + * @param s string to set + * @param running enable progress bar running state + */ + protected void setStatusMessage(JAXXContext context, String s, boolean running) { + WelcomePanelUI root = context.getContextValue(WelcomePanelUI.class, JAXXUtil.PARENT); + if (root != null) { + root.setStatusMessage(s, running); + } + } +} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Help.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Help.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Help.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,101 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/* *##% - * Copyright (C) 2006 - 2009 - * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ - -package fr.ifremer.isisfish.ui; - -import java.awt.Desktop; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Help. - * - * Created: 2 août 2006 10:53:43 - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class Help { - - /** Class logger. */ - private static Log log = LogFactory.getLog(Help.class); - - // URL alias - public static Map<String, String> URLSALIAS = new HashMap<String, String>(); - - static { - URLSALIAS.put("ISISFISH", "http://isis-fish.labs.libre-entreprise.org/"); - URLSALIAS.put("JAVA_API", "http://java.sun.com/javase/6/docs/api/index.html"); - URLSALIAS.put("ISIS_API", "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/index.html"); - URLSALIAS.put("MATRIX_API", "http://maven-site.nuiton.org/nuiton-matrix/apidocs/index.html"); - URLSALIAS.put("TOPIA_API", "http://maven-site.nuiton.org/topia/topia-persistence/apidocs/index.html"); - } - - /** - * Open url using default system browser. - * - * @param urlOrAlias url alias, or full url - */ - public static void showURL(String urlOrAlias) { - try { - String url = URLSALIAS.get(urlOrAlias); - - if (url == null) { - url = urlOrAlias; - } - - Desktop.getDesktop().browse(new URL(url).toURI()); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't show help", e); - } - } - } -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/NavigationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,27 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2010 - 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JPanel layout='{new BorderLayout()}'> + +</JPanel> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SaveVerifier.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,115 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2010 - 2011 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 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JPanel layout='{new BorderLayout()}' abstract="true"> + <import> + fr.ifremer.isisfish.ui.simulator.SimulAction; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + javax.swing.JFileChooser + java.io.File + </import> + + <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null" /> + + <script><![CDATA[ + + protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_REGION_STORAGE, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + regionStorageChanged(); + } + }); + } + + /** + * Refresh all simulation launch UI. + */ + protected abstract void regionStorageChanged(); + + /** + * Refresh all simulation launch UI. + */ + protected abstract void refresh(); + + /** + * Set selected tab to parameters tab. + */ + public abstract void selectParametersTab(); + + /** + * Change prescript tab enabled property. + */ + public abstract void setEnabledPrescriptTab(boolean selected); + + /** + * Change analyse plan tab enabled property. + */ + public abstract void setEnabledAnalysePlanTab(boolean selected); + + /** + * Open user dialog to selected a parameter file. + * Reload it, and call {@link refresh()}. + */ + protected void importSimulation() { + JFileChooser fc = new JFileChooser(); + int returnVal = fc.showOpenDialog(this); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + //This is where a real application would open the file. + getContextValue(SimulAction.class).importSimulation(file); + refresh(); + } + } + + /** + * Save current parameter in user selected parameter output file. + */ + public void saveSimulation() { + JFileChooser fc = new JFileChooser(); + int returnVal = fc.showSaveDialog(this); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + //This is where a real application would open the file. + getContextValue(SimulAction.class).saveSimulation(file); + } + } + + /** + * Rafraichit l'arbre des facteurs. + */ + public void refreshFactorTree() { + + } + ]]></script> + <JMenuBar constraints='BorderLayout.NORTH'> + <JMenu text="isisfish.simulation.menu.simulation"> + <JMenuItem id="miSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/> + <JMenuItem id="miImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/> + </JMenu> + </JMenuBar> + <JTabbedPane id="bodyTabbedPane" constraints='BorderLayout.CENTER'/> +</JPanel> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/StatusBarUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/StatusBarUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/StatusBarUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -59,7 +59,7 @@ toolTipText="Stop the process" /> </cell> --> <cell fill="both"> - <org.nuiton.widget.StatusBar /> + <jaxx.runtime.swing.StatusMessagePanel /> </cell> </row> </Table> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,334 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.ToolTipManager; + +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.swing.editor.config.ConfigUI; +import jaxx.runtime.swing.editor.config.ConfigUIHelper; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.widget.AboutFrame; + +import fr.ifremer.isisfish.IsisConfig; +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.ui.config.RConfigHandler; +import fr.ifremer.isisfish.ui.config.RConfigUI; +import fr.ifremer.isisfish.ui.config.SSHLauncherConfigUI; +import fr.ifremer.isisfish.ui.input.InputAction; +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; +import fr.ifremer.isisfish.ui.input.InputUI; +import fr.ifremer.isisfish.ui.queue.QueueUI; +import fr.ifremer.isisfish.ui.result.ResultUI; +import fr.ifremer.isisfish.ui.script.ScriptUI; +import fr.ifremer.isisfish.ui.sensitivity.SensitivitySaveVerifier; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; +import fr.ifremer.isisfish.ui.simulator.SimulAction; +import fr.ifremer.isisfish.ui.simulator.SimulUI; +import fr.ifremer.isisfish.ui.vcs.VCSConfigUI; + +/** + * Welcome related ui handler. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class WelcomeHandler extends CommonHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(WelcomeHandler.class); + + protected Map<JFrame, WelcomePanelUI> allFrameOpened; + protected WelcomeSaveVerifier verifier = new WelcomeSaveVerifier(); + + // URL alias + protected static final Map<String, String> URLSALIAS = new HashMap<String, String>(); + + static { + URLSALIAS.put("ISISFISH", "http://isis-fish.labs.libre-entreprise.org/"); + URLSALIAS.put("JAVA_API", "http://java.sun.com/javase/6/docs/api/index.html"); + URLSALIAS.put("ISIS_API", "http://isis-fish.labs.libre-entreprise.org/isis-fish/apidocs/index.html"); + URLSALIAS.put("MATRIX_API", "http://maven-site.nuiton.org/nuiton-matrix/apidocs/index.html"); + URLSALIAS.put("TOPIA_API", "http://maven-site.nuiton.org/topia/topia-persistence/apidocs/index.html"); + } + + public void postInit(WelcomeUI welcomeUI) { + welcomeUI.setContextValue(verifier); + allFrameOpened = new java.util.HashMap<JFrame, WelcomePanelUI>(); + welcomeUI.getWelcomePanelUI().setContent(new WelcomeTabUI(new JAXXInitialContext().add(verifier))); + + // increase tooltip display time + ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); + toolTipManager.setInitialDelay(0); + toolTipManager.setDismissDelay(60000); + } + + protected void openFrame(WelcomeUI welcomeUI, Component c, String title) { + + JAXXInitialContext childContext = new JAXXInitialContext().add(verifier).add(this); + WelcomePanelUI welcome = new WelcomePanelUI(childContext); + welcome.setContent(c); + + JFrame frame = new JFrame(title); + frame.setLayout(new BorderLayout()); + frame.add(welcome, BorderLayout.CENTER); + frame.setSize(new Dimension(800, 600)); + frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + + allFrameOpened.put(frame, welcome); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + JFrame f = (JFrame) e.getSource(); + allFrameOpened.get(f).close(f); + } + }); + frame.setLocationRelativeTo(welcomeUI); + frame.setVisible(true); + } + + /** + * + * @param welcomeUI + */ + public void newSimulationFrame(WelcomeUI welcomeUI) { + JAXXInitialContext context = new JAXXInitialContext(); + context.add(new SimulAction()); + context.add(this); + SimulUI simulUI = new SimulUI(context); + openFrame(welcomeUI, simulUI, _("isisfish.simulation.title")); + } + + /** + * + * @param welcomeUI + */ + public void newResultFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new ResultUI(), _("isisfish.result.title")); + } + + /** + * + * @param welcomeUI + */ + public void newInputFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new InputUI(new JAXXInitialContext().add(verifier).add(new InputAction()).add(new InputSaveVerifier()).add(this)), _("isisfish.input.title")); + } + + /** + * + * @param welcomeUI + */ + public void newScriptFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new ScriptUI(), _("isisfish.script.title")); + } + + /** + * + * @param welcomeUI + */ + public void newSensitivityFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new SensitivityUI(new JAXXInitialContext().add(new InputAction()).add(new SensitivitySaveVerifier()).add(new SimulAction()).add(this)), _("isisfish.sensitivity.title")); + } + + /** + * + * @param welcomeUI + */ + public void newQueueFrame(WelcomeUI welcomeUI) { + openFrame(welcomeUI, new QueueUI(), _("isisfish.queue.title")); + } + + /** + * + * @param welcomeUI parent ui + */ + public void close(WelcomeUI welcomeUI) { + if (verifier.allIsSaved()) { + welcomeUI.dispose(); + } + } + + /** + * + * @param welcomeUI parent ui + */ + public void updateVCS(WelcomeUI welcomeUI) { + // FIXME a reimplanter + // thread:Welcome.updateVCS() + } + + /** + * Show config frame. + * + * @param welcomeUI parent ui + */ + public void config(WelcomeUI welcomeUI) { + ConfigUIHelper modelBuilder = new ConfigUIHelper(IsisFish.config); + + // category main + modelBuilder.addCategory(_("isisfish.config.category.main"), _("isisfish.config.category.main.description")); + modelBuilder.addOption(IsisConfig.Option.CONFIG_FILE); + modelBuilder.addOption(IsisConfig.Option.DATABASE_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.COMMUNITY_DATABASE_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.COMPILATION_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.MONITORING_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.JAVADOC_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.BACKUP_DIRECTORY); + modelBuilder.addOption(IsisConfig.Option.LOCALE); + modelBuilder.addOption(IsisConfig.Option.SIMULATION_SHOW_ONLY_ERROR); + + // category database vcs + modelBuilder.addCategory(_("isisfish.config.category.officialvcs"), _("isisfish.config.category.officialvcs.description")); + modelBuilder.addOption(IsisConfig.Option.VCS_TYPE); + modelBuilder.addOption(IsisConfig.Option.VCS_PROTOCOL); + modelBuilder.addOption(IsisConfig.Option.VCS_HOST_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_PATH); + modelBuilder.addOption(IsisConfig.Option.VCS_USER_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_USER_PASSWORD); + + // category community vcs + modelBuilder.addCategory(_("isisfish.config.category.communityvcs"), _("isisfish.config.category.communityvcs.description")); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_TYPE); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_PROTOCOL); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_HOST_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_PATH); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_USER_NAME); + modelBuilder.addOption(IsisConfig.Option.VCS_COMMUNITY_PASSWORD); + + // category misc + modelBuilder.addCategory(_("isisfish.config.category.misc"), _("isisfish.config.category.misc.description")); + modelBuilder.addOption(IsisConfig.Option.SSH_KEY_FILE); + modelBuilder.addOption(IsisConfig.Option.USER_NAME); + modelBuilder.addOption(IsisConfig.Option.SMTP_SERVER); + modelBuilder.addOption(IsisConfig.Option.USER_MAIL); + + ConfigUI configUI = modelBuilder.buildUI(welcomeUI, _("isisfish.config.category.main")); + JDialog dialogUI = new JDialog(welcomeUI, _("isisfish.config.title")); + dialogUI.add(configUI); + dialogUI.pack(); + dialogUI.setLocationRelativeTo(welcomeUI); + dialogUI.setVisible(true); + } + + /** + * Display VCS config ui. + * + * @param welcomeUI parent ui + */ + public void configVCS(WelcomeUI welcomeUI) { + VCSConfigUI vcsConfig = new VCSConfigUI(welcomeUI, welcomeUI); + vcsConfig.pack(); + vcsConfig.setLocationRelativeTo(welcomeUI); + vcsConfig.setVisible(true); + } + + /** + * Display ssh launcher config ui. + * + * @param welcomeUI parent ui + */ + public void configurationSSHLauncher(WelcomeUI welcomeUI) { + SSHLauncherConfigUI configUI = new SSHLauncherConfigUI(welcomeUI, welcomeUI); + configUI.pack(); + configUI.setSize(600, configUI.getHeight()); + configUI.setLocationRelativeTo(welcomeUI); + configUI.setVisible(true); + } + + /** + * Display R config tester UI. + * + * @param welcomeUI parent ui + */ + public void configurationR(WelcomeUI welcomeUI) { + RConfigUI rconfigUI = new RConfigUI(welcomeUI, welcomeUI); + RConfigHandler handler = rconfigUI.getHandler(); + handler.init(rconfigUI); + rconfigUI.pack(); + rconfigUI.setLocationRelativeTo(welcomeUI); + rconfigUI.setVisible(true); + } + + /** + * Open url using default system browser. + * + * @param welcomeUI parent ui + * @param urlOrAlias url alias, or full url + */ + public void help(WelcomeUI welcomeUI, String urlOrAlias) { + try { + String url = URLSALIAS.get(urlOrAlias); + + if (url == null) { + url = urlOrAlias; + } + + Desktop.getDesktop().browse(new URL(url).toURI()); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't show help", e); + } + } + } + + /** + * Show about frame from nuiton-widgets. + * + * @param welcomeUI parent ui + */ + public void about(WelcomeUI welcomeUI) { + AboutFrame about = new AboutFrame(); + about.setTitle(_("isisfish.about.title")); + about.setIconPath("images/strategy.jpg"); + about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion())); + about.setLicenseText(_("isisfish.about.licensetext")); + about.setBackgroundColor(Color.WHITE); + about.setSize(640, 520); + about.setLocationRelativeTo(welcomeUI); + about.setVisible(true); + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomePanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomePanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomePanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,17 +29,17 @@ return getContextValue(WelcomeSaveVerifier.class); } - public void setContent(Component c) { + public void setContent(java.awt.Component c) { this.add(c, BorderLayout.CENTER); } - public void close(JFrame f) { + public void close(javax.swing.JFrame f) { if (getVerifier().allIsSaved()) { exit(f); } } - protected void exit(JFrame f) { + protected void exit(javax.swing.JFrame f) { f.dispose(); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,13 +23,16 @@ #L% --> <JPanel layout='{new BorderLayout()}'> + <import> + fr.ifremer.isisfish.ui.simulator.SimulAction + jaxx.runtime.context.JAXXInitialContext + fr.ifremer.isisfish.ui.input.InputAction + fr.ifremer.isisfish.ui.input.InputSaveVerifier + fr.ifremer.isisfish.ui.sensitivity.SensitivitySaveVerifier + javax.swing.ImageIcon + </import> + <script><![CDATA[ - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.ui.result.ResultAction; - import jaxx.runtime.JAXXInitialContext; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; - /** Change tab selection. */ public void setQueueTabSelection() { simulTabs.setSelectedIndex(5); @@ -52,10 +55,10 @@ </tab> <tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/sensitivities.gif"))}'> <fr.ifremer.isisfish.ui.sensitivity.SensitivityUI id="sensitivityUI" - constructorParams='new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(new SimulAction()).add(this)' /> + constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivitySaveVerifier()).add(new SimulAction()).add(this)' /> </tab> <tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/calc.gif"))}'> - <fr.ifremer.isisfish.ui.result.ResultView /> + <fr.ifremer.isisfish.ui.result.ResultUI /> </tab> <tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/bookPage.gif"))}'> <fr.ifremer.isisfish.ui.script.ScriptUI /> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2006 - 2010 Ifremer, Code Lutin + Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,201 +23,46 @@ #L% --> <JFrame title="isisfish.welcome.title" width='874' height='736' resizable="true" layout='{new BorderLayout()}'> - <script><![CDATA[ - import static org.nuiton.i18n.I18n._; - import javax.swing.JFrame; - import fr.ifremer.isisfish.IsisFish; - import fr.ifremer.isisfish.IsisConfig; - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.ui.input.InputUI; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; - import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; - import fr.ifremer.isisfish.ui.result.ResultAction; - import fr.ifremer.isisfish.ui.result.ResultView; - import fr.ifremer.isisfish.ui.script.ScriptUI; - import fr.ifremer.isisfish.ui.simulator.SimulUI; - import fr.ifremer.isisfish.ui.queue.QueueUI; - import fr.ifremer.isisfish.ui.config.SSHLauncherConfigUI; - import fr.ifremer.isisfish.ui.vcs.VCSConfigUI; - import org.nuiton.widget.AboutFrame; - import jaxx.runtime.DefaultJAXXContext; - import jaxx.runtime.JAXXInitialContext; - import jaxx.runtime.swing.editor.config.ConfigUI; - import jaxx.runtime.swing.editor.config.ConfigUIBuilder; - import jaxx.runtime.swing.editor.config.model.ConfigUIModel; + <WelcomeHandler id="handler" /> - Map<JFrame, WelcomePanelUI> allFrameOpened; - WelcomeSaveVerifier verifier = new WelcomeSaveVerifier(); - - setContextValue(verifier); - allFrameOpened = new java.util.HashMap<JFrame, WelcomePanelUI>(); - welcomePanelUI.setContent(new WelcomeTabUI(new JAXXInitialContext().add(getVerifier()))); - - // increase tooltip display time - ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); - toolTipManager.setInitialDelay(0); - toolTipManager.setDismissDelay(60000); - - protected void openFrame(Component c, String title) { - JFrame f = new JFrame(); - f.setLayout(new BorderLayout()); - - JAXXInitialContext childContext = new JAXXInitialContext().add(verifier).add(this); - WelcomePanelUI welcome = new WelcomePanelUI(childContext); - - welcome.setContent(c); - f.add(welcome, BorderLayout.CENTER); - f.setTitle(title); - f.setSize(new Dimension(800, 600)); - f.setDefaultCloseOperation(f.DO_NOTHING_ON_CLOSE); - - allFrameOpened.put(f, welcome); - f.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - JFrame f = (JFrame) e.getSource(); - allFrameOpened.get(f).close(f); - } - }); - org.nuiton.widget.SwingUtil.center(f); - f.setVisible(true); + <script><![CDATA[ + protected void $afterCompleteSetup() { + getHandler().postInit(this); } - public void close() { - if (verifier.allIsSaved()) { - exit(); - } - } - protected void exit() { - this.dispose(); - IsisFish.quit(); - } - protected WelcomeSaveVerifier getVerifier() { - return getContextValue(WelcomeSaveVerifier.class); - } - protected void monitorUI() { - new ApplicationMonitorUI(); - } - protected void updateVCS() { -// FIXME a reimplanter -// thread:Welcome.updateVCS() - } - - /** - * Show config frame (Jaxx based). - */ - protected void config() { - ConfigUIModel model = new ConfigUIModel(IsisFish.config); - - // categorie main - model.addCategory( - _("isisfish.config.category.main"), - _("isisfish.config.category.main.description"), - IsisConfig.Option.CONFIG_FILE, - IsisConfig.Option.DATABASE_DIRECTORY, - IsisConfig.Option.COMPILATION_DIRECTORY, - IsisConfig.Option.MONITORING_DIRECTORY, - IsisConfig.Option.JAVADOC_DIRECTORY, - IsisConfig.Option.BACKUP_DIRECTORY, - IsisConfig.Option.LOCALE, - IsisConfig.Option.SIMULATION_SHOW_ONLY_ERROR - ); - - // categorie versionning - model.addCategory( - _("isisfish.config.category.versioning"), - _("isisfish.config.category.versioning.description"), - IsisConfig.Option.VCS_TYPE, - IsisConfig.Option.VCS_PROTOCOL, - IsisConfig.Option.VCS_USER_NAME, - IsisConfig.Option.VCS_USER_PASSWORD, - IsisConfig.Option.VCS_HOST_NAME, - IsisConfig.Option.VCS_PATH - ); - - // categorie misc - model.addCategory( - _("isisfish.config.category.misc"), - _("isisfish.config.category.misc.description"), - IsisConfig.Option.SSH_KEY_FILE, - IsisConfig.Option.USER_NAME, - IsisConfig.Option.SMTP_SERVER, - IsisConfig.Option.USER_MAIL - ); - - ConfigUI configUI = ConfigUIBuilder.newConfigUI(new DefaultJAXXContext(this), model, _("isisfish.config.category.main")); - ConfigUIBuilder.showConfigUI(configUI, this, false); - } - - protected void configVCS() { - VCSConfigUI vcsConfig = new VCSConfigUI(); - vcsConfig.pack(); - org.nuiton.widget.SwingUtil.center(vcsConfig); - vcsConfig.setVisible(true); - } - - protected void configurationSSHLauncher() { - SSHLauncherConfigUI configUI = new SSHLauncherConfigUI(); - configUI.pack(); - configUI.setSize(600, configUI.getHeight()); - org.nuiton.widget.SwingUtil.center(configUI); - configUI.setVisible(true); - } - - protected void help(String urlAlias) { - Help.showURL(urlAlias); - } - - /** - * Show about frame from nuiton-widgets. - */ - protected void about() { - AboutFrame about = new AboutFrame(); - about.setTitle(_("isisfish.about.title")); - about.setIconPath("images/strategy.jpg"); - about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion())); - about.setLicenseText(_("isisfish.about.licensetext")); - about.setBackgroundColor(Color.WHITE); - about.setSize(640, 520); - org.nuiton.widget.SwingUtil.center(about); - about.setVisible(true); - } - ]]> - </script> + ]]></script> <JMenuBar> <JMenu text='isisfish.welcome.menu.file'> - <JMenuItem text="isisfish.welcome.menu.synchro" enabled='false' onActionPerformed='updateVCS()'/> + <JMenuItem text="isisfish.welcome.menu.synchro" enabled='false' onActionPerformed='getHandler().updateVCS(this)'/> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.close" onActionPerformed='close()'/> + <JMenuItem text="isisfish.welcome.menu.close" onActionPerformed='getHandler().close(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.frame"> - <JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='openFrame(new SimulUI(new JAXXInitialContext().add(new SimulAction()).add(this)), _("isisfish.simulation.title"))'/> - <JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='openFrame(new ResultView(), _("isisfish.result.title"))'/> - <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new JAXXInitialContext().add(verifier).add(new InputAction()).add(new InputSaveVerifier()).add(this)), _("isisfish.input.title"))'/> - <JMenuItem text="isisfish.welcome.menu.script" onActionPerformed='openFrame(new ScriptUI(), _("isisfish.script.title"))'/> - <JMenuItem text="isisfish.sensitivity.title" onActionPerformed='openFrame(new SensitivityUI(new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(new SimulAction()).add(this)), _("isisfish.sensitivity.title"))'/> + <JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='getHandler().newSimulationFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='getHandler().newResultFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='getHandler().newInputFrame(this)'/> + <JMenuItem text="isisfish.welcome.menu.script" onActionPerformed='getHandler().newScriptFrame(this)'/> + <JMenuItem text="isisfish.sensitivity.title" onActionPerformed='getHandler().newSensitivityFrame(this)'/> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='openFrame(new QueueUI(), _("isisfish.queue.title"))'/> + <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='getHandler().newQueueFrame(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.configuration"> - <JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='config()'/> - <JMenuItem text="isisfish.welcome.menu.configuration.vcs" onActionPerformed='configVCS()' enabled="false"/> - <JMenuItem text="isisfish.welcome.menu.configuration.sshlauncher" onActionPerformed='configurationSSHLauncher()'/> + <JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='getHandler().config(this)'/> + <JMenuItem text="isisfish.welcome.menu.configuration.vcs" onActionPerformed='getHandler().configVCS(this)' enabled="false"/> + <JMenuItem text="isisfish.welcome.menu.configuration.sshlauncher" onActionPerformed='getHandler().configurationSSHLauncher(this)'/> + <JMenuItem text="isisfish.welcome.menu.configuration.r" onActionPerformed='getHandler().configurationR(this)'/> </JMenu> <JMenu text="isisfish.welcome.menu.help"> - <JMenuItem text="isisfish.welcome.menu.help.isisfish" onActionPerformed='help("ISISFISH")'/> + <JMenuItem text="isisfish.welcome.menu.help.isisfish" onActionPerformed='getHandler().help(this, "ISISFISH")'/> <JMenu text="isisfish.welcome.menu.api"> - <JMenuItem text="isisfish.welcome.menu.help.javaapi" onActionPerformed='help("JAVA_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.isisfishapi" onActionPerformed='help("ISIS_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.matrixapi" onActionPerformed='help("MATRIX_API")'/> - <JMenuItem text="isisfish.welcome.menu.help.topiaapi" onActionPerformed='help("TOPIA_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.javaapi" onActionPerformed='getHandler().help(this, "JAVA_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.isisfishapi" onActionPerformed='getHandler().help(this, "ISIS_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.matrixapi" onActionPerformed='getHandler().help(this, "MATRIX_API")'/> + <JMenuItem text="isisfish.welcome.menu.help.topiaapi" onActionPerformed='getHandler().help(this, "TOPIA_API")'/> </JMenu> <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.monitor" onActionPerformed='monitorUI()'/> - <JSeparator/> - <JMenuItem text="isisfish.welcome.menu.about" onActionPerformed='about()'/> + <JMenuItem text="isisfish.welcome.menu.about" onActionPerformed='getHandler().about(this)'/> </JMenu> </JMenuBar> - <WelcomePanelUI id="welcomePanelUI" constructorParams='new DefaultJAXXContext(this)'/> + <WelcomePanelUI id="welcomePanelUI" constructorParams='this'/> </JFrame> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,121 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.config; + +import static org.nuiton.i18n.I18n._; + +import java.awt.Color; +import java.io.File; + +import javax.swing.JOptionPane; + +import org.apache.commons.lang.StringUtils; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RException; +import org.nuiton.j2r.RProxy; + +/** + * Handler for R Configuration UI. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RConfigHandler { + + /** + * Initialise l'ui. + * + * @param rconfigUI ui to init + */ + public void init(RConfigUI rconfigUI) { + String rHome = System.getenv("R_HOME"); + rconfigUI.getRHomeField().setText(rHome); + if (StringUtils.isBlank(rHome)) { + rconfigUI.getRHomeField().setBackground(Color.RED); + } + + String rType = System.getProperty("R.type"); + rconfigUI.getRTypeField().setText(rType); + if (!"net".equals(rType) && !"jni".equals(rType)) { + rconfigUI.getRTypeField().setBackground(Color.RED); + } + + // sur windows c'est potentielement ca + // sur linux, c'est pas possible + String systemPath = System.getenv("PATH"); + String rBinPath = rHome + File.separator + "bin"; + if (systemPath.contains(rBinPath)) { + rconfigUI.getSystemPathField().setText(_("isisfish.simulator.configuration.r.systempathok", rBinPath)); + } + else { + rconfigUI.getSystemPathField().setBackground(Color.RED); + rconfigUI.getSystemPathField().setText(_("isisfish.simulator.configuration.r.systempathnok", rBinPath)); + } + rconfigUI.getSystemPathField().setToolTipText(systemPath); + } + + /** + * Test r configuration. + * + * @param rconfigUI + */ + public void testRCOnfiguration(RConfigUI rconfigUI) { + REngine engine = null; + try { + engine = new RProxy(); + + boolean error = false; + try { + engine.eval("library('lhs')"); + } + catch (RException ex) { + JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.lhsnotinstalled"), + _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE); + error = true; + } + try { + engine.eval("library('sensitivity')"); + } + catch (RException ex) { + JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.sensitivitynotinstalled"), + _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE); + error = true; + } + + if (!error) { + JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.testok"), + _("isisfish.simulator.configuration.r.title"), JOptionPane.INFORMATION_MESSAGE); + } + } + catch (RException ex) { + JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.cantinit", ex.getMessage()), + _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE); + } + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,68 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JDialog title="isisfish.simulator.configuration.r.title" layout="{new BorderLayout()}"> + <RConfigHandler id="handler" /> + <Table constraints="BorderLayout.CENTER"> + <row> + <cell columns="2"> + <JLabel text="isisfish.simulator.configuration.r.details" /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.simulator.configuration.r.rhome" /> + </cell> + <cell weightx="1.0" fill='horizontal'> + <JTextField id="rHomeField" editable="false" /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.simulator.configuration.r.rtype" /> + </cell> + <cell fill='horizontal'> + <JTextField id="rTypeField" editable="false" /> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.simulator.configuration.r.systempath" /> + </cell> + <cell fill='horizontal'> + <JTextField id="systemPathField" editable="false" /> + </cell> + </row> + <row> + <cell columns="2" anchor='center'> + <JPanel> + <JButton text="isisfish.simulator.configuration.r.launchtest" + onActionPerformed="getHandler().testRCOnfiguration(this)" /> + <JButton text="isisfish.common.close" + onActionPerformed="dispose()" /> + </JPanel> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric + * 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 @@ -46,7 +46,6 @@ import com.jcraft.jsch.Session; import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.ui.input.InputAction; import fr.ifremer.isisfish.util.ssh.InvalidPassphraseException; import fr.ifremer.isisfish.util.ssh.SSHAgent; import fr.ifremer.isisfish.util.ssh.SSHException; @@ -65,7 +64,7 @@ public class SSHLauncherConfigAction { /** Class logger. */ - private static Log log = LogFactory.getLog(InputAction.class); + private static Log log = LogFactory.getLog(SSHLauncherConfigAction.class); protected SSHLauncherConfigUI configUI; @@ -319,15 +318,13 @@ if (log.isErrorEnabled()) { log.error("Can't connect", e); } - setTestMessage(_( - "isisfish.simulator.ssh.configuration.connectionerror", e + setTestMessage(_("isisfish.simulator.ssh.configuration.connectionerror", e .getMessage()), true); } catch (SSHException e) { if (log.isErrorEnabled()) { log.error("Can't connect", e); } - setTestMessage(_( - "isisfish.simulator.ssh.configuration.connectionerror", e + setTestMessage(_("isisfish.simulator.ssh.configuration.connectionerror", e .getMessage()), true); } catch (InvalidPassphraseException e) { if (log.isErrorEnabled()) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,7 +23,7 @@ #L% --> <JDialog resizable="false" title="isisfish.simulator.ssh.configuration.title" - layout="{new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS)}"> + layout="{new javax.swing.BoxLayout(this.getContentPane(), javax.swing.BoxLayout.PAGE_AXIS)}"> <SSHLauncherConfigAction id="action" javaBean="new SSHLauncherConfigAction(this)" /> <Boolean id="connected" javaBean="false" /> @@ -33,7 +33,7 @@ // fill default values getAction().resetSSHConfiguration(); - ]]></script> + ]]></script> <Table border='{BorderFactory.createTitledBorder(_("isisfish.simulator.ssh.configuration.connection"))}' fill='horizontal'> @@ -187,7 +187,7 @@ <row fill='horizontal'> <cell columns="2" fill='horizontal'> <JLabel id='messageLabel' text=' ' font-weight='bold' opaque='true' horizontalAlignment='center' - minimumSize='{new Dimension(0, 25)}' preferredSize='{new Dimension(0, 25)}' border='{BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)}' /> + minimumSize='{new java.awt.Dimension(0, 25)}' preferredSize='{new java.awt.Dimension(0, 25)}' border='{BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)}' /> </cell> </row> <row fill='horizontal'> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,99 +22,98 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Cell'> <!-- bean property --> - <fr.ifremer.isisfish.entities.CellImpl id='bean' javaBean='null'/> - + <fr.ifremer.isisfish.entities.Cell id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.n_ + java.awt.event.MouseEvent; + fr.ifremer.isisfish.entities.Cell; + com.bbn.openmap.gui.Tool; + com.bbn.openmap.gui.OMToolSet; + com.bbn.openmap.event.SelectMouseMode; + fr.ifremer.isisfish.map.CellSelectionLayer; + 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[ -import java.awt.event.MouseEvent; -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.CellImpl; -import com.bbn.openmap.gui.Tool; -import com.bbn.openmap.gui.OMToolSet; -import com.bbn.openmap.event.SelectMouseMode; -import fr.ifremer.isisfish.map.CellSelectionLayer; -import fr.ifremer.isisfish.map.CopyMapToClipboardListener; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; +protected OMToolSet toolSet = new OMToolSet(); -protected OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; boolean cellChanged = true; -setButtonTitle(_("isisfish.input.continueZones")); -setNextPath("$root/$zones"); -cellMap.addMapMouseListener(getMapListener()); -// add copy to clipboard support -cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); -toolSet.setupListeners(cellMap); -toolMap.add((Tool)toolSet); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueZones")); + setNextPath(n_("isisfish.input.tree.zones")); -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldCellName.setText(""); - fieldCellLatitude.setText(""); - fieldCellLongitude.setText(""); - fieldCellComment.setText(""); - fieldCellLand.setSelected(false); + 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; } - if (evt.getNewValue() != null) { + }; + // add copy to clipboard support + cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); + toolSet.setupListeners(cellMap); + toolMap.add((Tool)toolSet); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldCellName.setText(""); + fieldCellLatitude.setText(""); + fieldCellLongitude.setText(""); + fieldCellComment.setText(""); + fieldCellLand.setSelected(false); + } + if (evt.getNewValue() != null) { + cellChanged = false; + jaxx.runtime.SwingUtil.fillComboBox(fieldCell, getFisheryRegion().getCell(), getBean()); + cellChanged = true; + } } - } -}); + }); +} - at Override -public void refresh() { - Cell cell = getVerifier().getEntity(Cell.class); - +/*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((CellImpl) cell); + setBean(cell); // reload region in map refreshRegionInMap(cellMap); - - cellChanged = false; - jaxx.runtime.SwingUtil.fillComboBox(fieldCell, getRegion().getCell(), getBean()); - cellChanged = true; -} +}*/ - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - -protected OpenMapEvents getMapListener() { - if (mapListener == null){ - mapListener = new OpenMapEvents(cellMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - boolean result = false; - // TODO a fixer, le clic droit du menu contextuel - // passe aussi par ici et change la selection - //if (e.getButton() == MouseEvent.BUTTON1) { - for (Cell c : cellMap.getSelectedCells()) { - if (getBean() != null) { - if (!c.getTopiaId().equals(getBean().getTopiaId())) { - jaxx.runtime.SwingUtil.fillComboBox(fieldCell,getRegion().getCell(), c); - result = true; - } - } - } - //} - return result; - } - }; - } - return mapListener; -} - -protected void fieldCellChanged() { - if (cellChanged) { +protected void fieldCellChanged(ItemEvent event) { + if (cellChanged && event.getStateChange() == ItemEvent.SELECTED) { Cell c = (Cell)fieldCell.getSelectedItem(); if (c==null) { return; @@ -129,81 +128,91 @@ // on ne sais jamais de quel type est le parent InputUI inputUI = getParentContainer(InputUI.class); if (inputUI != null) { - inputUI.setTreeSelection("$root/$cells/" + c.getTopiaId()); + inputUI.getHandler().setTreeSelection(this, c.getTopiaId()); } else { SensitivityTabUI sensitivityTabUI = getParentContainer(SensitivityTabUI.class); - sensitivityTabUI.setTreeSelection("$root/$cells/"+c.getTopiaId()); + sensitivityTabUI.getHandler().setTreeSelection(this, c.getTopiaId()); } } } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JSplitPane constraints='BorderLayout.CENTER' - oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> + <JPanel id="body"> + <JSplitPane constraints='BorderLayout.CENTER' oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> <Table> <row> <cell fill='horizontal' columns='2' weightx='1.0'> - <JComboBox id="fieldCell" onActionPerformed='fieldCellChanged()' model='{new DefaultComboBoxModel()}'/> + <JComboBox id="fieldCell" onItemStateChanged='fieldCellChanged(event)' + model='{new DefaultComboBoxModel()}' enabled='{getBean() != null}'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.name" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.name" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> <JTextField id="fieldCellName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' decorator='boxed' - onKeyReleased='getBean().setName(fieldCellName.getText())' enabled='{isActif()}'/> + onKeyReleased='getBean().setName(fieldCellName.getText())' enabled='{isActive()}'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.latitude" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.latitude" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLatitude" text='{getBean().getLatitude()}' editable="false" enabled='{isActif()}' decorator='boxed'/> + <JTextField id="fieldCellLatitude" text='{String.valueOf(getBean().getLatitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.longitude" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.longitude" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellLongitude" text='{getBean().getLongitude()}' editable="false" enabled='{isActif()}' decorator='boxed'/> + <JTextField id="fieldCellLongitude" text='{String.valueOf(getBean().getLongitude())}' editable="false" enabled='{isActive()}' decorator='boxed'/> </cell> </row> <row> <cell> - <JLabel text="isisfish.cell.land" enabled='{isActif()}'/> + <JLabel text="isisfish.cell.land" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActif()}' selected='{getBean().getLand()}' decorator='boxed'/> + <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActive()}' selected='{getBean().getLand()}' decorator='boxed'/> </cell> </row> <row> <cell columns='2' fill='horizontal'> - <JLabel text="isisfish.cell.comments" enabled='{isActif()}' horizontalAlignment="center"/> + <JLabel text="isisfish.cell.comments" enabled='{isActive()}' horizontalAlignment="center"/> </cell> </row> <row> <cell columns='2' fill='both' weighty='1.0' weightx='1.0'> <JScrollPane> - <JTextArea id="fieldCellComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldCellComment.getText())' enabled='{isActif()}' decorator='boxed'/> + <JTextArea id="fieldCellComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldCellComment.getText())' enabled='{isActive()}' decorator='boxed'/> </JScrollPane> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' text='isisfish.common.save' decorator='boxed'/> + <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' text='isisfish.common.cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' selectionMode="1" selectedCells='{getBean()}' fisheryRegion='{getRegion()}' constraints='BorderLayout.CENTER' decorator='boxed'/> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + constraints='BorderLayout.NORTH' decorator='boxed' enabled='{getBean() != null}' /> + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" + fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()}' + constraints='BorderLayout.CENTER' decorator='boxed' enabled='{getBean() != null}'/> </JPanel> </JSplitPane> </JPanel> Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ChangeModel.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ChangeModel.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ChangeModel.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ChangeModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,108 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +/** + * Cette classe est utilisé pour conservé un etat de changement + * dans une UI, dans les cas ou les beans changent sur les validateurs et + * que l'etat change du validateur est reset. + * + * Elle permet aussi de se bind directement dessus (PCS); + * + * Cela permet en gros d'agregger plusieurs validateurs. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ChangeModel { + + public static final String PROPERTY_CHANGED = "changed"; + + public static final String PROPERTY_VALID = "valid"; + + protected boolean changed; + + protected boolean valid = true; + + /** + * If {@code true} true, {@link #isChanged()} will always return true. + */ + protected boolean stayChanged = false; + + protected PropertyChangeSupport support; + + public ChangeModel() { + support = new PropertyChangeSupport(this); + } + + public boolean isChanged() { + return changed || stayChanged; + } + + public void setChanged(boolean changed) { + boolean oldValue = this.changed; + this.changed = changed; + support.firePropertyChange(PROPERTY_CHANGED, oldValue, this.changed); + } + + public boolean isValid() { + return valid; + } + + public void setValid(boolean valid) { + boolean oldValue = this.valid; + this.valid = valid; + support.firePropertyChange(PROPERTY_VALID, oldValue, this.valid); + } + + public void setStayChanged(boolean stayChanged) { + boolean oldValue = isChanged(); + this.stayChanged = stayChanged; + support.firePropertyChange(PROPERTY_CHANGED, oldValue, isChanged()); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + support.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + support.removePropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + support.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + support.removePropertyChangeListener(propertyName, listener); + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,73 +22,100 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.EffortDescriptionImpl id='effortDescription' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - <script><![CDATA[ -import java.util.ArrayList; -import fr.ifremer.isisfish.entities.EffortDescription; -import fr.ifremer.isisfish.entities.EffortDescriptionImpl; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.types.TimeUnit; -import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListModel; -import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListRenderer; + <fr.ifremer.isisfish.entities.EffortDescription id='effortDescription' javaBean='null'/> -addPropertyChangeListener("effortDescription", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldEffortDescriptionFishingOperation.setText(""); - fieldEffortDescriptionFishingOperationDuration.setText(""); - fieldEffortDescriptionGearsNumberPerOperation.setText(""); - fieldEffortDescriptionCrewSize.setText(""); - fieldEffortDescriptionUnitCostOfFishing.setText(""); - fieldEffortDescriptionFixedCrewSalary.setText(""); - fieldEffortDescriptionCrewFoodCost.setText(""); - fieldEffortDescriptionCrewShareRate.setText(""); - fieldEffortDescriptionRepairAndMaintenanceGearCost.setText(""); - fieldEffortDescriptionLandingCosts.setText(""); - fieldEffortDescriptionOtherRunningCost.setText(""); - } - if (evt.getNewValue() != null) { + <import> + 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(""); + } + } + } + }); +} - at Override -public void refresh() { - SetOfVessels setOfVessels = getVerifier().getEntity(SetOfVessels.class); +/*public void refresh() { + SetOfVessels setOfVessels = getSaveVerifier().getEntity(SetOfVessels.class); // twice event for jaxx bindings detection setBean(null); - setBean((SetOfVesselsImpl) setOfVessels); + setBean(setOfVessels); +}*/ - EffortDescriptionListModel model = new EffortDescriptionListModel(); - // getBean().getPossibleMetiers() can be null at region creation - if (getBean() != null && getBean().getPossibleMetiers() != null) { - java.util.List<EffortDescription> effortDescriptions = new ArrayList<EffortDescription>(getBean().getPossibleMetiers()); - model.setEffortDescriptions(effortDescriptions); - } - fieldEffortDescriptionEffortDescriptionList.setModel(model); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - protected void effortDescriptionSelectionChanged() { - EffortDescriptionImpl selectedEffort = (EffortDescriptionImpl)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); + EffortDescription selectedEffort = (EffortDescription)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); setEffortDescription(selectedEffort); if (getEffortDescription() != null) { - getVerifier().addCurrentEntity(getEffortDescription()); - + getSaveVerifier().addCurrentEntity(getEffortDescription()); + selectedEffort.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + changeModel.setStayChanged(true); + } + }); + /* NumberEditor is not working fieldEffortDescriptionFishingOperation.init(); fieldEffortDescriptionGearsNumberPerOperation.init(); @@ -104,185 +131,193 @@ } ]]> </script> - <Table> - <row> - <cell rows='3' fill='both' weightx='0.4' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" - onValueChanged='effortDescriptionSelectionChanged()' - cellRenderer='{new EffortDescriptionListRenderer()}' - enabled='{isActif()}' /> - </JScrollPane> - </cell> - <cell columns='2' fill='both' weightx='1.0'> - <Table border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.effortTitle"))}'> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionFishingOperation' constructorParams='this' - bean='{getEffortDescription()}' property='fishingOperation' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"FishingOperation"'/--> - <JFormattedTextField id="fieldEffortDescriptionFishingOperation" text='{getEffortDescription().getFishingOperation()}' - onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FishingOperation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldEffortDescriptionFishingOperationDuration" - text='{getEffortDescription().getFishingOperationDuration() == null ? "" : getEffortDescription().getFishingOperationDuration().getHour()}' - toolTipText="isisfish.effortDescription.fishingOperationDuration.tooltip" onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(3600 * Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FishingOperationDuration"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldEffortDescriptionGearsNumberPerOperation' constructorParams='this' - bean='{getEffortDescription()}' property='gearsNumberPerOperation' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"GearsNumberPerOperation"'/--> - <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{getEffortDescription().getGearsNumberPerOperation()}' - onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"GearsNumberPerOperation"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='1.0'> - <Table anchor='north' fill='both' weighty='1.0' border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.economicTitle"))}'> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewSize" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewSize' constructorParams='this' - bean='{getEffortDescription()}' property='crewSize' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewSize"'/--> - <JTextField id="fieldEffortDescriptionCrewSize" text='{getEffortDescription().getCrewSize()}' - onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewSize"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionUnitCostOfFishing' constructorParams='this' - bean='{getEffortDescription()}' property='unitCostOfFishing' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"UnitCostOfFishing"'/--> - <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{getEffortDescription().getUnitCostOfFishing()}' - onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"UnitCostOfFishing"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionFixedCrewSalary' constructorParams='this' - bean='{getEffortDescription()}' property='fixedCrewSalary' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"FixedCrewSalary"'/--> - <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{getEffortDescription().getFixedCrewSalary()}' - onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"FixedCrewSalary"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewFoodCost' constructorParams='this' - bean='{getEffortDescription()}' property='crewFoodCost' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewFoodCost"'/--> - <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{getEffortDescription().getCrewFoodCost()}' - onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewFoodCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionCrewShareRate' constructorParams='this' - bean='{getEffortDescription()}' property='crewShareRate' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"CrewShareRate"'/--> - <JTextField id="fieldEffortDescriptionCrewShareRate" text='{getEffortDescription().getCrewShareRate()}' - onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"CrewShareRate"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionRepairAndMaintenanceGearCost' constructorParams='this' - bean='{getEffortDescription()}' property='repairAndMaintenanceGearCost' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' - _method='"RepairAndMaintenanceGearCost"' useSign='true'/--> - <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{getEffortDescription().getRepairAndMaintenanceGearCost()}' - onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"RepairAndMaintenanceGearCost"'/> - </cell> - </row> - <row> - <cell anchor='east' fill='none' weighty='0.0'> - <JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0' weighty='0.0'> - <!--NumberEditor id='fieldEffortDescriptionLandingCosts' constructorParams='this' - bean='{getEffortDescription()}' property='landingCosts' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"LandingCosts"'/--> - <JTextField id="fieldEffortDescriptionLandingCosts" text='{getEffortDescription().getLandingCosts()}' - onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"LandingCosts"'/> - </cell> - </row> - <row> - <cell anchor='northeast' fill='none' weighty='1.0'> - <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActif()}'/> - </cell> - <cell anchor='north' fill='horizontal' weightx='1.0' weighty='1.0'> - <!--NumberEditor id='fieldEffortDescriptionOtherRunningCost' constructorParams='this' - bean='{getEffortDescription()}' property='otherRunningCost' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{EffortDescriptionImpl.class}' _method='"OtherRunningCost"'/--> - <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{getEffortDescription().getOtherRunningCost()}' - onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{EffortDescriptionImpl.class}' _method='"OtherRunningCost"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.3'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell rows='3' fill='both' weightx='0.4' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" + onValueChanged='effortDescriptionSelectionChanged()' + cellRenderer='{new EffortDescriptionListRenderer()}' + enabled='{isActive()}' /> + </JScrollPane> + </cell> + <cell columns='2' fill='both' weightx='1.0'> + <Table border='{BorderFactory.createTitledBorder(_("isisfish.effortDescription.effortTitle"))}'> + <row> + <cell anchor='east'> + <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{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(_("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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,22 +22,30 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + <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[ -import java.util.ArrayList; -import fr.ifremer.isisfish.entities.EffortDescription; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.ui.input.setofvessels.MetierListModel; -import fr.ifremer.isisfish.ui.input.setofvessels.MetierListRenderer; -import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListModel; -import fr.ifremer.isisfish.ui.input.setofvessels.EffortDescriptionListRenderer; - /** * Get input action from context. */ @@ -45,35 +53,33 @@ return getContextValue(InputAction.class); } - at Override -public void refresh() { - SetOfVessels setOfVessels = getVerifier().getEntity(SetOfVessels.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((SetOfVesselsImpl) setOfVessels); - - // fill available metier list - MetierListModel metierModel = (MetierListModel)fieldEffortDescriptionMetierList.getModel(); - if (getBean() != null) { - metierModel.setMetiers(getRegion().getMetier()); - } - else { - metierModel.setMetiers(null); - } - setEffortDescriptionEffortDescriptionList(); -} + setBean(setOfVessels); +}*/ - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - protected void onFieldEffortDescriptionMetierListValueChanged() { // active le bouton seulement si l'interface est active // dans le cas de sensitivity par exemple - if (isActif()) { + if (isActive()) { buttonEffortDescriptionAdd.setEnabled(fieldEffortDescriptionMetierList.getSelectedIndex() != -1); } } @@ -81,7 +87,7 @@ protected void onFieldEffortDescriptionEffortDescriptionListValueChanged() { // active le bouton seulement si l'interface est active // dans le cas de sensitivity par exemple - if (isActif()) { + if (isActive()) { removeEffortDescriptionButton.setEnabled(fieldEffortDescriptionEffortDescriptionList.getSelectedIndex() != -1); } } @@ -113,42 +119,50 @@ } ]]> </script> - <Table> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionMetierList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - model='{new MetierListModel()}' cellRenderer='{new MetierListRenderer()}' - onValueChanged='onFieldEffortDescriptionMetierListValueChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='addEffortDescriptions()' enabled='false' - decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='removeEffortDescriptionButton' text="isisfish.common.remove" onActionPerformed='removeEffortDescriptions()' - enabled='false' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - cellRenderer='{new EffortDescriptionListRenderer()}' - onValueChanged='onFieldEffortDescriptionEffortDescriptionListValueChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionMetierList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + model='{new MetierListModel()}' cellRenderer='{new MetierListRenderer()}' + onValueChanged='onFieldEffortDescriptionMetierListValueChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='addEffortDescriptions()' enabled='false' + decorator='boxed' /> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='removeEffortDescriptionButton' text="isisfish.common.remove" onActionPerformed='removeEffortDescriptions()' + enabled='false' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + cellRenderer='{new EffortDescriptionListRenderer()}' + onValueChanged='onFieldEffortDescriptionEffortDescriptionListValueChanged()' enabled='{isActive()}' decorator='boxed' /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,36 +22,32 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JDialog id="EquationEditorPane" modal="true" title="isisfish.equation.editor.title" width="400" height="400"> +<JDialog id="EquationEditorPane" modal="true" title="isisfish.equation.editor.title" + width="400" height="400" layout="{new BorderLayout()}" + modalityType="{Dialog.ModalityType.APPLICATION_MODAL}"> - <script><![CDATA[ -import fr.ifremer.isisfish.util.CompileHelper; -import fr.ifremer.isisfish.util.EvaluatorHelper; -import org.nuiton.util.FileUtil; -import javax.swing.text.html.HTMLEditorKit; -import javax.swing.text.html.HTMLDocument; -import javax.swing.event.HyperlinkListener; -import javax.swing.text.html.HTMLFrameHyperlinkEvent; -import javax.swing.event.HyperlinkEvent; -import java.io.PrintWriter; -import java.io.StringWriter; + <Boolean id="resultOk" javaBean="false" /> -boolean ok = false; + <import> + fr.ifremer.isisfish.util.CompileHelper; + fr.ifremer.isisfish.util.EvaluatorHelper; + org.nuiton.util.FileUtil; + javax.swing.text.html.HTMLEditorKit; + javax.swing.text.html.HTMLDocument; + javax.swing.event.HyperlinkListener; + javax.swing.text.html.HTMLFrameHyperlinkEvent; + javax.swing.event.HyperlinkEvent; + java.io.PrintWriter; + java.io.StringWriter; + java.awt.Color + java.awt.Desktop + </import> + + <script><![CDATA[ Class javaInterface = null; -setModalityType(Dialog.ModalityType.APPLICATION_MODAL); -doc.setEditable(false); -doc.setEditorKit(new HTMLEditorKit()); -doc.addHyperlinkListener(createHyperLinkListener()); - -editor.setAskIfNotSaved(false); - -checkWindow.setEditable(false); - -split.setDividerLocation(0.8) - -public boolean isOk() { - return ok; +protected void $afterCompleteSetup() { + split.setDividerLocation(0.8); } public void setEquation(String category, String name, Class javaInterface, String content) throws Exception { @@ -60,93 +56,86 @@ getEditor().open(FileUtil.getTempFile(content, ".java")); } - public HyperlinkListener createHyperLinkListener() { - return new HyperlinkListener() { - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - if (e instanceof HTMLFrameHyperlinkEvent) { - ((HTMLDocument)doc.getDocument()).processHTMLFrameHyperlinkEvent( - (HTMLFrameHyperlinkEvent)e); - } else { - try { - if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { - Desktop.getDesktop().browse(e.getURL().toURI()); - } else { - doc.setPage(e.getURL()); - } - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Error for : " + e.getURL(), ex); - } - } - } +public void docEditorHyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if (e instanceof HTMLFrameHyperlinkEvent) { + ((HTMLDocument)doc.getDocument()).processHTMLFrameHyperlinkEvent( + (HTMLFrameHyperlinkEvent)e); + } else { + try { + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + Desktop.getDesktop().browse(e.getURL().toURI()); + } else { + doc.setPage(e.getURL()); } + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Error for : " + e.getURL(), ex); + } } - }; + } } +} - public void check() { +public void check() { + try { + String content = editor.getText(); + + StringWriter result = new StringWriter(); + PrintWriter out = new PrintWriter(result); + int compileResult = 0; try { - String content = editor.getText(); - - StringWriter result = new StringWriter(); - PrintWriter out = new PrintWriter(result); - int compileResult = 0; - try { - compileResult = EvaluatorHelper.check(javaInterface, content, out); - } catch (Exception eee) { - compileResult = -1; - } - - out.flush(); - if (compileResult != 0) { - checkWindow.setText(result.toString()); - checkWindow.setBackground(Color.red); - } else { - checkWindow.setText("Compilation Ok"); - checkWindow.setBackground(Color.white); - } - - } catch(Exception e){ - log.error("Can't check script", e); + compileResult = EvaluatorHelper.check(javaInterface, content, out); + } catch (Exception eee) { + compileResult = -1; } + + out.flush(); + if (compileResult != 0) { + checkWindow.setText(result.toString()); + checkWindow.setBackground(Color.RED); + } else { + checkWindow.setText("Compilation Ok"); + checkWindow.setBackground(Color.WHITE); + } + + } catch(Exception e){ + log.error("Can't check script", e); } +} ]]></script> - <Table weightx="1"> - <row> - <cell columns='4' weighty="1" fill='both'> - <JScrollPane> - <JEditorPane id="doc"/> - </JScrollPane> - </cell> - </row> - - <row columns='4' weighty="5" fill='both'> - <cell> - <JSplitPane id='split' orientation='vertical' oneTouchExpandable='true' resizeWeight='0.8'> - <org.nuiton.widget.editor.Editor id="editor"/> - <JScrollPane> - <JEditorPane id="checkWindow"/> - </JScrollPane> - </JSplitPane> - </cell> - </row> - - <row fill='horizontal'> - <cell> - <JButton text='isisfish.common.check' onActionPerformed='check()'/> - </cell> - <cell> - <JButton id='okButton' text='isisfish.common.ok' onActionPerformed='ok=true; setVisible(false)'/> - </cell> - <cell> - <JButton id='cancelButton' text='isisfish.common.cancel' onActionPerformed='setVisible(false)'/> - </cell> - <cell> - </cell> - </row> - - </Table> + <Table constraints="BorderLayout.CENTER"> + <row> + <cell columns='3' weighty="1" fill='both'> + <JScrollPane> + <JEditorPane id="doc" editable="false" editorKit="{new HTMLEditorKit()}" + onHyperlinkUpdate="docEditorHyperlinkUpdate(event)" /> + </JScrollPane> + </cell> + </row> + <row columns='3' weightx="1" weighty="5" fill='both'> + <cell> + <JSplitPane id='split' orientation='vertical' + oneTouchExpandable='true' resizeWeight='0.8'> + <org.nuiton.widget.editor.Editor id="editor" askIfNotSaved="false" /> + <JScrollPane> + <JTextArea id="checkWindow" editable="false" /> + </JScrollPane> + </JSplitPane> + </cell> + </row> + <row fill='horizontal'> + <cell> + <JButton text='isisfish.common.check' onActionPerformed='check()' /> + </cell> + <cell weightx="1" fill="none" anchor="east"> + <JButton id='okButton' text='isisfish.common.ok' onActionPerformed='setResultOk(true); setVisible(false)' /> + </cell> + <cell anchor="east"> + <JButton id='cancelButton' text='isisfish.common.cancel' onActionPerformed='setVisible(false)' /> + </cell> + </row> + </Table> </JDialog> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,68 +22,70 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='FisheryRegion'> <!-- bean property --> - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.FisheryRegion id='bean' javaBean='null'/> + <import> + static org.nuiton.i18n.I18n.n_ + fr.ifremer.isisfish.entities.FisheryRegion; + fr.ifremer.isisfish.map.CopyMapToClipboardListener; + com.bbn.openmap.gui.Tool; + com.bbn.openmap.gui.OMToolSet; + 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[ -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; -import fr.ifremer.isisfish.map.CopyMapToClipboardListener; -import com.bbn.openmap.gui.Tool; -import com.bbn.openmap.gui.OMToolSet; protected OMToolSet toolSet = new OMToolSet(); -toolSet.setupListeners(cellMap); -toolMap.add((Tool)toolSet); -// add copy to clipboard support -cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); +protected void $afterCompleteSetup() { + toolSet.setupListeners(cellMap); + toolMap.add((Tool)toolSet); + + // add copy to clipboard support + cellMap.addMapMouseListener(new CopyMapToClipboardListener(cellMap)); + + setButtonTitle(_("isisfish.input.continueCells")); + setNextPath(n_("isisfish.input.tree.cells")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { -setButtonTitle(_("isisfish.input.continueCells")); -setNextPath("$root/$cells"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - jaxx.runtime.SwingUtil.removeDataBinding($InputContentUI0, "cellMap.fisheryRegion"); + } + if (evt.getNewValue() != null) { + setFieldMapfilesModel(getBean()); + /* numberEditor is not working + fieldLatMin.init(); + fieldLatMax.init(); + fieldLongMin.init(); + fieldLongMax.init(); + fieldCellLengthLatitude.init(); + fieldCellLengthLongitude.init();*/ + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - jaxx.runtime.SwingUtil.applyDataBinding($InputContentUI0, "cellMap.fisheryRegion"); - } - } -}); + }); +} - at Override public void refresh() { - FisheryRegion region = getVerifier().getEntity(FisheryRegion.class); + 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((FisheryRegionImpl)region); - - if (getBean() != null) { - setFieldMapfilesModel(getBean()); - /* numberEditor is not working - fieldLatMin.init(); - fieldLatMax.init(); - fieldLongMin.init(); - fieldLongMax.init(); - fieldCellLengthLatitude.init(); - fieldCellLengthLongitude.init();*/ - } + setBean(region); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save, false); - getVerifier().setCancelButton(cancel); -} - protected InputAction getInputAction() { return getContextValue(InputAction.class); } @@ -111,13 +113,9 @@ setFieldMapfilesModel(getBean()); } -protected void cellFillChanged() { - -} - -protected void cellFile() { +/*protected void cellFile() { getInputAction().loadCellFile(fieldCellFile.getText()); -} +}*/ protected void check() { getContextValue(InputAction.class).checkFisheryRegion(getBean()); @@ -126,189 +124,202 @@ protected void save() { setInfoText(_("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()); - getVerifier().setEditable(false); - // TODO remove getParentContainer reference - getParentContainer(InputUI.class).setTreeModel(); - getParentContainer(InputUI.class).setFieldCurrentRegionModel(); + + // reload tree + InputUI inputUI = getParentContainer(InputUI.class); + inputUI.getHandler().reloadFisheryTree(inputUI); + setInfoText(_("isisfish.message.save.finished")); - refresh(); } ]]></script> - <JPanel id='body' layout='{new BorderLayout()}'> - <JSplitPane id="FisheryRegionTab" name="FisheryRegion" constraints='BorderLayout.CENTER' - oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL"> - <Table> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.name"/> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <JTextField id="fieldRegion" decorator='boxed' - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' - onKeyReleased='getBean().setName(fieldRegion.getText())'/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.area"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude.min"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLatMin' constructorParams='this' - bean='{getBean()}' property='minLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLatMin" text='{getBean().getMinLatitude()}' decorator='boxed' - onKeyReleased='getBean().setMinLatitude(Float.parseFloat(fieldLatMin.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude.max"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLatMax' constructorParams='this' - bean='{getBean()}' property='maxLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLatMax" text='{getBean().getMaxLatitude()}' decorator='boxed' - onKeyReleased='getBean().setMaxLatitude(Float.parseFloat(fieldLatMax.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude.min"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLongMin' constructorParams='this' - bean='{getBean()}' property='minLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLongMin" text='{getBean().getMinLongitude()}' decorator='boxed' - onKeyReleased='getBean().setMinLongitude(Float.parseFloat(fieldLongMin.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude.max"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldLongMax' constructorParams='this' - bean='{getBean()}' property='maxLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldLongMax" text='{getBean().getMaxLongitude()}' decorator='boxed' - onKeyReleased='getBean().setMaxLongitude(Float.parseFloat(fieldLongMax.getText()))'/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.spatial"/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.latitude"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldCellLengthLatitude' constructorParams='this' - bean='{getBean()}' property='cellLengthLatitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldCellLengthLatitude" text='{getBean().getCellLengthLatitude()}' decorator='boxed' - onKeyReleased='getBean().setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.fisheryRegion.longitude"/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldCellLengthLongitude' constructorParams='this' - bean='{getBean()}' property='cellLengthLongitude' - decorator='boxed' useSign='true'/--> - <JTextField id="fieldCellLengthLongitude" text='{getBean().getCellLengthLongitude()}' decorator='boxed' - onKeyReleased='getBean().setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()))'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.6'> - <JScrollPane> - <JList id="fieldMapfiles" decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonAddMap" text="isisfish.fisheryRegion.addMap" onActionPerformed='addMap()' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonRemoveMap" text="isisfish.fisheryRegion.delMap" onActionPerformed='delMap()' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.comments"/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.4'> - <JScrollPane> - <JTextArea id="fieldComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' decorator='boxed' - onKeyReleased='getBean().setComment(fieldComment.getText())'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.selectFile"/> - </cell> - </row> - <row> - <cell columns='3'> - <JLabel text="isisfish.fisheryRegion.ofCells"/> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JTextField id="fieldCellFile" onKeyReleased='cellFillChanged()' decorator='boxed'/> - </cell> - <cell> - <JButton id="buttonCellFile" text="isisfish.common.ellipsis" onActionPerformed='cellFile()' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.3'> - <JButton id='save' enabled='false' onActionPerformed='save()' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JButton id='check' text="isisfish.common.check" onActionPerformed='check()' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + <JPanel id="body"> + <JSplitPane constraints='BorderLayout.CENTER' oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL"> + <Table> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.name"/> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <JTextField id="fieldRegion" decorator='boxed' + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' + onKeyReleased='getBean().setName(fieldRegion.getText())'/> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.area"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude.min"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLatMin' constructorParams='this' + bean='{getBean()}' property='minLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLatMin" text='{String.valueOf(getBean().getMinLatitude())}' decorator='boxed' + onKeyReleased='getBean().setMinLatitude(Float.parseFloat(fieldLatMin.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude.max"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLatMax' constructorParams='this' + bean='{getBean()}' property='maxLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLatMax" text='{String.valueOf(getBean().getMaxLatitude())}' decorator='boxed' + onKeyReleased='getBean().setMaxLatitude(Float.parseFloat(fieldLatMax.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude.min"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLongMin' constructorParams='this' + bean='{getBean()}' property='minLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLongMin" text='{String.valueOf(getBean().getMinLongitude())}' decorator='boxed' + onKeyReleased='getBean().setMinLongitude(Float.parseFloat(fieldLongMin.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude.max"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldLongMax' constructorParams='this' + bean='{getBean()}' property='maxLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldLongMax" text='{String.valueOf(getBean().getMaxLongitude())}' decorator='boxed' + onKeyReleased='getBean().setMaxLongitude(Float.parseFloat(fieldLongMax.getText()))'/> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.spatial"/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.latitude"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldCellLengthLatitude' constructorParams='this' + bean='{getBean()}' property='cellLengthLatitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldCellLengthLatitude" text='{String.valueOf(getBean().getCellLengthLatitude())}' decorator='boxed' + onKeyReleased='getBean().setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.fisheryRegion.longitude"/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!-- NumberEditor id='fieldCellLengthLongitude' constructorParams='this' + bean='{getBean()}' property='cellLengthLongitude' + decorator='boxed' useSign='true'/--> + <JTextField id="fieldCellLengthLongitude" text='{String.valueOf(getBean().getCellLengthLongitude())}' decorator='boxed' + onKeyReleased='getBean().setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()))'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='0.6'> + <JScrollPane> + <JList id="fieldMapfiles" decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonAddMap" text="isisfish.fisheryRegion.addMap" onActionPerformed='addMap()' decorator='boxed'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id="buttonRemoveMap" text="isisfish.fisheryRegion.delMap" onActionPerformed='delMap()' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.comments"/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='0.4'> + <JScrollPane> + <JTextArea id="fieldComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' decorator='boxed' + onKeyReleased='getBean().setComment(fieldComment.getText())'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.selectFile"/> + </cell> + </row> + <!-- <row> + <cell columns='3'> + <JLabel text="isisfish.fisheryRegion.ofCells"/> + </cell> + </row> + <row> + <cell columns='3' fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell columns='4' fill='horizontal' weightx='1.0'> + <JTextField id="fieldCellFile" onKeyReleased='cellFillChanged()' decorator='boxed'/> + </cell> + <cell> + <JButton id="buttonCellFile" text="isisfish.common.ellipsis" onActionPerformed='cellFile()' decorator='boxed'/> + </cell> + </row> + </Table> + </cell> + </row> --> + <row> + <cell fill='horizontal' weightx='0.3'> + <JButton id='save' 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()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' selectionMode="0" javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.NO_SELECTION}" + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' fisheryRegion='{getBean()}' constraints='BorderLayout.CENTER' decorator='boxed'/> - </JPanel> - </JSplitPane> - </JPanel> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,144 +22,162 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + <import> + fr.ifremer.isisfish.entities.Gear; + jaxx.runtime.swing.editor.NumberEditor; + 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[ -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; -import jaxx.runtime.swing.editor.NumberEditor; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldGearName.setText(""); - fieldGearEffortUnit.setText(""); - fieldGearStandardisationFactor.setText(""); - fieldGearParamName.setText(""); - fieldGearComment.setText(""); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldGearName.setText(""); + fieldGearEffortUnit.setText(""); + fieldGearStandardisationFactor.setText(""); + fieldGearParamName.setText(""); + fieldGearComment.setText(""); + } + if (evt.getNewValue() != null) { + + } } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - - at Override -public void refresh() { - Gear gear = getVerifier().getEntity(Gear.class); +/*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((GearImpl) gear); + setBean(gear); getVerifier().addCurrentPanel(rangeOfValues); - /* chatellier commented since number editor is not working - if (getBean() != null) { - fieldGearStandardisationFactor.init(); - }*/ -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Gear"); - getVerifier().setDeleteButton(remove); -} + // chatellier commented since number editor is not working + //if (getBean() != null) { + // fieldGearStandardisationFactor.init(); + //} +}*/ ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.name" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldGearName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.effortUnit" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearEffortUnit" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getEffortUnit())}' - onKeyReleased='getBean().setEffortUnit(fieldGearEffortUnit.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldGearStandardisationFactor' constructorParams='this' - bean='{getBean()}' property='standardisationFactor' - enabled='{isActif()}' decorator='boxed' _bean='{GearImpl.class}' - _method='"StandardisationFactor"' useSign='true'/--> - <JTextField id="fieldGearStandardisationFactor" text='{getBean().getStandardisationFactor()}' - onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{GearImpl.class}' _method='"StandardisationFactor"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='horizontal' weightx='1.0'> - <JTextField id="fieldGearParamName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getParameterName())}' - onKeyReleased='getBean().setParameterName(fieldGearParamName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <RangeOfValuesUI id="rangeOfValues" actif='{isActif()}' constructorParams='this' - decorator='boxed' _bean='{GearImpl.class}' _method='"PossibleValue"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.gear.comments" enabled='{isActif()}'/> - </cell> - <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldGearComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldGearComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.name" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <JTextField id="fieldGearName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldGearName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.effortUnit" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <JTextField id="fieldGearEffortUnit" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getEffortUnit())}' + onKeyReleased='getBean().setEffortUnit(fieldGearEffortUnit.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActive()}'/> + </cell> + <cell columns="2" fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldGearStandardisationFactor' constructorParams='this' + bean='{getBean()}' property='standardisationFactor' + enabled='{isActive()}' decorator='boxed' _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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,36 +22,55 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Gear'> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.n_ + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + </import> <script><![CDATA[ -// constructor code -setButtonTitle(_("isisfish.input.continueMetiers")); -setNextPath("$root/$metiers"); - at Override -public void refresh() { +protected void $afterCompleteSetup() { + setButtonTitle(_("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); - - getVerifier().addCurrentPanel(gearTabUI, selectivityUI); } +/*public void refresh() { + //getVerifier().addCurrentPanel(gearTabUI, selectivityUI); +}*/ + @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(gearTab); +public void setLayer(boolean active) { + super.setLayer(active); + gearTabUI.setLayer(active); + selectivityUI.setLayer(active); } ]]></script> - <JPanel layout='{new BorderLayout()}'> + <JPanel id="body"> <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab"> - <tab title='{_("isisfish.gear.title")}'> - <GearTabUI id="gearTabUI" constructorParams='this'/> + <tab title='isisfish.gear.title'> + <GearTabUI id="gearTabUI" bean="{getBean()}" active="{isActive()}" constructorParams='this' /> </tab> - <tab title='{_("isisfish.selectivity.title")}'> - <SelectivityUI id="selectivityUI" constructorParams='this'/> + <tab title='isisfish.selectivity.title'> + <SelectivityUI id="selectivityUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,10 +34,7 @@ import java.util.List; import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixFactory; @@ -49,11 +46,9 @@ import org.nuiton.widget.editor.Editor; import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.FormuleStorage; import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.StorageException; -import fr.ifremer.isisfish.datastore.update.ImportFromV2; import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.CellDAO; import fr.ifremer.isisfish.entities.EffortDescription; @@ -78,14 +73,10 @@ import fr.ifremer.isisfish.entities.TargetSpecies; import fr.ifremer.isisfish.entities.TargetSpeciesDAO; import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.mexico.export.RegionExplorer; -import fr.ifremer.isisfish.mexico.export.RegionExport; -import fr.ifremer.isisfish.mexico.export.RegionExportFactorXML; import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.ui.input.check.CheckRegion; import fr.ifremer.isisfish.ui.input.check.CheckResult; import fr.ifremer.isisfish.ui.input.check.CheckResultFrame; -import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; import fr.ifremer.isisfish.ui.util.ErrorHelper; import fr.ifremer.isisfish.util.CellPointcomparator; @@ -105,320 +96,6 @@ /** Class logger. */ private static Log log = LogFactory.getLog(InputAction.class); - /** - * Exporter la region dans un zip. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importRegion() { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - if (file != null) { - RegionStorage.importZip(file); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Exporter la region dans un zip. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importRegionAndRename() { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - if (file != null) { - - String newName = JOptionPane - .showInputDialog(_("isisfish.message.name.imported.region")); - RegionStorage.importAndRenameZip(file, newName); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Importer la region depuis un fichier XML de la version 2. - * - * @return le nom du ficher selectionné par l'utilisateur - */ - public File importV2Region() { - File file = null; - try { - file = FileUtil.getFile(".*.xml$", - _("isisfish.message.import.region.xml")); - if (file != null) { - new ImportFromV2(true).importXML(file); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't import region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return file; - } - - /** - * Extract from a simulation the region, and rename it with name given - * by user. - * - * @return le nom de la region entré par l'utilsateur - */ - public String importRegionFromSimulation() { - - // first step select a simulation and new region name - String simulationName; - try { - //TODO Should use a shared model ? - simulationName = SimulationFilterUtil - .selectSimulation(SimulationStorage.getSimulationNames()); - if (simulationName == null) { - return null; - } - - } catch (Exception eee) { - String msg = _("isisfish.error.no.select.simulation"); - if (log.isWarnEnabled()) { - log.warn(msg, eee); - } - ErrorHelper.showErrorDialog( - _("isisfish.error.no.select.simulation"), eee); - return null; - } - - if (log.isInfoEnabled()) { - log.info("simulation used " + simulationName); - } - - // ask new region name - String regionName = JOptionPane.showInputDialog( - _("isisfish.message.import.region.name"), "region from " - + simulationName); - if (regionName == null || "".equals(regionName)) { - return null; - } - if (RegionStorage.getRegionNames().contains(regionName)) { - return null; - } - - if (log.isInfoEnabled()) { - log.info("new region name " + regionName); - } - - try { - SimulationStorage.getSimulation(simulationName).extractRegion( - regionName); - } catch (StorageException eee) { - if (log.isErrorEnabled()) { - log.error("Can't extract region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.import"), eee); - } - return regionName; - } - - /** - * Exporter la region dans un zip - * - * @param regionStorage storage to export - * @return file were region were exported - */ - public File exportRegion(RegionStorage regionStorage) { - File file = null; - try { - file = FileUtil.getFile(".*.zip$", - _("isisfish.message.import.region.zipped")); - - // add .zip extension is not set - if (!file.getAbsolutePath().endsWith(".zip")) { - file = new File(file.getAbsolutePath() + ".zip"); - } - - if (file != null) { - int resp = JOptionPane.YES_OPTION; - if (file.exists()) { - resp = JOptionPane.showConfirmDialog(null, - _("isisfish.message.file.overwrite")); - } - if (resp == JOptionPane.YES_OPTION) { - regionStorage.createZip(file); - } - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't export region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.export"), eee); - } - return file; - } - - /** - * Copy la region avec un autre nom. - * - * @param regionStorage region to copy - * @return le nom de la nouvelle region - */ - public String copyRegion(RegionStorage regionStorage) { - String newName = null; - try { - newName = JOptionPane - .showInputDialog(_("isisfish.message.new.region.name")); - - if (!StringUtils.isEmpty(newName)) { - File zip = regionStorage.createZip(); - RegionStorage.importAndRenameZip(zip, newName); - } - - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't copy region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.copy"), eee); - } - return newName; - } - - /** - * Remove region. - * - * @param regionStorage region storage - * @param cvsDelete if true delete region in CVS too - * @return removed region - */ - public boolean removeRegion(RegionStorage regionStorage, boolean cvsDelete) { - boolean result = false; - try { - int resp = JOptionPane.showConfirmDialog(null, _( - "isisfish.message.confirm.remove.region", regionStorage - .getName())); - if (resp == JOptionPane.YES_OPTION) { - regionStorage.delete(cvsDelete); - result = true; - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't remove region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.remove"), eee); - } - return result; - } - - /** - * Commit region. - * - * @param regionStorage region storage - * @return status message - */ - public String commitRegionInCVS(RegionStorage regionStorage) { - String result = null; - try { - String msg = regionStorage.getCommentForNextCommit(); - JTextArea text = new JTextArea(msg); - int resp = JOptionPane.showOptionDialog(null, - new JScrollPane(text), _("isisfish.commit.message"), - JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, - null, // icon - null, null); - if (resp == JOptionPane.OK_OPTION) { - regionStorage.commit(text.getText()); - regionStorage.clearCommentForNextCommit(); - result = _("isisfish.message.region.commited"); - } else { - result = _("isisfish.message.commit.region.canceled"); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't export region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.commit"), eee); - } - return result; - } - - /** - * Load region. - * <p/> - * RegionStorage, TopiaContext, FisheryRegion are put in uiContext data. - * <p/> - * tree ans - * - * @param ui TODO - * @param name name of region - * @return loaded region - */ - public FisheryRegion loadRegion(InputUI ui, String name) { - if (log.isDebugEnabled()) { - log.debug("loadRegion : " + name); - } - - FisheryRegion region = null; - try { - RegionStorage regionStorage = null; - TopiaContext isisContext = null; - if (name != null && !" ".equals(name)) { - regionStorage = RegionStorage.getRegion(name); - isisContext = regionStorage.getStorage().beginTransaction(); - region = RegionStorage.getFisheryRegion(isisContext); - ui.setContextValue(regionStorage); - ui.setContextValue(isisContext); - // FIXME session shoul be closed - // but make lazy init later - //isisContext.rollbackTransaction(); - //isisContext.closeContext(); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't load region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.load"), eee); - } - return region; - } - - /** - * Create new region, and select it in combo, and show input pane region in - * input area. - * - * @param name name of the new region - */ - public void newRegion(String name) { - if (log.isTraceEnabled()) { - log.trace("newRegion called"); - } - try { - if ("".equals(name)) { - // showMsgBox("error " + _("isisfish.error.region.name.empty")); - } - if (RegionStorage.getRegionNames().contains(name)) { - // showMsgBox("Error " + _("isisfish.error.region.already.exists")); - } - RegionStorage.create(name); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.region.create"), eee); - } - } - /* * Permet de creer simplement un nouvelle objet portant un nom par defaut. * Le nouvel element est automatiquement selectionné dans l'arbre @@ -628,16 +305,17 @@ return null; } - public Object openEditor(String category, String name, Class javaInterface, + public Object openEditor(InputOneEquationUI ui, String category, String name, Class<?> javaInterface, String content, Editor editor) { if (log.isTraceEnabled()) { log.trace("openEditor"); } try { - EquationEditorPaneUI pane = new EquationEditorPaneUI(); + EquationEditorPaneUI pane = new EquationEditorPaneUI(ui); pane.setEquation(category, name, javaInterface, content); - pane.setVisible(true); - if (pane.isOk() && editor != null) { + pane.setLocationRelativeTo(ui); + pane.setVisible(true); // blocking call + if (pane.isResultOk() && editor != null) { editor.setText(pane.getEditor().getText()); } pane.dispose(); @@ -844,21 +522,8 @@ return null; } - // Population - public Species getSpeciesByTopiaId(TopiaContext context, String topiaId) { - Species result = null; - try { - SpeciesDAO dao = IsisFishDAOHelper.getSpeciesDAO(context); - result = dao.findByTopiaId(topiaId); - } catch (TopiaException e) { - if (log.isErrorEnabled()) { - log.error("Can't get species", e); - } - } - return result; - } - public Population createPopulation(TopiaContext context, Species species) { + Population pop = null; if (log.isTraceEnabled()) { log.trace("createPopulation called"); } @@ -866,25 +531,17 @@ String name = "Population_new"; PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(context); - Population pop = dao.create(); + pop = dao.create(); pop.setName(name); species.addPopulation(pop); pop.setSpecies(species); species.update(); pop.update(); - // EC-20091112 : commit() twice cause hibernate error: - // Found two representations of same collection: - //context.commitTransaction(); - return pop; - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create Population", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.addentity", - "Population"), eee); + } catch (TopiaException eee) { + throw new IsisFishRuntimeException(_("isisfish.error.input.addentity", "Population"), eee); } - return null; + return pop; } public PopulationSeasonInfo createPopulationSeasonInfo(Population pop) { @@ -941,30 +598,25 @@ } } - public void createMetierSeasonInfo(Metier metier) { + public MetierSeasonInfo createMetierSeasonInfo(Metier metier) { + MetierSeasonInfo metierSeasonInfo = null; if (log.isDebugEnabled()) { log.debug("createMetierSeasonInfo called"); } try { MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper .getMetierSeasonInfoDAO(metier.getTopiaContext()); - MetierSeasonInfo metierSeasonInfo = metierSeasonInfoPS.create(); + metierSeasonInfo = metierSeasonInfoPS.create(); metierSeasonInfo.setFirstMonth(Month.MONTH[0]); metierSeasonInfo.setLastMonth(Month.MONTH[3]); metier.addMetierSeasonInfo(metierSeasonInfo); metierSeasonInfo.update(); metier.update(); - - // EC-20091112 : commit() twice cause hibernate error: - // Found two representations of same collection: - // isisContext.commitTransaction(); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create MetierSeasonInfo", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.addentity", - "MetierSeasonInfo"), eee); + + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't create MetierSeasonInfo", eee); } + return metierSeasonInfo; } public void removeMetierSeasonInfo(Metier metier, MetierSeasonInfo info) { @@ -1204,19 +856,19 @@ } } - /** + /* * Affiche une boite de dialogue demandant a l'utilisateur de rentrer * un nom de fichier, et met ce nom dans la textField. * Passe le saveButton en enabled pour marque que la region a ete modifié * * @param cellFile file of cells - */ + * public void loadCellFile(String cellFile) { if (log.isWarnEnabled()) { log.warn("loadCell called but not implemented"); } // FIXME todo loadCellFile - } + }*/ public void saveFisheryRegion(FisheryRegion fisheryRegion) { if (log.isTraceEnabled()) { @@ -1316,42 +968,4 @@ ErrorHelper.showErrorDialog(_("isisfish.error.region.check"), eee); } } - - /** - * Explore region and exporte any enabled sensitivity factor name with value. - * - * @param parentComponent parent component - * @param fisheryRegion fishery region to export - */ - public void exportRegionSensitivityFactors(InputUI parentComponent, FisheryRegion fisheryRegion) { - - try { - File exportFile = FileUtil.getFile(_("isisfish.input.sensitivity.export.title"), - _("isisfish.common.ok"), parentComponent, ".*\\.xml", "XML Files"); - - // make sur that filename ends with ".xml" - if (!exportFile.getAbsolutePath().endsWith(".xml")) { - exportFile = new File(exportFile.getAbsolutePath() + ".xml"); - } - - if (exportFile != null) { - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.running"), true); - RegionExplorer explorer = new RegionExplorer(); - RegionExport exportXML = new RegionExportFactorXML(exportFile); - explorer.explore(fisheryRegion, exportXML); - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.complete")); - } - else { - if (log.isDebugEnabled()) { - log.debug("Export action canceled"); - } - parentComponent.setStatusMessage(_("isisfish.input.sensitivity.export.cancel")); - } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error(_("isisfish.error.sensitivity.export"), eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.sensitivity.export"), eee); - } - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,16 +22,18 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}' abstract="true"> +<JPanel layout='{new BorderLayout()}' genericType='B extends TopiaEntityContextable' abstract="true"> - <!-- UI state when editing. If no entity selected, actif = false --> - <Boolean id='actif' javaBean='false'/> + <InputHandler id="handler" /> + <!-- UI state when editing. If no entity selected, active = false --> + <Boolean id='active' javaBean='false'/> + <!-- True only for sensitivity simulation --> <Boolean id='sensitivity' javaBean='false'/> <!-- Next button title --> - <java.lang.String id='buttonTitle' javaBean='""'/> + <java.lang.String id='buttonTitle' javaBean='null'/> <!-- Next path --> <java.lang.String id='nextPath' javaBean='null'/> @@ -48,54 +50,51 @@ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { - accept(e); + getHandler().accept(InputContentUI.this, e); } }}' /> + <!-- Layer qui control les clics sur les JTables (certaines equations) --> <fr.ifremer.isisfish.ui.sensitivity.TableBlockingLayerUI id="tableLayerUI" constructorParams='this' /> - <script><![CDATA[ -import javax.swing.JComponent; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityUtils; -import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; -import fr.ifremer.isisfish.ui.sensitivity.EditorHelper; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabbedPaneListener; -import fr.ifremer.isisfish.ui.WelcomePanelUI; -import org.nuiton.topia.persistence.TopiaEntity; -import org.apache.commons.lang.StringUtils; + <!-- Validation + <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel' /> --> -protected ChangeListener tabbedPaneChangeListener; + <import> + javax.swing.JComponent + javax.swing.event.ChangeListener + fr.ifremer.isisfish.entities.FisheryRegion + fr.ifremer.isisfish.ui.sensitivity.SensitivityUtils + fr.ifremer.isisfish.ui.WelcomePanelUI + org.nuiton.topia.persistence.TopiaEntityContextable + org.nuiton.topia.TopiaContext + org.apache.commons.lang.StringUtils + java.awt.Color + javax.swing.AbstractAction + javax.swing.JTable + javax.swing.JTabbedPane + </import> -/** - * This method is UI entry point. - * - * It's called : - * - by input tree to first display UI - * - by input verifier on cancel action - * - * 20090602 chatellier : make abstract, must be implemented ! + <script><![CDATA[ +/* + * Overriden with generic type */ -public abstract void refresh(); +public abstract void setBean(B entity); -/** - * This is a hack for tabbed UI. - * - * In this case of UI, they have multiples save/cancel - * buttons, they have to be manually activated - * on tab siwtching. - */ -public abstract void setActionButtons(); +public abstract B getBean(); public InputAction getAction() { return getContextValue(InputAction.class); } -public InputSaveVerifier getVerifier() { +public InputSaveVerifier getSaveVerifier() { return getContextValue(InputSaveVerifier.class); } -public FisheryRegion getRegion() { +public FisheryRegion getFisheryRegion() { return getContextValue(FisheryRegion.class); } +public TopiaContext getTopiaContext() { + return getContextValue(TopiaContext.class); +} public void setInfoText(String msg) { WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); if (root != null){ @@ -103,7 +102,12 @@ } } protected void goTo() { - getParentContainer(InputUI.class).setTreeSelection(getNextPath()); + // 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, nextPath); + } } /** @@ -113,7 +117,7 @@ */ protected void refreshRegionInMap(fr.ifremer.isisfish.map.IsisMapBean map) { FisheryRegion fisheryRegion = map.getFisheryRegion(); - FisheryRegion regionFromContext = getRegion(); + FisheryRegion regionFromContext = getFisheryRegion(); if (fisheryRegion == null || !fisheryRegion.equals(regionFromContext)) { if (log.isInfoEnabled()) { log.info("Use now " + regionFromContext + " in map " + map); @@ -122,18 +126,23 @@ } } +/** + * Method appelée par l'arbre de navigation et le gestionnaire + * de changement d'onglet pour ajouter les layers sur une interface + * 'input' seulement dans le cas de la sensibilité. + */ public void setLayer(boolean active) { - if (this.get$objectMap() != null && active) { + if (get$objectMap() != null) { for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { // Verifie si dans l'entré existe dans le fichier sensitivity.properties - Class classBean = (Class)boxed.getClientProperty("bean"); - String method = (String)boxed.getClientProperty("method"); + Class<?> sensitivityBeanClass = (Class<?>)boxed.getClientProperty("sensitivityBean"); + String method = (String)boxed.getClientProperty("sensitivityMethod"); // test if factor is enabled boolean isSensitivityFactorEnabled = false; - if (classBean != null) { - // classBean is defined in property file without "Impl" - String className = classBean.getSimpleName().replace("Impl", ""); + if (sensitivityBeanClass != null) { + // sensitivityBeanClass is defined in property file without "Impl" + String className = sensitivityBeanClass.getSimpleName().replace("Impl", ""); // ensure that method name is uncapitalized method = StringUtils.uncapitalize(method); @@ -144,20 +153,16 @@ // install correct layer depending if factor enable if (isSensitivityFactorEnabled) { - jaxx.runtime.swing.BlockingLayerUI2 ui = layerUI2.clone(); + jaxx.runtime.swing.BlockingLayerUI2 ui = getLayerUI2().clone(); SwingUtil.getLayer(boxed).setUI(ui); } else { if (boxed instanceof JTable) { - //fr.ifremer.isisfish.ui.sensitivity.TableBlockingLayerUI layerui = - // new fr.ifremer.isisfish.ui.sensitivity.TableBlockingLayerUI(); - //layerui.parent = this; - //layerui.verifier = getVerifier(); - SwingUtil.getLayer(boxed).setUI(tableLayerUI); + SwingUtil.getLayer(boxed).setUI(getTableLayerUI()); } else { - jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); + jaxx.runtime.swing.BlockingLayerUI ui = getLayerUI().clone(); ui.setBlock(true); - ui.setUseIcon(isActif()); + ui.setUseIcon(isActive()); SwingUtil.getLayer(boxed).setUI(ui); } } @@ -166,119 +171,23 @@ } /** - * Action appelée lors du clic sur un layer. - * - * @param e l'event initial intersepté par le layer - */ -protected void accept(ActionEvent e) { - if (log.isDebugEnabled()) { - log.debug("Event intercepted on " + e); - } - - JComponent source = (JComponent) e.getSource(); - Class<? extends TopiaEntity> classBean = (Class<? extends TopiaEntity>)source.getClientProperty("bean"); - String beanID = (String)source.getClientProperty("beanID"); - /*TopiaEntity bean = null; - if (beanID == null) { - bean = getVerifier().getEntity(classBean); - } - else { - bean = getVerifier().getEntity(classBean, beanID); - } - if (bean != null) { - FactorWizardUI wizard = new FactorWizardUI(this); - wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean)); - wizard.pack(); - wizard.setVisible(true); - }*/ - - String property = (String)source.getClientProperty("method"); - displayFactorWizard(source, classBean, beanID, property); -} - -/** - * Display factor wizard for bean/property in registred in verifier. - */ -public void displayFactorWizard(JComponent source, Class<? extends TopiaEntity> classBean, String beanID, String property) { - - if (log.isDebugEnabled()) { - log.debug("Event intercepted " + source); - log.debug(" client property (bean) : " + classBean); - log.debug(" client property (beanID) : " + beanID); - log.debug(" client property (method) : " + property); - } - - TopiaEntity bean = null; - if (beanID == null) { - bean = getVerifier().getEntity(classBean); - } - else { - bean = getVerifier().getEntity(classBean, beanID); - } - - if (bean != null) { - - JComponent editor = source; - - // This is a special case for table source component - // If current entity is displayed by a JTable component - // we need to find a better component than - // can display 'property' on 'bean' - if (editor instanceof JTable) { - editor = EditorHelper.getEditorForValue(bean, property); - } - - if (editor != null) { - FactorWizardUI wizard = new FactorWizardUI(this); - wizard.initNew(editor, bean, EditorHelper.canBeContinue(editor, bean)); - wizard.pack(); - wizard.setVisible(true); - } - else if (log.isWarnEnabled()) { - log.warn("Can't find editor for " + classBean.getSimpleName() + "#" + property); - } - } - else { - if (log.isErrorEnabled()) { - log.error("Can't find bean in current verifier (classBean = " + classBean + ", beanID = " + beanID + ")"); - } - } -} - -/** * Install tabbed pane change listener depending on sensitivity. * (init at first call) * * @param tabbedPane tabbed pane to install change listener */ protected void installChangeListener(JTabbedPane tabbedPane) { - - // remove already registred listeners - for (ChangeListener changeListener : tabbedPane.getChangeListeners()) { - tabbedPane.removeChangeListener(changeListener); + // in fichery input, we must listener for tab switch + // to ask user for saving + // in sensitivity, fishery can't be saved + if (!isSensitivity()) { + ChangeListener tabbedPaneChangeListener = new InputTabbedPaneListener(); + tabbedPane.addChangeListener(tabbedPaneChangeListener); } - - if (tabbedPaneChangeListener == null) { - if (isSensitivity()) { - tabbedPaneChangeListener = new SensitivityTabbedPaneListener(); - } else { - tabbedPaneChangeListener = new InputTabbedPaneListener(); - } - } - - tabbedPane.addChangeListener(tabbedPaneChangeListener); } -/** - * Active les boutons sur l'onglet actuellement affiché. - */ -protected void setCurrentTabActionButtons(JTabbedPane tabbedPane) { - InputContentUI selectedUI = (InputContentUI) tabbedPane.getSelectedComponent(); - selectedUI.setActionButtons(); -} - ]]></script> - <JPanel id='body' constraints='BorderLayout.CENTER'/> + <JPanel id='body' constraints='BorderLayout.CENTER' layout='{new BorderLayout()}' /> <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' - visible='{getNextPath() != null}' onActionPerformed='goTo()' decorator='boxed'/> + visible='{getButtonTitle() != null}' onActionPerformed='goTo()' decorator='boxed'/> </JPanel> Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,821 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ItemEvent; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +import jaxx.runtime.JAXXContext; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntityContextable; +import org.nuiton.util.FileUtil; + +import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageException; +import fr.ifremer.isisfish.datastore.update.ImportFromV2; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.Port; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.entities.SpeciesDAO; +import fr.ifremer.isisfish.entities.Strategy; +import fr.ifremer.isisfish.entities.TripType; +import fr.ifremer.isisfish.entities.VesselType; +import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.mexico.export.RegionExplorer; +import fr.ifremer.isisfish.mexico.export.RegionExport; +import fr.ifremer.isisfish.mexico.export.RegionExportFactorXML; +import fr.ifremer.isisfish.ui.CommonHandler; +import fr.ifremer.isisfish.ui.NavigationUI; +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.models.common.StringComboModel; +import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityInputHandler; +import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; +import fr.ifremer.isisfish.vcs.VCSException; + +/** + * Main handler for fishery edition action. + * Next, each ui as his own handler. + * + * In context : + * <ul> + * <li>FisheryRegion + * <li>RegionStorage + * </ul> + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class InputHandler extends CommonHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(InputHandler.class); + + /** + * Cache pour n'instancier les ui qu'une seule fois + * et eviter que l'affichage saute pour l'utilsateur. + */ + protected Map<Class<?>, InputContentUI<?>> uiInstanceCache = new HashMap<Class<?>, InputContentUI<?>>(); + + /** + * Load region by region name, set it into jaxx context and refresh ui. + * + * Before loading region, try to close old one. + * + * @param inputUI input ui + * @param name region name to load + */ + protected void loadRegion(InputUI inputUI, String name) { + if (log.isDebugEnabled()) { + log.debug("Load region " + name); + } + + if (name == null) { + // show empty region ui + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(), "none"); + TreeModel model = new DefaultTreeModel(null); + inputUI.getFisheryRegionTree().setModel(model); + } + else { + FisheryRegion fisheryRegion = null; + RegionStorage regionStorage = null; + TopiaContext topiaContext = null; + + // load region + try { + regionStorage = RegionStorage.getRegion(name); + topiaContext = regionStorage.getStorage().beginTransaction(); + fisheryRegion = RegionStorage.getFisheryRegion(topiaContext); + } catch (TopiaException ex) { + throw new IsisFishRuntimeException("Can't load region", ex); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't load region", ex); + } + + // TODO echatellier 20110323 voir pour remplacer le binding + inputUI.setRegionLoaded(fisheryRegion != null); + + // init tree model loader with fishery region + FisheryTreeHelper fisheryTreeHelper = new FisheryTreeHelper(); + FisheryDataProvider dataProvider = new FisheryDataProvider(fisheryRegion); + fisheryTreeHelper.setDataProvider(dataProvider); + TreeModel fisheryTreeModel = fisheryTreeHelper.createTreeModel(fisheryRegion); + inputUI.getFisheryRegionTree().setModel(fisheryTreeModel); + inputUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider)); + inputUI.getFisheryRegionTree().setSelectionModel(new FisheryTreeSelectionModel(inputUI)); + fisheryTreeHelper.setUI(inputUI.getFisheryRegionTree(), true, false, null); + + // global context value : fisheryRegion, regionStorage, treeHelper + inputUI.setContextValue(fisheryRegion); + inputUI.setContextValue(regionStorage); + inputUI.setContextValue(fisheryTreeHelper); + inputUI.setContextValue(fisheryTreeModel); + inputUI.setContextValue(topiaContext); + + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(),"normale"); + + // autoselect roto node (fire some event) + fisheryTreeHelper.selectNode((FisheryTreeNode)fisheryTreeModel.getRoot()); + } + } + + /** + * Reload current loaded fishery tree. + * + * @param inputUI inputUI + */ + public void reloadFisheryTree(InputUI inputUI) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + fisheryTreeHelper.refreshNode((FisheryTreeNode)fisheryTreeModel.getRoot(), true); + } + + /** + * Main ui fishery region selection changed. + * + * @param inputUI inputUI + * @param e event + */ + public void regionChange(final InputUI inputUI, ItemEvent e) { + // event launched twice with itemchange listener + if (e.getStateChange() == ItemEvent.SELECTED) { + final String name = (String)inputUI.getFieldCurrentRegion().getSelectedItem(); + if (log.isDebugEnabled()) { + log.debug("New region selected " + name); + } + + // long operation, run status bar + setStatusMessage(inputUI, _("isisfish.message.loading.region", name), true); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + loadRegion(inputUI, name); + setStatusMessage(inputUI, _("isisfish.message.load.finished")); + } + }); + } + } + + /** + * Create new region (called if region name is not empty). + * + * @param inputUI inputUI + */ + public void createNewRegion(InputUI inputUI) { + String name = inputUI.getFieldNewRegion().getText(); + setStatusMessage(inputUI, _("isisfish.message.creating.region", name), true); + + if (RegionStorage.getRegionNames().contains(name)) { + JOptionPane.showMessageDialog(inputUI, _("isisfish.error.region.already.exists")); + } + else { + try { + RegionStorage.create(name); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't create region", ex); + } + inputUI.getFieldNewRegion().setText(""); + refreshRegionList(inputUI, name); + } + + setStatusMessage(inputUI, _("isisfish.message.creation.finished")); + } + + /** + * Rafraichit la liste des regions. + * + * @param inputUI inputUI + * @param selectedItem region to select + */ + protected void refreshRegionList(InputUI inputUI, String selectedItem) { + // refresh region list + StringComboModel regionsModel = new StringComboModel(RegionStorage.getRegionNames()); + inputUI.getFieldCurrentRegion().setModel(regionsModel); + // event is fired by setSelectedItem to call #regionChange + if (selectedItem != null) { + inputUI.getFieldCurrentRegion().setSelectedItem(selectedItem); + } + else { + loadRegion(inputUI, null); + } + } + + /** + * Exporter la region dans un zip. + * + * @param inputUI inputUI + */ + public void importRegion(InputUI inputUI) { + setStatusMessage(inputUI, _("isisfish.message.import.zip"), true); + + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + if (file != null) { + RegionStorage.importZip(file); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Exporter la region dans un zip. + * + * @param inputUI inputUI + */ + public void importRegionAndRename(InputUI inputUI) { + setStatusMessage(inputUI, _("isisfish.message.import.zip"), true); + + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + if (file != null) { + + String newName = JOptionPane + .showInputDialog(_("isisfish.message.name.imported.region")); + RegionStorage.importAndRenameZip(file, newName); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Importer la region depuis un fichier XML de la version 2. + * + * @param inputUI inputUI + */ + public void importV2Region(InputUI inputUI) { + + setStatusMessage(inputUI, _("isisfish.message.import.xml.v2.file"), true); + + try { + File file = FileUtil.getFile(".*.xml$", _("isisfish.message.import.region.xml")); + if (file != null) { + new ImportFromV2(true).importXML(file); + } + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.region.import"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.import.finished")); + } + + /** + * Extract from a simulation the region, and rename it with name given + * by user. + * + * @param inputUI inputUI + */ + public void importRegionFromSimulation(InputUI inputUI) { + + setStatusMessage(inputUI, _("isisfish.message.import"), true); + + // first step select a simulation and new region name + try { + //TODO Should use a shared model ? + List<String> simulationNames = SimulationStorage.getSimulationNames(); + String simulationName = SimulationFilterUtil.selectSimulation(simulationNames); + if (simulationName != null) { + + if (log.isInfoEnabled()) { + log.info("simulation used " + simulationName); + } + + // ask new region name + String regionName = JOptionPane.showInputDialog( + _("isisfish.message.import.region.name"), "region from " + + simulationName); + + if (StringUtils.isNotBlank(regionName)) { + if (RegionStorage.getRegionNames().contains(regionName)) { + JOptionPane.showMessageDialog(inputUI, _("isisfish.error.region.already.exists")); + } + else { + SimulationStorage.getSimulation(simulationName).extractRegion(regionName); + } + } + } + + } catch (Exception eee) { + throw new IsisFishRuntimeException(_("isisfish.error.no.select.simulation"), eee); + } + + setStatusMessage(inputUI, _("isisfish.message.export.done")); + } + + /** + * Exporter la region dans un zip + * + * Call only if region is loaded. + * + * @param inputUI inputUI + */ + public void exportRegion(InputUI inputUI) { + try { + File file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); + + if (file != null) { + // add .zip extension is not set + if (!file.getAbsolutePath().endsWith(".zip")) { + file = new File(file.getAbsolutePath() + ".zip"); + } + + int resp = JOptionPane.YES_OPTION; + if (file.exists()) { + resp = JOptionPane.showConfirmDialog(inputUI, + _("isisfish.message.file.overwrite")); + } + if (resp == JOptionPane.YES_OPTION) { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + regionStorage.createZip(file); + } + } + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't export region", eee); + } + } + + /** + * Remove region. + * + * @param inputUI input ui + * @param vcsDelete if true delete region in CVS too + */ + public void removeRegion(InputUI inputUI, boolean vcsDelete) { + try { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + int resp = JOptionPane.showConfirmDialog(inputUI, + _("isisfish.message.confirm.remove.region", regionStorage.getName())); + if (resp == JOptionPane.YES_OPTION) { + regionStorage.delete(vcsDelete); + refreshRegionList(inputUI, null); + } + } catch (StorageException eee) { + throw new IsisFishRuntimeException("Can't delete region", eee); + } + } + + /** + * Copy la region avec un autre nom. + * + * @param inputUI input ui + */ + public void copyRegion(InputUI inputUI) { + try { + String newName = JOptionPane + .showInputDialog(_("isisfish.message.new.region.name")); + + if (StringUtils.isNotEmpty(newName)) { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + File zip = regionStorage.createZip(); + RegionStorage.importAndRenameZip(zip, newName); + } + + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't copy region", eee); + } catch (StorageException eee) { + throw new IsisFishRuntimeException("Can't copy region", eee); + } + } + + /** + * Commit region. + * + * @param inputUI input ui + */ + public void commitRegionInCVS(InputUI inputUI) { + try { + RegionStorage regionStorage = inputUI.getContextValue(RegionStorage.class); + setStatusMessage(inputUI, _("isisfish.message.commiting.region", regionStorage.getName()), true); + String msg = regionStorage.getCommentForNextCommit(); + JTextArea text = new JTextArea(msg); + int resp = JOptionPane.showOptionDialog(null, + new JScrollPane(text), _("isisfish.commit.message"), + JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, + null, // icon + null, null); + if (resp == JOptionPane.OK_OPTION) { + regionStorage.commit(text.getText()); + regionStorage.clearCommentForNextCommit(); + setStatusMessage(inputUI, _("isisfish.message.region.commited")); + } else { + setStatusMessage(inputUI, _("isisfish.message.commit.region.canceled")); + } + } catch (VCSException eee) { + throw new IsisFishRuntimeException("Can't commit region", eee); + } catch (IOException eee) { + throw new IsisFishRuntimeException("Can't commit region", eee); + } + setStatusMessage(inputUI, _("isisfish.message.export.done")); + } + + /** + * Explore region and export any enabled sensitivity factor name with value. + * + * @param inputUI input ui + */ + public void exportRegionSensitivityFactors(InputUI inputUI) { + + try { + File exportFile = FileUtil.getFile(_("isisfish.input.sensitivity.export.title"), + _("isisfish.common.ok"), inputUI, ".*\\.xml", "XML Files"); + + if (exportFile != null) { + // make sur that filename ends with ".xml" + if (!exportFile.getAbsolutePath().endsWith(".xml")) { + exportFile = new File(exportFile.getAbsolutePath() + ".xml"); + } + + FisheryRegion fisheryRegion = inputUI.getContextValue(FisheryRegion.class); + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.running"), true); + RegionExplorer explorer = new RegionExplorer(); + RegionExport exportXML = new RegionExportFactorXML(exportFile); + explorer.explore(fisheryRegion, exportXML); + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.complete"), true); + } + else { + setStatusMessage(inputUI, _("isisfish.input.sensitivity.export.cancel"), true); + } + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't export sensitivity factors", eee); + } + } + + /** + * Changement de selection dans l'arbre de la pecherie. + * + * @param inputUI + * @param event + */ + public void nodeSelectionChanged(InputUI inputUI, TreeSelectionEvent event) { + + TreePath newTreePath = event.getNewLeadSelectionPath(); + if (newTreePath != null) { + Object lastTreePath = newTreePath.getLastPathComponent(); + if (lastTreePath instanceof FisheryTreeNode) { + FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath; + + Class<?> internalClass = isisTreeNode.getInternalClass(); + TopiaEntityContextable topiaEntity = null; + String topiaId = isisTreeNode.getId(); + + try { + // noeud qui n'en charge pas d'autres (= un bean) + if (isisTreeNode.isStaticNode()) { + FisheryRegion fisheryRegion = inputUI.getContextValue(FisheryRegion.class); + TopiaContext topiaContext = fisheryRegion.getTopiaContext(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + } + + InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, inputUI); + inputContentUI.getSaveVerifier().setInputContentUI(inputContentUI); + + // mandatory set + inputContentUI.getSaveVerifier().reset(); // before set bean !!! + if (topiaEntity != null) { + inputContentUI.getSaveVerifier().addCurrentEntity(topiaEntity); + } + + inputContentUI.setBean(topiaEntity); + inputContentUI.setActive(topiaEntity != null); + + // add initialized ui to panel + inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(), "normale"); + inputUI.getInputPane().removeAll(); + inputUI.getInputPane().add(inputContentUI, BorderLayout.CENTER); + inputUI.getInputPane().repaint(); + inputUI.getInputPane().validate(); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display bean " + topiaId, ex); + } + } + } + } + + /** + * Get ui that can display internalClass. + * + * @param internalClass internal class to get ui + * @param topiaEntity topia entity to set into ui + * @return ui for class + * @throws Exception + */ + protected InputContentUI<?> getUIInstanceForBeanClass(Class<?> internalClass, NavigationUI navigationUI) throws Exception { + + Class<? extends InputContentUI<?>> uiClass = null; + if (FisheryRegion.class.isAssignableFrom(internalClass)) { + uiClass = FisheryRegionUI.class; + } + else if (Cell.class.isAssignableFrom(internalClass)) { + uiClass = CellUI.class; + } + else if (Gear.class.isAssignableFrom(internalClass)) { + uiClass = GearUI.class; + } + else if (Metier.class.isAssignableFrom(internalClass)) { + uiClass = MetierUI.class; + } + else if (Population.class.isAssignableFrom(internalClass)) { + uiClass = PopulationUI.class; + } + else if (Port.class.isAssignableFrom(internalClass)) { + uiClass = PortUI.class; + } + else if (SetOfVessels.class.isAssignableFrom(internalClass)) { + uiClass = SetOfVesselsUI.class; + } + else if (Species.class.isAssignableFrom(internalClass)) { + uiClass = SpeciesUI.class; + } + else if (Strategy.class.isAssignableFrom(internalClass)) { + uiClass = StrategyUI.class; + } + else if (TripType.class.isAssignableFrom(internalClass)) { + uiClass = TripTypeUI.class; + } + else if (VesselType.class.isAssignableFrom(internalClass)) { + uiClass = VesselTypeUI.class; + } + else if (Zone.class.isAssignableFrom(internalClass)) { + uiClass = ZoneUI.class; + } + + // use map to implement UI cache + InputContentUI<?> result = uiInstanceCache.get(uiClass); + if (result == null) { + Constructor<?> constructor = uiClass.getConstructor(JAXXContext.class); + result = (InputContentUI<?>)constructor.newInstance(navigationUI); + + uiInstanceCache.put(uiClass, result); + } + + return result; + } + + /** + * Change tree selection with new node id. + * + * Called by specific UI (CellUI to change node). + * + * @param inputUI context ui (to get context value tree helper...) + * @param nodeId node id to select + */ + public void setTreeSelection(InputContentUI<?> inputUI, String nodeId) { + setTreeSelection(inputUI, null, nodeId); + } + + /** + * Change tree selection with new node id. + * + * Called by specific UI (CellUI to change node). + * + * @param inputUI context ui (to get context value tree helper...) + * @param parentNodeId find node to select from this node + * @param nodeId node id to select + */ + public void setTreeSelection(InputContentUI<?> inputUI, String parentNodeId, String nodeId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode fromNode = (FisheryTreeNode)fisheryTreeModel.getRoot(); + if (parentNodeId != null) { + fromNode = fisheryTreeHelper.findNode(fromNode, parentNodeId); + } + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode(fromNode, nodeId); + if (newSelectNode != null) { + fisheryTreeHelper.selectNode(newSelectNode); + } + } + + /** + * Delete tree node referenced by parent, and auto select parent node. + * + * @param inputUI ui containing tree + * @param topiaId node id to delete + */ + public void deleteTreeNode(InputUI inputUI, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); + FisheryTreeNode parentNode = newSelectNode.getParent(); + fisheryTreeHelper.selectNode(parentNode); + fisheryTreeHelper.removeNode(newSelectNode); + } + + /** + * Insert new tree node and select it. + * + * @param inputUI ui containing tree + * @param nodeClass node type to create + * @param topiaEntity node to insert + */ + public void insertTreeNode(InputUI inputUI, Class nodeClass, TopiaEntityContextable topiaEntity) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + + // on part du principe que pour ne pas compliquer les ui est les lier + // à l'arbre, on ajoute un nouveau noeud en fils de celui selectionné + // (ou son parent si la creation à lieu à partir d'un noeud bean) + FisheryTreeNode selectedNode = fisheryTreeHelper.getSelectedNode(); + if (selectedNode.isStaticNode()) { + selectedNode = selectedNode.getParent(); + } + + // must use loador to properly load species node + /*FisheryTreeNodeLoador typeNodeLoador = fisheryTreeHelper.getLoadorFor(nodeClass); + FisheryTreeNode newNode = null; + if (newNode != null) { + newNode = (FisheryTreeNode)typeNodeLoador.createNode(topiaEntity, null); + } + else { + // FIXME echatellier 20110418 cas non résolu du node "population" + // pour lequel on n'a pas le loador + newNode = new FisheryTreeNode(nodeClass, topiaEntity.getTopiaId(), null, null); + }*/ + + // FIXME echatellier 20110429 Hack en dur pour population + FisheryTreeNode newNode = new FisheryTreeNode(nodeClass, topiaEntity.getTopiaId(), null, null); + fisheryTreeHelper.insertNode(selectedNode, newNode); + if (nodeClass.equals(Species.class)) { + FisheryTreeNode newPopNode = new FisheryTreeNode( + Population.class, n_("isisfish.input.tree.populations"), + null, new PopulationsNodeLoador((Species)topiaEntity)); + fisheryTreeHelper.insertNode(newNode, newPopNode); + } + fisheryTreeHelper.selectNode(newNode); + } + + /** + * Update tree node for topiaId. + * + * @param inputUI ui containing tree + * @param topiaId node id to update + */ + public void updateTreeNode(InputUI inputUI, String topiaId) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId); + fisheryTreeHelper.refreshNode(newSelectNode, false); + } + + /** + * 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); + SensitivityInputHandler 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. + * + * @param inputUI input ui + * @return selected species + */ + public Species findSpecies(InputUI inputUI) { + // get selected node + FisheryTreeHelper treeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + FisheryTreeNode selectedNode = treeHelper.getSelectedNode(); + if (selectedNode == null) { + throw new IsisFishRuntimeException("Not selected tree node"); + } + + // look for parent node (Species type) + String speciesId = null; + FisheryTreeNode parentNode = selectedNode.getParent(); + if (parentNode.getInternalClass().equals(Species.class)) { + // cas selection du noeud type "Population" + speciesId = parentNode.getId(); + } + else if (parentNode.getParent().getInternalClass().equals(Species.class)) { + // cas où on est deja sur une population + speciesId = parentNode.getParent().getId(); + } + else { + throw new IsisFishRuntimeException("Not selected tree node"); + } + + // look for entities + TopiaContext topiaContext = inputUI.getContextValue(TopiaContext.class); + Species result = null; + try { + SpeciesDAO dao = IsisFishDAOHelper.getSpeciesDAO(topiaContext); + result = dao.findByTopiaId(speciesId); + } catch (TopiaException e) { + throw new IsisFishRuntimeException("Can't find "); + } + + return result; + } +} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,75 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.input; - -import java.awt.Component; -import java.awt.Dimension; - -import javax.swing.JTree; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer; - -/** - * Extention du NavigationTreeCellRenderer qui regle le probleme - * des noeuds tronqués par des ... - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class InputNavigationTreeCellRenderer extends NavigationTreeCellRenderer { - - /** - * Constructor with context. - * - * @param context jaxx context - */ - public InputNavigationTreeCellRenderer(JAXXContext context) { - super(context); - } - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean sel, boolean expanded, boolean leaf, int row, - boolean hasFocus) { - - Component c = super.getTreeCellRendererComponent(tree, value, sel, - expanded, leaf, row, hasFocus); - - // bugfix from http://forums.sun.com/thread.jspa?forumID=256&threadID=277338 - // hack from : http://forums.sun.com/thread.jspa?threadID=542069&tstart=824 - - if (delegate.getPreferredSize().getWidth() < 300) { - delegate.setPreferredSize(new Dimension(300, (int) delegate - .getPreferredSize().getHeight())); - } - - return c; - } -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,262 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.input; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; - -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; - -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder.ChildBuilder; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntity; - -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.Zone; - -/** - * InputNavigationTreeSelectionAdapter. - * - * @author letellier - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ -public class InputNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout { - - /** Class logger. */ - private static final Log log = LogFactory.getLog(InputNavigationTreeSelectionAdapter.class); - - protected NavigationTreeNode currentNode = null; - protected InputContentUI currentUI = null; - - public InputNavigationTreeSelectionAdapter(InputUI context) { - super(InputUI.class, null, context, Strategy.PER_UI_TYPE); - - if (context.getNavigation() == null) { - throw new IllegalArgumentException("could not have a null 'navigation' in ui " + context); - } - - // register in tree this listener - context.getNavigation().addTreeSelectionListener(this); - } - - @Override - protected JPanel getContentContainer() { - return ((InputUI) context).getInputPane(); - } - - @Override - protected CardLayout2 getContentLayout() { - return ((InputUI) context).getCardlayout(); - } - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return (NavigationTreeModel) ((InputUI) context).getNavigation().getModel(); - } - - @Override - protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) { - if (e != null) { - if (log.isErrorEnabled()) { - log.error("Error happen, go back to previous node" ,e); - } - } - // go back to previous node - returnToPreviousNode(getNavigationTree(), event); - if (log.isInfoEnabled()) { - log.info("goBackToPreviousNode"); - } - } - - - protected JAXXTree getNavigationTree() { - return ((InputUI) context).getNavigation(); - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - super.openUI(newUI, node); - // apply refresh method (should a contract for all this ui with a method refresh...) - try { - currentUI = (InputContentUI) newUI; - currentUI.setSensitivity(false); - InputSaveVerifier verifier = context.getContextValue(InputSaveVerifier.class); - verifier.removeAllPanels(); - verifier.addCurrentPanel(currentUI); - currentUI.refresh(); - // tabbed ui hack - currentUI.setActionButtons(); - currentNode = node; - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't open ui", e); - } - } - } - - @Override - protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception { - boolean exit = true; - // by default, we says that component was succesfull closed - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - int responce = verif.checkEdit(); - //boolean exit = checkEdit(event, component); - if (responce == JOptionPane.OK_OPTION) { - JTree tree = (JTree) event.getSource(); - NavigationTreeModel model = (NavigationTreeModel) tree.getModel(); - if (currentNode != null) { - model.nodeChanged(currentNode); - } - } - else if (responce == JOptionPane.CANCEL_OPTION) { - exit = false; - } - if (exit) { - verif.reset(); - } - return exit; - } - - @Override - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - verif.setRootPanel((InputUI)context); - verif.removeAllEntity(); - if (TopiaEntity.class.isInstance(data)){ - verif.addCurrentEntity((TopiaEntity) data); - } - verif.setCurrentNode(node); - } - - public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - if (regionName == null) { - return null; - } - - ChildBuilder<TopiaEntity> childBuilder = new ChildBuilder<TopiaEntity>(builder) { - - Decorator<? extends TopiaEntity> decorator; - - @Override - public void init(Class<? extends TopiaEntity> klass) { - decorator = jaxx.runtime.PropertyDecorator.newDecorator(klass, "name"); - } - - @Override - public Decorator<? extends TopiaEntity> getDecorator(TopiaEntity child) { - return decorator; - } - - @Override - public String getJXPath(TopiaEntity child) { - return "..[@topiaId=\"" + child.getTopiaId() + "\"]"; - } - - @Override - public String getNavigationPath(TopiaEntity child) { - return child.getTopiaId(); - } - }; - - try { - - NavigationTreeNode root = builder.build(null, regionName, JAXXContextEntryDef.newDef(FisheryRegion.class), "$root", FisheryRegionUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.cells"), "../cell", "$cells", CellUI.class, null), - true, Cell.class, fisheryRegion.getCell(), CellUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.zones"), "../zone", "$zones", ZoneUI.class, null), - true, Zone.class, fisheryRegion.getZone(), ZoneUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.ports"), "../port", "$ports", PortUI.class, null), - true, Port.class, fisheryRegion.getPort(), PortUI.class, null); - - NavigationTreeNode species = builder.build(root, _("isisfish.input.tree.species"), "../species", "$species", SpeciesUI.class, null); - - for (Species specie : fisheryRegion.getSpecies()) { - NavigationTreeNode speciesChild = builder.build(species,jaxx.runtime.PropertyDecorator.newDecorator(Species.class, "name"), "..[@topiaId=\"" + specie.getTopiaId() + "\"]", specie.getTopiaId(), SpeciesUI.class, null); - NavigationTreeNode populations = builder.build(speciesChild, _("isisfish.input.tree.populations"), "../population", "$populations", PopulationUI.class, null); - childBuilder.build(populations, true, Population.class, specie.getPopulation(), PopulationUI.class, null); - } - - childBuilder.build(builder.build(root, _("isisfish.input.tree.gears"), "../gear", "$gears", GearUI.class, null), - true, Gear.class, fisheryRegion.getGear(), GearUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.metiers"), "../metier", "$metiers", MetierUI.class, null), - true, Metier.class, fisheryRegion.getMetier(), MetierUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.triptypes"), "../tripType", "$tripTypes", TripTypeUI.class, null), - true, TripType.class, fisheryRegion.getTripType(), TripTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.vesseltypes"), "../vesselType", "$vesselTypes", VesselTypeUI.class, null), - true, VesselType.class, fisheryRegion.getVesselType(), VesselTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.setofvessels"), "../setOfVessels", "$setOfVessels", SetOfVesselsUI.class, null), - true, SetOfVessels.class, fisheryRegion.getSetOfVessels(), SetOfVesselsUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.strategies"), "../strategy", "$strategies", StrategyUI.class, null), - true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null); - - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error(ex.getMessage(), ex); - } - } - return builder.getModel(); - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,12 +22,12 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='org.nuiton.topia.persistence.TopiaEntityContextable'> <!-- Equation name (just for display purpose, not mandatory) --> <String id='text' javaBean='null'/> <!-- Bean containing equation --> - <org.nuiton.topia.persistence.TopiaEntity id='bean' javaBean='null'/> + <org.nuiton.topia.persistence.TopiaEntityContextable id='bean' javaBean='null'/> <!-- Bean property used to access equation --> <String id='beanProperty' javaBean='null'/> <!-- Used to get documentation in opened editor (not mandatory) --> @@ -40,57 +40,65 @@ <!-- Selected equation --> <fr.ifremer.isisfish.entities.Equation id='selectedEquation' javaBean='null'/> + <Boolean id="autoSaveModification" javaBean="true" /> + + <import> + java.lang.reflect.Method; + java.io.File; + fr.ifremer.isisfish.entities.Formule; + fr.ifremer.isisfish.entities.Equation; + fr.ifremer.isisfish.ui.input.formule.FormuleComboModel; + org.apache.commons.lang.StringUtils; + org.nuiton.topia.TopiaContext; + javax.swing.event.DocumentListener; + javax.swing.event.DocumentEvent + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + java.io.IOException + javax.swing.DefaultComboBoxModel + </import> <script><![CDATA[ -import java.lang.reflect.Method; -import java.io.File; -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.ui.input.formule.FormuleComboModel; -import org.apache.commons.lang.StringUtils; -import org.nuiton.topia.TopiaContext; protected DocumentListener listener = null; -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - formuleComboBox.setModel(new DefaultComboBoxModel()); - try { - editor.open(org.nuiton.util.FileUtil.getTempFile("", ".java")); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Error on property change", e); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + formuleComboBox.setModel(new DefaultComboBoxModel()); + try { + File nullFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); + editor.open(nullFile); + editor.setEnabled(false); // editor is replaced at each launch + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Error on property change", e); + } } } + if (evt.getNewValue() != null) { + // chatellier 20090526 : force refresh in bean change ? + refresh(); + } } - if (evt.getNewValue() != null) { - // chatellier 20090526 : force refresh in bean change ? - refresh(); - } - } -}); -start(); -protected void start() { - if (listener == null) { + }); + + if (listener == null) { listener = new DocumentListener() { - @Override public void insertUpdate(DocumentEvent e) { setEquation(); } - @Override public void removeUpdate(DocumentEvent e) { setEquation(); } - @Override public void changedUpdate(DocumentEvent e) { } }; } setComboModel(); - editor.getCurrentEditor().addDocumentListener(listener); } /** @@ -103,7 +111,7 @@ // content is managed by caller, can do anythings here if (bean != null && beanProperty != null) { String localBeanProperty = StringUtils.capitalize(beanProperty); - Method m = bean.getClass().getMethod("get" + localBeanProperty, null); + Method m = bean.getClass().getMethod("get" + localBeanProperty); result = (Equation)m.invoke(bean); } } catch (Exception e) { @@ -142,7 +150,6 @@ } } - at Override public void refresh() { // TODO binding don't work @@ -154,6 +161,7 @@ try { File equationContentFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); editor.open(equationContentFile); + editor.setEnabled(isActive()); } catch (IOException ex) { if (log.isErrorEnabled()) { log.error("Can't refresh editor", ex); @@ -166,17 +174,18 @@ setFormule((Formule)formuleComboBox.getSelectedItem()); setEditorText(); } - editor.getCurrentEditor().addDocumentListener(listener); -} - at Override -public void setActionButtons() { - + // utilisee lors de l'edition des equations dans l'interface de sensibilité + // le contenu de l'equation ne doit pas automatiquement + // etre sauvé dans l'entité (pas de sens pour un facteur discret de type equation) + if (autoSaveModification) { + editor.getCurrentEditor().addDocumentListener(listener); + } } protected void setComboModel() { if (getBean() != null){ - TopiaContext isisContext = getBean().getTopiaContext(); + TopiaContext isisContext = ((org.nuiton.topia.persistence.TopiaEntityAbstract)getBean()).getTopiaContext(); java.util.List<Formule> formules = null; if (formuleCategory != null) { formules = getAction().getFormules(isisContext, formuleCategory); @@ -199,10 +208,10 @@ protected void openEditor() { Formule e = (Formule)formuleComboBox.getSelectedItem(); if (e != null) { - getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor); + getContextValue(InputAction.class).openEditor(this, e.getCategory(), e.getName(), clazz, e.getContent(), editor); } else { - getContextValue(InputAction.class).openEditor(formuleCategory, "new", clazz, editor.getText(), editor); + getContextValue(InputAction.class).openEditor(this, formuleCategory, "new", clazz, editor.getText(), editor); } } protected void setEditorText() { @@ -211,7 +220,8 @@ } else { try { - editor.open(org.nuiton.util.FileUtil.getTempFile("", ".java")); + File nullFile = org.nuiton.util.FileUtil.getTempFile("", ".java"); + editor.open(nullFile); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Open editor", e); @@ -230,39 +240,41 @@ } ]]> </script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text='{getText()}' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="formuleComboBox" onActionPerformed='formuleChanged()' enabled='{isActif()}' - renderer="{new fr.ifremer.isisfish.ui.input.formule.FormuleComboRenderer()}" /> - </cell> - </row> - <row> - <cell fill='both' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal'> - <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif() && formuleCategory != null}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif() && clazz != null && formuleCategory != null}'/> - </cell> - </row> - <row> - <cell fill='horizontal' weighty='1.0'> - <JPanel/> - </cell> - </row> - </Table> - </cell> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text='{getText()}' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="formuleComboBox" onActionPerformed='formuleChanged()' enabled='{isActive()}' + renderer="{new fr.ifremer.isisfish.ui.input.formule.FormuleComboRenderer()}" /> + </cell> + </row> + <row> + <cell fill='both' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal'> + <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActive() && formuleCategory != null}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActive() && clazz != null && formuleCategory != null}'/> + </cell> + </row> + <row> + <cell fill='horizontal' weighty='1.0'> + <JPanel/> + </cell> + </row> + </Table> + </cell> + <cell fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -29,26 +29,20 @@ import java.awt.Component; import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; -import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; -import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; +import jaxx.runtime.JAXXUtil; import org.apache.commons.beanutils.MethodUtils; import org.apache.commons.lang.ClassUtils; @@ -58,11 +52,11 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityContextable; import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.ui.SaveVerifier; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; -import fr.ifremer.isisfish.ui.util.ErrorHelper; /** * InputSaveVerifier. @@ -78,144 +72,92 @@ /** Class logger. */ private static Log log = LogFactory.getLog(InputSaveVerifier.class); - /** New button. Used to create new {@link #type} component. */ - protected JButton currentNewButton = null; - /** Delete button. */ - protected JButton currentDeleteButton = null; - /** Save button. */ - protected JButton currentSaveButton = null; - /** Cancel button. */ - protected JButton currentCancelButton = null; + /** Current entity modification state (modifier by PCL). */ + protected boolean changed = false; - protected ActionListener saveListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaSave(); - } - }; + /** L'ui en cours d'edition (au plus bas niveau des tabPane). */ + protected InputContentUI<?> inputContentUI; - protected ActionListener cancelListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaCancel(); - } - }; + /** Map entity key to {@link TopiaEntity}. */ + protected HashMap<String, TopiaEntityContextable> currentEntities = new HashMap<String, TopiaEntityContextable>(); - protected ActionListener newListener = new ActionListener() { + /** Intance unique de PCL pour pouvoir être ajouter et supprimé au bon moment. */ + protected PropertyChangeListener entityPCL = new PropertyChangeListener() { @Override - public void actionPerformed(ActionEvent e) { - topiaCreate(); + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug("PropertyChanged : " + + evt.getPropertyName() + + " New Value : " + evt.getNewValue()); + } + topiaChanged(); } }; - protected ActionListener deleteListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaRemove(); - } - }; + public InputContentUI<?> getInputContentUI() { + return inputContentUI; + } - /** Entity type for new creation. */ - protected String type = null; + public void setInputContentUI(InputContentUI<?> inputContentUI) { + this.inputContentUI = inputContentUI; + } - protected boolean editable = false; - protected boolean changed = false; - - protected NavigationTreeNode currentNode = null; - protected String currentOnglet = null; - - protected TopiaContext isisContext = null; - /** - * Map entity key to {@link TopiaEntity}. + * Tell verifier to check for unsaved modification. + * + * Then return user choice ({@link javax.swing.JOptionPane} type). + * + * @return user JOptionPane response + * @see javax.swing.JOptionPane#YES_OPTION + * @see javax.swing.JOptionPane#NO_OPTION + * @see javax.swing.JOptionPane#CANCEL_OPTION */ - protected HashMap<String, TopiaEntity> currentEntities = new HashMap<String, TopiaEntity>(); - protected HashSet<InputContentUI> currentPanels = new HashSet<InputContentUI>(); - - protected InputUI rootUI; - protected SensitivityTabUI sensUI; - @Override public int checkEdit() { int response = JOptionPane.NO_OPTION; - if (editable) { - if (changed) { - // ask user to close edition - // still in edit mode, must warn user - response = askUser(_("isisfish.message.page.modified")); - if (response == JOptionPane.NO_OPTION) { - topiaCancel(); - } else if (response == JOptionPane.YES_OPTION) { - topiaSave(); - } + if (changed) { + // ask user to close edition + // still in edit mode, must warn user + response = JOptionPane.showConfirmDialog(null, _("isisfish.message.page.modified"), + _("isisfish.input.menu.commit"), JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE); + if (response == JOptionPane.NO_OPTION) { + cancel(); + } else if (response == JOptionPane.YES_OPTION) { + save(); } } return response; } - /** - * Ask user option to save non saved datas. - * - * @param message message to display - * @return user option - */ - protected int askUser(String message) { - int response = JOptionPane.showConfirmDialog(rootUI, message, - _("isisfish.input.menu.commit"), - JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); - return response; - } - + /* Called by entity property change listener on data change.*/ protected void topiaChanged() { changed = true; - setPanelsActifs(); - setEnabled(currentSaveButton, true); - setEnabled(currentCancelButton, true); - setEnabled(currentNewButton, false); - setEnabled(currentDeleteButton, false); } + /** + * Called by this class when entity modification state has been reset. + * (cancel, save...) + */ protected void noModif() { changed = false; - setPanelsActifs(); - setEnabled(currentSaveButton, false); - setEnabled(currentCancelButton, false); - setEnabled(currentNewButton, true); - setEnabled(currentDeleteButton, editable); } /** - * Set component enabled state. - * - * @param c component - * @param enabled enabled state - */ - protected void setEnabled(Component c, boolean enabled) { - if (c != null) { - c.setEnabled(enabled); - } - } - - /** * Delete one entity and commit the change, try to selected intelligently * other node in tree. * <p/> * Refresh all ui component where name match "input<entity type without * package >.*" */ - protected void topiaRemove() { - if (log.isTraceEnabled()) { - log.trace("remove called"); - } + public void delete() { String msg = ""; try { boolean doDelete; - TopiaEntity topiaEntity = (TopiaEntity) currentNode - .getJAXXContextValue(rootUI); + TopiaEntityContextable topiaEntity = inputContentUI.getBean(); List<TopiaEntity> allWillBeRemoved = topiaEntity.getComposite(); if (allWillBeRemoved.size() > 0) { - String label = _("isisfish.message.delete.object", topiaEntity - .toString()); + String label = _("isisfish.message.delete.object", topiaEntity.toString()); String text = ""; for (TopiaEntity e : allWillBeRemoved) { text += ClassUtils.getShortClassName(e.getClass()) + " - " @@ -226,8 +168,7 @@ JOptionPane.YES_NO_OPTION); doDelete = resp == JOptionPane.YES_OPTION; } else { - String text = _("isisfish.message.confirm.delete.object", - topiaEntity.toString()); + String text = _("isisfish.message.confirm.delete.object", topiaEntity.toString()); int resp = JOptionPane.showConfirmDialog(null, text, _("isisfish.message.delete.entity"), JOptionPane.YES_NO_OPTION); @@ -236,85 +177,53 @@ if (doDelete) { topiaEntity.delete(); - isisContext.commitTransaction(); + topiaEntity.getTopiaContext().commitTransaction(); + + noModif(); + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().deleteTreeNode(inputUI, topiaEntity.getTopiaId()); + msg = _("isisfish.message.remove.finished"); } else { msg = _("isisfish.message.remove.canceled"); } - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't remove entity: " - + currentEntities.get(0), eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.removeentity"), eee); + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't remove entity: " + currentEntities.get(0), eee); } - rootUI.setStatusMessage(msg); - // set noModif BEFORE path changed - noModif(); - String path = currentNode.getParent().getContextPath(); - rootUI.setTreeModel(); - rootUI.setTreeSelection(path); } /** - * Display a JOptionPane with a JTextArea as main component. + * Create new {@code type} entity. * - * @param parent parent - * @param labelMessage label message - * @param textMessage text message into area - * @param title - * @param option - * @return user response + * @param type */ - protected int showTextAreaConfirmationMessage(Component parent, - String labelMessage, String textMessage, String title, int option) { - JLabel labelForMessage = new JLabel(labelMessage); - JTextArea areaForMessage = new JTextArea(textMessage); - areaForMessage.setEditable(false); - areaForMessage.setAutoscrolls(true); - JScrollPane spMessage = new JScrollPane(areaForMessage); - spMessage.setPreferredSize(new Dimension(500, 100)); // don't remove popup is huge + public void create(Class<? extends TopiaEntityContextable> type) { - int response = JOptionPane.showConfirmDialog(parent, new Object[] { - labelForMessage, spMessage }, title, option); - return response; - } - - protected void topiaCreate() { - if (log.isDebugEnabled()) { log.debug("Create called for " + type); } try { - String name = type + "_new"; + String typeSimpleName = type.getSimpleName(); + String name = typeSimpleName + "_new"; - Method method = MethodUtils.getAccessibleMethod( - IsisFishDAOHelper.class, "get" + type + "DAO", - TopiaContext.class); - TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke( - null, isisContext); + // use introspection to call IsisFishDAOHelper.getXXXDAO() + TopiaContext topiaContext = inputContentUI.getTopiaContext(); + Method method = MethodUtils.getAccessibleMethod(IsisFishDAOHelper.class, + "get" + typeSimpleName + "DAO", TopiaContext.class); + TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke(null, topiaContext); - TopiaEntity entity = dao.create("name", name); - entity.update(); - isisContext.commitTransaction(); + // create new entity + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)dao.create("name", name); + // entity.update(); FIXME mandatory ??? + topiaContext.commitTransaction(); - String path = currentNode.getParent().getContextPath() + "/" - + entity.getTopiaId(); - if (!editable) { - path = currentNode.getContextPath() + "/" + entity.getTopiaId(); - } + InputUI inputUI = inputContentUI.getContextValue(InputUI.class, JAXXUtil.PARENT); + inputUI.getHandler().insertTreeNode(inputUI, type, topiaEntity); - rootUI.setTreeModel(); - rootUI.setTreeSelection(path); - - rootUI.setStatusMessage(_("isisfish.message.creation.finished")); - + //rootUI.setStatusMessage(_("isisfish.message.creation.finished")); } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create entity", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.createentity"), eee); + throw new IsisFishRuntimeException(_("isisfish.error.input.createentity"), eee); } } @@ -324,33 +233,34 @@ * Change registered button states. * Commit opened topia context. */ - protected void topiaSave() { + public void save() { + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); + TopiaContext topiaContext = inputContentUI.getTopiaContext(); + try { - noModif(); - for (TopiaEntity t : currentEntities.values()) { - t.update(); + for (TopiaEntityContextable entity : currentEntities.values()) { + entity.update(); if (log.isDebugEnabled()) { - log.debug("updating : " + t); + log.debug("Updating verifier entity : " + entity); } } - isisContext.commitTransaction(); - rootUI.repaintNode(currentNode.getContextPath()); - rootUI.setStatusMessage(_("isisfish.message.save.finished")); - } catch (TopiaException eee) { + topiaContext.commitTransaction(); + + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().updateTreeNode(inputUI, topiaEntity.getTopiaId()); + + noModif(); + //rootUI.setStatusMessage(_("isisfish.message.save.finished")); + } catch (TopiaException eee) { // EC-20100401 : ajouté pour avoir un context // correct apres un erreur, sinon, on ne peut plus rien faire // rien sauver d'autre... try { - isisContext.rollbackTransaction(); - if (log.isErrorEnabled()) { - log.error("Can't save entity", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.saveentity"), eee); + topiaContext.rollbackTransaction(); + throw new IsisFishRuntimeException(_("isisfish.error.input.saveentity"), eee); } catch (TopiaException eee2) { - if (log.isErrorEnabled()) { - log.error("Can't save or rollback entity", eee2); - } + throw new IsisFishRuntimeException(_("isisfish.error.input.saveentity"), eee2); } } } @@ -358,68 +268,67 @@ /** * Cancel all modification on entity (rollback), and force reload it. */ - protected void topiaCancel() { + public void cancel() { + TopiaContext topiaContext = inputContentUI.getTopiaContext(); + TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); try { + topiaContext.rollbackTransaction(); noModif(); - isisContext.rollbackTransaction(); - Map<String, TopiaEntity> canceledEntity = (Map<String, TopiaEntity>)currentEntities.clone(); + // sans cette boucle + // une annulation/sauvegarde provoque l'erreur + // org.hibernate.NonUniqueObjectException: a different object with + // the same identifier value was already associated with the session + Map<String, TopiaEntityContextable> canceledEntity = (Map<String, TopiaEntityContextable>)currentEntities.clone(); currentEntities.clear(); - for (Entry<String, TopiaEntity> currentEntity : canceledEntity.entrySet()) { - TopiaEntity t = isisContext.findByTopiaId(currentEntity.getValue().getTopiaId()); - - // TODO a quoi ca sert de recharger les entités ? - // desynchronise la précédente - // fix : org.hibernate.NonUniqueObjectException: a different object with the - // same identifier value was already associated with the session - //((TopiaContextImpl)isisContext).getHibernate().evict(t2); - //t.setTopiaId(null); - - rootUI.repaintNode(currentNode.getContextPath()); - rootUI.setTreeSelection(currentNode.getContextPath()); - + for (Entry<String, TopiaEntityContextable> currentEntity : canceledEntity.entrySet()) { + TopiaEntityContextable t = (TopiaEntityContextable)topiaContext.findByTopiaId(currentEntity.getValue().getTopiaId()); String key = currentEntity.getKey(); addCurrentEntity(t, key); } - // refresh all registred panel + InputUI inputUI = inputContentUI.getParentContainer(InputUI.class); + inputUI.getHandler().updateTreeNode(inputUI, topiaEntity.getTopiaId()); + + // refresh all registered panel // to discard modification in UI - refreshAll(); - rootUI.setStatusMessage(_("isisfish.message.cancel.finished")); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't cancel modification in region", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.cancelentity"), eee); + //refreshAll(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaEntity.getTopiaId()); + InputContentUI inputContentUI2 = inputContentUI; + inputContentUI2.setBean(null); + inputContentUI2.setBean(topiaEntity); + //rootUI.setStatusMessage(_("isisfish.message.cancel.finished")); + } catch (TopiaException eee) { + throw new IsisFishRuntimeException(_("isisfish.error.input.cancelentity"), eee); } } - protected void setPanelsActifs() { - for (InputContentUI panel : currentPanels) { - panel.setActif(editable); - } - } - /** - * Refresh all registered {@link InputContentUI} component. + * Display a JOptionPane with a JTextArea as main component. * - * Call {@link InputContentUI#refresh()} method on each component. + * @param parent parent + * @param labelMessage label message + * @param textMessage text message into area + * @param title + * @param option + * @return user response */ - public void refreshAll() { - - // chatellier 20090602 refresh() call addCurrentPanel - // and cause ConcurentModificationException. - Set<InputContentUI> panelsToRefresh = (HashSet<InputContentUI>)currentPanels.clone(); - for (InputContentUI panel : panelsToRefresh) { - if (log.isDebugEnabled()) { - log.debug("Verifier refresh ui : " + panel); - } - panel.refresh(); - // do not call refresh action buttons here - panel.setActif(editable); - } + protected int showTextAreaConfirmationMessage(Component parent, + String labelMessage, String textMessage, String title, int option) { + JLabel labelForMessage = new JLabel(labelMessage); + JTextArea areaForMessage = new JTextArea(textMessage); + areaForMessage.setEditable(false); + areaForMessage.setAutoscrolls(true); + JScrollPane spMessage = new JScrollPane(areaForMessage); + spMessage.setPreferredSize(new Dimension(500, 100)); // don't remove popup is huge + + int response = JOptionPane.showConfirmDialog(parent, new Object[] { + labelForMessage, spMessage }, title, option); + return response; } + + /** * Add entity to check for modification. * @@ -431,34 +340,12 @@ * Remove all entity with key * * @param currentEntity entity to check - * @param key specific key (defaut to topiaId) + * @param key specific key (default to topiaId) */ - public void addCurrentEntity(TopiaEntity currentEntity, String key) { + public void addCurrentEntity(TopiaEntityContextable currentEntity, String key) { if (currentEntity != null) { - editable = true; - isisContext = currentEntity.getTopiaContext(); - currentEntity - .addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("PropertyChanged : " - + evt.getPropertyName() - + " New Value : " + evt.getNewValue()); - } - topiaChanged(); - } - }); - // chatellier 20090602 , pas sur du code suivant - // plutot ne rien faire, si une autre entite de la meme - // clé est ajoutée, elle sera ecrasée - //TopiaEntity entity = getEntity(currentEntity.getClass()); - //if (entity != null) { - // currentEntities.remove(entity); - //} - + currentEntity.addPropertyChangeListener(entityPCL); this.currentEntities.put(key, currentEntity); - setPanelsActifs(); } } @@ -474,118 +361,32 @@ * * @param currentEntity entity to check */ - public void addCurrentEntity(TopiaEntity currentEntity) { + public void addCurrentEntity(TopiaEntityContextable currentEntity) { if (currentEntity != null) { addCurrentEntity(currentEntity, currentEntity.getTopiaId()); } } + /** + * Reset state. + */ public void reset() { - removeAllEntity(); - removeAllPanels(); - this.currentCancelButton = null; - this.currentDeleteButton = null; - this.currentNewButton = null; - this.currentSaveButton = null; - this.currentOnglet = null; - this.currentNode = null; - } - - public void removeAllEntity() { + // il faut absolument supprimer les property change listener + // sinon, lors de la selection d'une espece, à la creation + // d'une population, le PCL est declanché, et l'abre + // croit qu'il y a eu une modification et il boucle + for (TopiaEntity entity : currentEntities.values()) { + entity.removePropertyChangeListener(entityPCL); + } currentEntities.clear(); - editable = false; noModif(); - setPanelsActifs(); } - public void addCurrentPanel(InputContentUI... panels) { - for (InputContentUI ui : panels) { - editable = !currentEntities.isEmpty(); - this.currentPanels.add(ui); - if (rootUI == null) { - ui.setSensitivity(true); - ui.setLayer(true); - } - ui.refresh(); - // do not call refresh action buttons here - ui.setActif(editable); - } - } - - public void removeAllPanels() { - currentPanels.clear(); - } - - public boolean isEditable() { - return editable; - } - - public void setSaveButton(JButton saveButton) { - setSaveButton(saveButton, true); - } - - public void setSaveButton(JButton saveButton, Boolean listener) { - if (listener) { - // TODO what is it for (remove/readd) ? - saveButton.removeActionListener(saveListener); - saveButton.addActionListener(saveListener); - } - saveButton.setEnabled(changed); - saveButton.setText(_("isisfish.common.save")); - this.currentSaveButton = saveButton; - } - - public void setNewButton(JButton saveButton, String name) { - setNewButton(saveButton, name, true); - } - - public void setNewButton(JButton newButton, String t, Boolean listener) { - if (listener) { - // TODO what is it for (remove/readd) ? - newButton.removeActionListener(newListener); - newButton.addActionListener(newListener); - } - newButton.setText(_("isisfish.common.new")); - newButton.setEnabled(!changed); - this.type = t; - this.currentNewButton = newButton; - } - - public void setCancelButton(JButton cancelButton) { - cancelButton.removeActionListener(cancelListener); - cancelButton.addActionListener(cancelListener); - cancelButton.setText(_("isisfish.common.cancel")); - cancelButton.setEnabled(changed); - this.currentCancelButton = cancelButton; - } - - public void setDeleteButton(JButton deleteButton) { - setDeleteButton(deleteButton, true); - } - - public void setDeleteButton(JButton deleteButton, boolean listener) { - if (listener) { - deleteButton.removeActionListener(deleteListener); - deleteButton.addActionListener(deleteListener); - } - deleteButton.setEnabled(editable); - deleteButton.setText(_("isisfish.common.remove")); - this.currentDeleteButton = deleteButton; - } - - public TopiaContext getIsisContext() { - return isisContext; - } - - public Collection<TopiaEntity> getCurrentEntities() { - return currentEntities.values(); - } - - public <E extends TopiaEntity> E getEntity(Class<E> clazz, String key) { + public <E extends TopiaEntityContextable> E getEntity(Class<E> clazz, String key) { return (E) currentEntities.get(key); } - public <E extends TopiaEntity> E getEntity(Class<E> clazz) { + public <E extends TopiaEntityContextable> E getEntity(Class<E> clazz) { for (TopiaEntity te : currentEntities.values()) { if (clazz.isInstance(te)) { return (E) te; @@ -593,40 +394,4 @@ } return null; } - - public String getCurrentOnglet() { - return currentOnglet; - } - - public NavigationTreeNode getCurrentNode() { - return currentNode; - } - - public void setIsisContext(TopiaContext isisContext) { - this.isisContext = isisContext; - } - - public void setEditable(boolean editable) { - this.editable = editable; - } - - public void setCurrentOnglet(String currentOnglet) { - this.currentOnglet = currentOnglet; - } - - public void setCurrentNode(NavigationTreeNode currentNode) { - this.currentNode = currentNode; - } - - protected void setRootPanel(InputUI inputUI) { - this.rootUI = inputUI; - } - - public SensitivityTabUI getSensPanel() { - return sensUI; - } - - public void setSensPanel(SensitivityTabUI sensUI) { - this.sensUI = sensUI; - } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -32,11 +32,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.persistence.TopiaEntityContextable; +import fr.ifremer.isisfish.ui.SaveVerifier; + /** * Listener used to control InputUI tab panel switching. - * - * Ask for * * @author letellier * @version $Revision: 1312 $ @@ -53,29 +54,35 @@ @Override public void stateChanged(ChangeEvent e) { + JTabbedPane pane = (JTabbedPane) e.getSource(); + + // to not fire additional event during tab index management pane.removeChangeListener(this); + + // reselect previous tab (and ask user to change) int selectedIndex = pane.getSelectedIndex(); if (cacheSelectedIndex != -1) { pane.setSelectedIndex(cacheSelectedIndex); } InputContentUI ui = (InputContentUI) pane.getSelectedComponent(); - if (closeUI(ui)) { + InputSaveVerifier saveVerifier = (InputSaveVerifier)ui.getContextValue(InputSaveVerifier.class); + if (canChangeTab(saveVerifier)) { pane.setSelectedIndex(selectedIndex); } ui = (InputContentUI) pane.getSelectedComponent(); - if (log.isDebugEnabled()) { - log.debug("Final refresh " + ui); - } - + // refresh can be broken // especially during new region creation // don't break refresh cycle try { - ui.refresh(); + TopiaEntityContextable entity = ui.getBean(); + // refresh ui + ui.setBean(null); + ui.setBean(entity); } catch (Exception eee) { - if(log.isErrorEnabled()) { + if (log.isErrorEnabled()) { log.error("Error during UI refresh", eee); } } @@ -86,7 +93,6 @@ if (log.isDebugEnabled()) { log.debug("Activating action buttons on " + ui); } - ui.setActionButtons(); cacheSelectedIndex = pane.getSelectedIndex(); pane.addChangeListener(this); @@ -99,18 +105,16 @@ /** * Ask you to save if modification are made. * - * @param currentUI current displayed UI + * @param saveVerifier save verifier * @return true to change tab */ - protected boolean closeUI(InputContentUI currentUI) { + protected boolean canChangeTab(SaveVerifier saveVerifier) { // by default, we says that component was successfully closed boolean exit = true; - InputSaveVerifier verif = currentUI - .getContextValue(InputSaveVerifier.class); - int responce = verif.checkEdit(); + int response = saveVerifier.checkEdit(); - if (responce == JOptionPane.CANCEL_OPTION) { + if (response == JOptionPane.CANCEL_OPTION) { exit = false; } return exit; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,226 +22,31 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<fr.ifremer.isisfish.ui.NavigationUI> - <javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <InputHandler id="handler" /> - <InputNavigationTreeCellRenderer id='navigationTreeCellRenderer' constructorParams='this'/> + <Boolean id="regionLoaded" javaBean="false" /> - <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> - - <java.awt.CardLayout id='cardlayoutPrincipal'/> - - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='region' javaBean='null'/> - - <script><![CDATA[ -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.StorageChangeEvent; -import fr.ifremer.isisfish.datastore.StorageChangeListener; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; -import fr.ifremer.isisfish.ui.Common; -import fr.ifremer.isisfish.ui.WelcomeSaveVerifier; -import fr.ifremer.isisfish.ui.WelcomePanelUI; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import org.nuiton.topia.TopiaContext; - -getContextValue(WelcomeSaveVerifier.class).addSaveVerifier(getVerifier()); - -new fr.ifremer.isisfish.ui.input.InputNavigationTreeSelectionAdapter(this); - -StorageChangeListener regionStorageListener; -regionStorageListener = new StorageChangeListener() { - @Override - public void versionDataChanged(StorageChangeEvent e) { - setFieldCurrentRegionModel(); - } -}; -RegionStorage.addStorageChangeListener(regionStorageListener); - -protected InputAction getAction() { - return getContextValue(InputAction.class); -} -protected InputSaveVerifier getVerifier() { - return getContextValue(InputSaveVerifier.class); -} -protected RegionStorage getRegionStorage() { - return getContextValue(RegionStorage.class); -} -protected void setFieldCurrentRegionModel() { - fieldCurrentRegion.setModel(getFieldCurrentRegionModel()); -} -protected DefaultComboBoxModel getFieldCurrentRegionModel() { - return new DefaultComboBoxModel(Common.getRegionItem()); -} -protected void regionChange(ItemEvent e) { - // event launched twice with itemchange listener - if (e.getStateChange() == ItemEvent.SELECTED) { - final String name = fieldCurrentRegion.getSelectedItem().toString(); - if (log.isDebugEnabled()) { - log.debug("Region change, selected : " + name); - } - - // long operation, run status bar - setStatusMessage(_("isisfish.message.loading.region", name), true); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - loadRegion(name); - getVerifier().setIsisContext(getContextValue(TopiaContext.class)); - setStatusMessage(_("isisfish.message.load.finished")); - setTreeModel(); - } - }); - } -} -protected void loadRegion(String name) { - if (log.isDebugEnabled()) { - log.debug("Loadregion : " + name); - } - setRegion((FisheryRegionImpl)getAction().loadRegion(this, name)); - if (getRegion() == null) { - regionNull(); - } - else { - setTreeModel(); - getCardlayoutPrincipal().show(inputPanePrincipal,"normale"); - } -} -protected void setTreeModel() { - if (getRegion() != null) { - String regionName = getRegion().getName(); - setContextValue(getRegion()); - NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion()); - - setContextValue(model); - navigation.setModel(model); - setTreeSelection("$root"); - - /*TC-20090702 Fix bug #1772 - EC-20090706 no working solution found - model.nodeChanged(model.getRoot()); - java.util.Enumeration<?> e = model.getRoot().children(); - while (e.hasMoreElements()) { - NavigationTreeNode n = (NavigationTreeNode) e.nextElement(); - String contextPath = n.getContextPath(); - if (contextPath.equals("$root/$cells")) { - //TC-20090702 : ce noeud est trop long a recharger - continue; - } - log.debug("reload node " + contextPath); - model.nodeChanged(n); - java.util.Enumeration<?> e2 = n.children(); - while (e2.hasMoreElements()) { - NavigationTreeNode n2 = (NavigationTreeNode) e2.nextElement(); - n2.getJAXXContextValue(InputUI.this); - } - }*/ - } -} - -public void repaintNode(String path) { - NavigationTreeModel model = getContextValue(NavigationTreeModel.class); - NavigationTreeNode currentNode = model.findNode(path); - model.nodeChanged(currentNode); -} -public void setTreeSelection(String path) { - NavigationTreeNode node = NavigationUtil.findNode(this, null, path); - TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node)); - navigation.setSelectionPath(pathToRoot); - navigation.scrollPathToVisible(pathToRoot); -} -protected void setStatusMessage(String s) { - WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); - root.setStatusMessage(s); -} -protected void setStatusMessage(String s, boolean running) { - WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); - root.setStatusMessage(s, running); -} -protected void newRegion() { - String name = fieldNewRegion.getText(); - setStatusMessage(_("isisfish.message.creating.region", name), true); - getContextValue(InputAction.class).newRegion(name); - fieldCurrentRegion.setSelectedItem(name); - JButtonNewRegion.setEnabled(false); - fieldNewRegion.setText(""); - setStatusMessage(_("isisfish.message.creation.finished")); -} -protected void regionNull() { - getCardlayoutPrincipal().show(inputPanePrincipal,"none"); - DefaultTreeModel model = new DefaultTreeModel(null); - navigation.setModel(model); -} -protected void newChanged() { - JButtonNewRegion.setEnabled(true); -} -protected void importRegion() { - setStatusMessage(_("isisfish.message.import.zip"), true); - getContextValue(InputAction.class).importRegion(); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importRegionAndRename() { - setStatusMessage(_("isisfish.message.import.zip"), true); - getContextValue(InputAction.class).importRegionAndRename(); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importV2Region() { - setStatusMessage(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region(), true); - setStatusMessage(_("isisfish.message.import.finished")); -} -protected void importRegionFromSimulation() { - setStatusMessage(_("isisfish.message.import", getContextValue(InputAction.class).importRegionFromSimulation()), true); - setStatusMessage(_("isisfish.message.export.done")); -} -protected void exportRegion() { - setStatusMessage(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion(getRegionStorage())), true); - setStatusMessage(_("isisfish.message.export.done")); -} -protected void copyRegion() { - // TODO region name in not knwon before copy - setStatusMessage(_("isisfish.message.copy.region"), true); - getContextValue(InputAction.class).copyRegion(getRegionStorage()); - setStatusMessage(_("isisfish.message.copy.finished")); -} -protected void removeRegion(boolean deletecvs) { - setStatusMessage(_("isisfish.message.removing.region", getRegionStorage().getName()), true); - boolean deleted = getContextValue(InputAction.class).removeRegion(getRegionStorage(), deletecvs); - if (deleted) { - setStatusMessage(_("isisfish.message.region.removed")); - regionNull(); - } - else { - setStatusMessage(_("isisfish.message.region.remove.canceled")); - } -} -protected void commitRegionInCVS() { - setStatusMessage(_("isisfish.message.commiting.region", getRegionStorage().getName()), true); - setStatusMessage(getContextValue(InputAction.class).commitRegionInCVS(getRegionStorage())); -} - ]]> - </script> <JMenuBar id="menu" constraints='BorderLayout.NORTH'> <JMenu text="isisfish.common.region"> - <JMenuItem text="isisfish.input.menu.importRegion" onActionPerformed="importRegion()" /> - <JMenuItem text="isisfish.input.menu.importRenameRegion" onActionPerformed="importRegionAndRename()" /> - <JMenuItem text="isisfish.input.menu.importRegionV2" onActionPerformed="importV2Region()" /> - <JMenuItem text="isisfish.input.menu.importRegionSimulation" onActionPerformed="importRegionFromSimulation()" /> - <JMenuItem text="isisfish.input.menu.exportRegion" enabled='{getRegion() != null}' onActionPerformed="exportRegion()" /> - <JMenuItem text="isisfish.input.menu.copyRegion" enabled='{getRegion() != null}' onActionPerformed="copyRegion()" /> + <JMenuItem text="isisfish.input.menu.importRegion" onActionPerformed="getHandler().importRegion(this)" /> + <JMenuItem text="isisfish.input.menu.importRenameRegion" onActionPerformed="getHandler().importRegionAndRename(this)" /> + <JMenuItem text="isisfish.input.menu.importRegionV2" onActionPerformed="getHandler().importV2Region(this)" /> + <JMenuItem text="isisfish.input.menu.importRegionSimulation" onActionPerformed="getHandler().importRegionFromSimulation(this)" /> + <JMenuItem text="isisfish.input.menu.exportRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().exportRegion(this)" /> + <JMenuItem text="isisfish.input.menu.copyRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().copyRegion(this)" /> <JSeparator/> - <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocaly" enabled='{getRegion() != null}' onActionPerformed="removeRegion(false)" /> + <JMenuItem text="isisfish.input.menu.removeLocaly" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().removeRegion(this, false)" /> </JMenu> <JMenu text="isisfish.input.menu.server"> - <JMenuItem text="isisfish.input.menu.addRegion" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" /> - <JMenuItem text="isisfish.input.menu.commit" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" /> + <JMenuItem text="isisfish.input.menu.addRegion" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().commitRegionInCVS(this)" /> + <JMenuItem text="isisfish.input.menu.commit" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().commitRegionInCVS(this)" /> <JSeparator/> - <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocalyRemotely" enabled='{getRegion() != null}' onActionPerformed="removeRegion(true)" /> + <JMenuItem text="isisfish.input.menu.removeLocalyRemotely" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().removeRegion(this, true)" /> </JMenu> <JMenu text="isisfish.input.menu.sensitivity"> - <JMenuItem text="isisfish.input.menu.sensitivity.export" enabled='{getRegion() != null}' onActionPerformed="getAction().exportRegionSensitivityFactors(this, getRegion())" /> + <JMenuItem text="isisfish.input.menu.sensitivity.export" enabled='{isRegionLoaded()}' onActionPerformed="getHandler().exportRegionSensitivityFactors(this)" /> </JMenu> </JMenuBar> <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> @@ -249,29 +54,36 @@ <Table constraints='BorderLayout.NORTH'> <row> <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldNewRegion" onKeyReleased='newChanged()'/> + <JTextField id="fieldNewRegion" /> </cell> <cell fill='horizontal'> - <JButton id="JButtonNewRegion" text="isisfish.input.newRegion" onActionPerformed='newRegion()' enabled='false'/> + <JButton id="buttonNewRegion" text="isisfish.input.newRegion" + onActionPerformed='getHandler().createNewRegion(this)' enabled='{getFieldNewRegion().getText().length() > 0}'/> </cell> </row> <row> <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onItemStateChanged='regionChange(event)' /> + <JComboBox id="fieldCurrentRegion" onItemStateChanged='getHandler().regionChange(this, event)' + model='{new fr.ifremer.isisfish.ui.models.common.StringComboModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'/> </cell> </row> </Table> <JPanel id="treePanel" name="treePanel" layout='{new BorderLayout()}'> <JScrollPane constraints='BorderLayout.CENTER'> - <JTree id="navigation" selectionModel='{getNavigationSelectionModel()}' cellRenderer='{getNavigationTreeCellRenderer()}' - rootVisible="true" selectionRow='0' model='{new DefaultTreeModel(null)}' - rowHeight="0" /> + <javax.swing.tree.DefaultTreeSelectionModel id='fisheryRegionTreeSelectionModel' + selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <JTree id="fisheryRegionTree" selectionModel='{fisheryRegionTreeSelectionModel}' + rootVisible="true" selectionRow='0' model='{new javax.swing.tree.DefaultTreeModel(null)}' rowHeight="0" + onValueChanged="getHandler().nodeSelectionChanged(this, event)" /> </JScrollPane> </JPanel> </JPanel> + <java.awt.CardLayout id='cardlayoutPrincipal'/> <JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}' minimumSize="{new java.awt.Dimension(0,0)}"> - <NoneUI id='noneUI' constraints='"none"'/> - <JPanel id="inputPane" layout='{getCardlayout()}' constraints='"normale"'/> + <JPanel layout='{new BorderLayout()}' constraints='"none"'> + <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> + </JPanel> + <JPanel id="inputPane" layout='{new BorderLayout()}' constraints='"normale"'/> </JPanel> </JSplitPane> -</JPanel> +</fr.ifremer.isisfish.ui.NavigationUI> Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,202 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-2.0.html>. - #L% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> - - <Boolean id='metierSeasonSelected' javaBean='false'/> - <Boolean id='targetSpeciesSelected' javaBean='false'/> - - <script><![CDATA[ -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.MetierImpl; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.TargetSpecies; -import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoTargetSpeciesTableModel; -import fr.ifremer.isisfish.ui.input.metier.SpeciesComboModel; -import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor; - -tableTargetSpecies.addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(tableTargetSpecies.getSelectedRow() != -1); - } -}); - - at Override -public void refresh() { - getVerifier().addCurrentPanel(targetFactor); - if (getBean() != null) { - setTableTargetSpeciesModel(); - } - else { - setTargetSpeciesModel(); - } - setTargetSpeciesModel(); - remove.setEnabled(false); - setAddButton(); - - // is actif is not working for targetFactor - // maybe set to true by addCurrentPanel - targetFactor.setActif(targetSpeciesSelected); -} - - at Override -public void setActionButtons() { - -} - -protected void setTargetSpeciesModel() { - java.util.List<Species> species = getRegion().getSpecies(); - SpeciesComboModel fieldTargetSpeciesModel = new SpeciesComboModel(species); - fieldTargetSpecies.setModel(fieldTargetSpeciesModel); -} - -protected void setTableTargetSpeciesModel() { - if (getMetierSeasonInfo() != null) { - java.util.List<TargetSpecies> targetSpecies = new ArrayList<TargetSpecies>(); - - // 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()) { - getVerifier().addCurrentEntity(oneTargetSpecies); - targetSpecies.add(oneTargetSpecies); - } - } - - // 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 (getMetierSeasonInfo() != null && selectedSpecies != null) { - // il n'y en a pas a la creaion 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() { - if (isMetierSeasonSelected()) { - // 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); - setTableTargetSpeciesModel(); - } - } -} - -protected void targetSpeciesChanged() { - setTargetSpeciesSelected(fieldTargetSpecies.getSelectedItem() != null); - setTableTargetSpeciesModel(); - setAddButton(); -} - -protected void setAddButton() { - add.setEnabled(isMetierSeasonSelected() && isTargetSpeciesSelected()); -} - ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldTargetSpecies" onActionPerformed='targetSpeciesChanged()' - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='targetFactor' constructorParams='this' - actif='{isTargetSpeciesSelected()}' - text='isisfish.metierSeasonInfoSpecies.targetFactor' - bean='{getBean()}' formuleCategory='TargetFactor' - clazz='{fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class}' - decorator='boxed' _bean='{MetierImpl.class}' _method='""'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" - enabled='{isTargetSpeciesSelected()}' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' - enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTable id="tableTargetSpecies" rowHeight='24' enabled='{isMetierSeasonSelected()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" - onActionPerformed='remove()' enabled='false' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> -</fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,100 +22,220 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> - <Boolean id='metierSeasonInfoSelected' javaBean='false'/> + <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.awt.Dimension + javax.swing.DefaultComboBoxModel + </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[ -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.MetierImpl; -import fr.ifremer.isisfish.entities.MetierSeasonInfo; -import fr.ifremer.isisfish.entities.MetierSeasonInfoImpl; -import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboModel; - at Override -public void refresh() { - Metier metier = getVerifier().getEntity(Metier.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean((MetierImpl) metier); - - getVerifier().addCurrentPanel(metierSeasonInfoSpeciesEditor); - if (getBean() != null) { - setSeasonModel(); - } - else { - DefaultComboBoxModel seasonModel = new DefaultComboBoxModel(); - fieldMetierSeasonInfo.setModel(seasonModel); - } +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + DefaultComboBoxModel seasonModel = new DefaultComboBoxModel(); + fieldMetierSeasonInfo.setModel(seasonModel); + } + if (evt.getNewValue() != null) { + setSeasonModel(); + setTargetSpeciesModel(); + } + setSpecies(null); + setMetierSeasonInfo(null); + } + }); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - -protected void setSeasonModel(){ +protected void setSeasonModel() { java.util.List<MetierSeasonInfo> metierSeasonInfo = getBean().getMetierSeasonInfo(); MetierSeasonInfoComboModel seasonModel = new MetierSeasonInfoComboModel(metierSeasonInfo); fieldMetierSeasonInfo.setModel(seasonModel); - - // fix refresh() problem false, because first is null - setMetierSeasonInfoSelected(false); } + protected void metierSeasonInfoChanged() { MetierSeasonInfo selectedMSI = (MetierSeasonInfo)fieldMetierSeasonInfo.getSelectedItem(); - setMetierSeasonInfoSelected( selectedMSI != null); - if (isMetierSeasonInfoSelected()) { - if (log.isDebugEnabled()) { - log.debug("Metier season changed : " + selectedMSI); + setMetierSeasonInfo(selectedMSI); + if (selectedMSI != null) { + getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); + setTableTargetSpeciesModel(); + } +} + +protected void setTargetSpeciesModel() { + java.util.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>(); + + // 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); + } + }); } - // FIXME really need to fix impl cast !!! - setMetierSeasonInfo((MetierSeasonInfoImpl)selectedMSI); - getVerifier().addCurrentEntity(getMetierSeasonInfo()); } - metierSeasonInfoSpeciesEditor.refresh(); + + // 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); + setTableTargetSpeciesModel(); + } +} ]]></script> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonInfoChanged()' - renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <MetierSeasonInfoSpeciesEditorUI id='metierSeasonInfoSpeciesEditor' constructorParams='this' - bean='{getBean()}' metierSeasonInfo='{getMetierSeasonInfo()}' metierSeasonSelected='{isMetierSeasonInfoSelected()}' - actif='{isActif()}' - _bean='{MetierSeasonInfoImpl.class}' _method='"SpeciesTargetSpecies"'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> + <Table> + <row> + <cell fill='horizontal'> + <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() && !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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,91 +22,106 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.MetierSeasonInfoImpl id='metierSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - <Boolean id='metierSeasonInfoNotNull' javaBean='false'/> + <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[ - import fr.ifremer.isisfish.entities.Metier; - import fr.ifremer.isisfish.entities.MetierImpl; - import fr.ifremer.isisfish.entities.MetierSeasonInfo; - import fr.ifremer.isisfish.entities.MetierSeasonInfoImpl; - import fr.ifremer.isisfish.entities.Season; - import fr.ifremer.isisfish.entities.Zone; - import fr.ifremer.isisfish.types.Month; - import fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboModel; - import fr.ifremer.isisfish.ui.widget.Interval; - import fr.ifremer.isisfish.ui.widget.IntervalPanel; - + protected Interval interval = null; protected boolean init = false; - - /* - * Don't add both in same listener. - * When first is set, last value from getPopulationSeasonInfo() - * is erased by interval.getLast() default value. - */ - ip.addPropertyChangeListener("first", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getMetierSeasonInfo() != null) { - getMetierSeasonInfo().setFirstMonth(new Month(interval.getFirst())); + + 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())); + }); + ip.addPropertyChangeListener("last", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getMetierSeasonInfo() != null) { + getMetierSeasonInfo().setLastMonth(new Month(interval.getLast())); + } } - } - }); - - save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getVerifier().topiaSave(); - setMetierSeasonInfoCombo(); - } - }); + }); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { - create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); - setMetierSeasonInfoCombo(); - } - - }); + } + if (evt.getNewValue() != null) { + refresh(); + } + } + }); + } - remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); - setMetierSeasonInfoCombo(); - } - }); + protected void save() { + getSaveVerifier().save(); + setMetierSeasonInfoCombo(); + } - @Override + 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); } - //if (!isActif()) { - setMetierSeasonInfoNotNull(false); - //} + setMetierSeasonInfo(null); - Metier metier = getVerifier().getEntity(Metier.class); - // don't add setBean(null) here : useless - setBean((MetierImpl) metier); - if (getBean() != null) { // Model instanciation interval = new Interval(); @@ -123,17 +138,13 @@ ip.setModel(interval); } } - - @Override - public void setActionButtons() { - getVerifier().setSaveButton(save, false); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "MetierSeasonInfo", false); - getVerifier().setDeleteButton(remove, false); - } protected void setSeason() { if (getMetierSeasonInfo() != null) { + + // register selected item in save verifier + getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); + try { if (log.isDebugEnabled()) { log.debug("Refresh interval : "); @@ -170,7 +181,18 @@ for (ListSelectionListener listener : listeners) { metierZones.removeListSelectionListener(listener); } - metierZones.fillList(getRegion().getZone(), getMetierSeasonInfo().getZone()); + + 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); } @@ -181,9 +203,10 @@ java.util.List<MetierSeasonInfo> metierSeasonInfoList = getBean().getMetierSeasonInfo(); MetierSeasonInfoComboModel metierSeasonInfoModel = new MetierSeasonInfoComboModel(metierSeasonInfoList); metierSeasonInfoCombo.setModel(metierSeasonInfoModel); + metierSeasonInfoModel.setSelectedItem(getMetierSeasonInfo()); } - protected void metierZonesChanged(){ + protected void metierZonesChanged() { Object[] selected = metierZones.getSelectedValues(); java.util.List<Zone> zones = new ArrayList<Zone>(); for (Object o : selected){ @@ -191,82 +214,98 @@ } getMetierSeasonInfo().setZone(zones); } + protected void seasonChanged() { init = true; - setMetierSeasonInfo((MetierSeasonInfoImpl)metierSeasonInfoCombo.getSelectedItem()); - getVerifier().addCurrentEntity(getMetierSeasonInfo()); - setMetierSeasonInfoNotNull(getMetierSeasonInfo() != null); + setMetierSeasonInfo((MetierSeasonInfo)metierSeasonInfoCombo.getSelectedItem()); setSeason(); setMetierZone(); init = false; } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="metierSeasonInfoCombo" onActionPerformed='seasonChanged()' enabled='{isActif()}' - renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <IntervalPanel id='ip' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.zone" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.7'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="metierZones" onValueChanged='metierZonesChanged()' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isMetierSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <!-- jaxx.runtime.SwingUtil.getStringValue for null values --> - <JTextArea id="fieldMetierSeasonZoneComment" text='{jaxx.runtime.SwingUtil.getStringValue(getMetierSeasonInfo().getSeasonZoneComment())}' onKeyReleased='getMetierSeasonInfo().setSeasonZoneComment(fieldMetierSeasonZoneComment.getText())' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="metierSeasonInfoCombo" onItemStateChanged='seasonChanged()' enabled='{isActive() && !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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,129 +22,150 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Metier'> <!-- bean property --> - <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - <script><![CDATA[ - import fr.ifremer.isisfish.entities.Gear; - import fr.ifremer.isisfish.entities.Metier; - import fr.ifremer.isisfish.entities.MetierImpl; + <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> - protected boolean init = false; - - @Override - public void refresh() { - - if (log.isDebugEnabled()) { - log.debug("Refresh called in ui : " + this); - } + <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> - Metier metier = getVerifier().getEntity(Metier.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean((MetierImpl) metier); - - try { - if (getBean() != null) { + <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; - jaxx.runtime.SwingUtil.fillComboBox(fieldMetierGear, getRegion().getGear(), getBean().getGear(), true); + GearComboModel model = new GearComboModel(getFisheryRegion().getGear()); + fieldMetierGear.setModel(model); + model.setSelectedItem(bean.getGear()); init = false; } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't refresh", e); - } } + }); +} + +/*public void refresh() { + + if (log.isDebugEnabled()) { + log.debug("Refresh called in ui : " + this); } + + Metier metier = getSaveVerifier().getEntity(Metier.class); - @Override - public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Metier"); - getVerifier().setDeleteButton(remove); + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + setBean(null); + setBean(metier); +}*/ + +protected void gearChanged() { + if (!init) { + getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); } - - protected void gearChanged() { - if (!init) { - getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); - } - } +} ]]></script> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldMetierName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldMetierName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.gear" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldMetierGear" onActionPerformed='gearChanged()' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.rangeValues" enabled='{isActif()}'/> - </cell> - <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldMetierParam" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGearParameterValue())}' - onKeyReleased='getBean().setGearParameterValue(fieldMetierParam.getText())' enabled='{isActif()}' decorator='boxed' - _bean='{MetierImpl.class}' _method='"GearParameterValue"' /> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metier.comments" enabled='{isActif()}'/> - </cell> - <!-- jaxx.runtime.SwingUtil.getStringValue() => when null values --> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTextArea id="fieldMetierComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldMetierComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.metier.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldMetierName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldMetierName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.gear" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,42 +22,51 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Metier'> -<script><![CDATA[ -// Constructor code -setButtonTitle(_("isisfish.input.continueTripTypes")); -setNextPath("$root/$tripTypes"); + <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> - at Override -public void refresh() { + <import> + static org.nuiton.i18n.I18n._ + static org.nuiton.i18n.I18n.n_ + </import> +<script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueTripTypes")); + setNextPath(n_("isisfish.input.tree.triptypes")); + // install change listener - // (depends on sensitivity c'ant be done on constructor) + // (depends on sensitivity can't be done on constructor) installChangeListener(metierTab); +} +/*public void refresh() { + // add tab in reverse order // metierTabUI at last, for this tab refresh at end, and save/cancel button linked to // entity change - getVerifier().addCurrentPanel(metierSeasonSpeciesUI, metierSeasonInfoUI, metierTabUI); -} + getSaveVerifier().addCurrentPanel(metierSeasonSpeciesUI, metierSeasonInfoUI, metierTabUI); +}*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(metierTab); +public void setLayer(boolean active) { + super.setLayer(active); + metierTabUI.setLayer(active); + metierSeasonInfoUI.setLayer(active); + metierSeasonSpeciesUI.setLayer(active); } ]]></script> - <JPanel layout='{new BorderLayout()}'> + <JPanel id="body"> <JTabbedPane id="metierTab" constraints='BorderLayout.CENTER'> - <tab title='{_("isisfish.metier.title")}'> - <MetierTabUI id="metierTabUI" constructorParams='this'/> + <tab title='isisfish.metier.title'> + <MetierTabUI id="metierTabUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> - <tab title='{_("isisfish.metierSeasonInfoZone.title")}'> - <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='this'/> + <tab title='isisfish.metierSeasonInfoZone.title'> + <MetierSeasonInfoZoneUI id="metierSeasonInfoUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> - <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'> - <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='this'/> + <tab title='isisfish.metierSeasonInfoSpecies.title'> + <MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,27 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-2.0.html>. - #L% - --> -<JPanel layout='{new BorderLayout()}'> - <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> -</JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -59,50 +59,8 @@ protected IsisMapBean map; protected int selectMode = CellSelectionLayer.SINGLE_SELECTION; - + /** - * OnMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseDragged = null; - - /** - * OnMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseEntered = null; - - /** - * OnMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseExited = null; - - /** - * OnMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseMoved = null; - - /** - * OnMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMousePressed = null; - - /** - * OnMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - protected String onMouseReleased = null; - - /** * Constructor. * * Register himself to {@code map} mapMouseListener. @@ -128,138 +86,6 @@ // do nothing, it's not reel layer } - /** - * Get onMouseDragged property. - * - * @return OnMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseDragged() { - return this.onMouseDragged; - } - - /** - * Set onMouseDragged property. - * - * @param onMouseDragged New onMouseDragged property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseDragged(String onMouseDragged) { - this.onMouseDragged = onMouseDragged; - } - - /** - * Get onMouseEntered property. - * - * @return OnMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseEntered() { - return this.onMouseEntered; - } - - /** - * Set onMouseEntered property. - * - * @param onMouseEntered New onMouseEntered property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseEntered(String onMouseEntered) { - this.onMouseEntered = onMouseEntered; - } - - /** - * Get onMouseExited property. - * - * @return OnMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseExited() { - return this.onMouseExited; - } - - /** - * Set onMouseExited property. - * - * @param onMouseExited New onMouseExited property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseExited(String onMouseExited) { - this.onMouseExited = onMouseExited; - } - - /** - * Get onMouseMoved property. - * - * @return OnMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseMoved() { - return this.onMouseMoved; - } - - /** - * Set onMouseMoved property. - * - * @param onMouseMoved New onMouseMoved property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseMoved(String onMouseMoved) { - this.onMouseMoved = onMouseMoved; - } - - /** - * Get onMousePressed property. - * - * @return OnMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMousePressed() { - return this.onMousePressed; - } - - /** - * Set onMousePressed property. - * - * @param onMousePressed New onMousePressed property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMousePressed(String onMousePressed) { - this.onMousePressed = onMousePressed; - } - - /** - * Get onMouseReleased property. - * - * @return OnMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - public String getOnMouseReleased() { - return this.onMouseReleased; - } - - /** - * Set onMouseReleased property. - * - * @param onMouseReleased New onMouseReleased property. - * - * @deprecated as of 3.2.0.5 unused - */ - public void setOnMouseReleased(String onMouseReleased) { - this.onMouseReleased = onMouseReleased; - } - @Override public String[] getMouseModeServiceList() { return new String[] { SelectMouseMode.modeID }; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,49 +22,58 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <script><![CDATA[ + <import> + fr.ifremer.isisfish.entities.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> -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.PopulationGroup; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import javax.swing.table.DefaultTableModel; -import org.nuiton.topia.persistence.TopiaEntity; + <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> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - fieldPopulationBasicsName.setText(""); - fieldPopulationBasicsGeographicID.setText(""); - fieldPopulationBasicsNbClasses.setText(""); - fieldPopulationBasicsComment.setText(""); - fieldPopulationBasicsMatureClass.setSelectedItem(null); - tableAgeLength.setModel(new DefaultTableModel()); + <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(""); + fieldPopulationBasicsMatureClass.setSelectedItem(null); + tableAgeLength.setModel(new DefaultTableModel()); + } + if (evt.getNewValue() != null) { + if (getBean().getPopulationGroup() != null) { + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationBasicsMatureClass, getBean().getPopulationGroup(), getBean().getMaturityGroup(), true); + } + setTableAgeLengthModel(); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text") - } - } -}); + }); +} - at Override public void refresh() { - Population population = getVerifier().getEntity(Population.class); + 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((PopulationImpl) population); + setBean(population); if (getBean() != null) { if (getBean().getPopulationGroup() != null) { @@ -72,17 +81,9 @@ } setTableAgeLengthModel(); } - getVerifier().addCurrentPanel(growthEquation, growthReverseEquation); + //getSaveVerifier().addCurrentPanel(growthEquation, growthReverseEquation); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Population", false); - getVerifier().setDeleteButton(remove); -} - /** * Open creation classe wizard after confirmation. */ @@ -98,7 +99,8 @@ wizard.init(this); wizardFrame.add(wizard, BorderLayout.CENTER); wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title")); - wizard.setAgeType(getBean().getSpecies().getAgeGroupType()); + Species species = getBean().getSpecies(); + wizard.setAgeType(species.getAgeGroupType()); if (wizard.isAgeType()) { wizard.setCard("singleGroupAge"); } else { @@ -107,7 +109,6 @@ wizardFrame.pack(); wizardFrame.setLocationRelativeTo(this); wizardFrame.setVisible(true); - //refresh(); } } @@ -117,7 +118,7 @@ getBean().setMaturityGroup((PopulationGroup) selected); } } -protected void setTableAgeLengthModel(){ +protected void setTableAgeLengthModel() { java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup(); if (popGroup != null){ DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1); @@ -132,130 +133,158 @@ tableAgeLength.setModel(model); } } -protected void create(){ - Species species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getNavigationPath()); - if (species == null){ - species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getParent().getNavigationPath()); - } - TopiaEntity topia = getContextValue(InputAction.class).createPopulation(getVerifier().getIsisContext(), species); - getParentContainer(InputUI.class).setTreeModel(); - getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ species.getTopiaId() +"/$populations/"+topia.getTopiaId()); +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(_("isisfish.message.creation.finished")); } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.name" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldPopulationBasicsName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsGeographicID" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGeographicId())}' onKeyReleased='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationBasicsNbClasses" text='{getBean() == null ? "" : getBean().sizePopulationGroup()}' editable="false" enabled='{isActif()}' decorator='boxed'/> - </cell> - <cell fill='horizontal'> - <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createGroups()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - <cell fill='horizontal'> - <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" selected='{getBean().getPlusGroup()}' onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"PlusGroup"'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0'> - <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='growthEquation' constructorParams='this' - text='isisfish.populationBasics.growth' actif='{isActif()}' - bean='{getBean()}' beanProperty='growth' formuleCategory='Growth' - clazz='{fr.ifremer.isisfish.equation.PopulationGrowth.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"Growth"'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='growthReverseEquation' constructorParams='this' - text='isisfish.populationBasics.growthReverse' actif='{isActif()}' - bean='{getBean()}' formuleCategory='GrowthReverse' beanProperty='GrowthReverse' - clazz='{fr.ifremer.isisfish.equation.PopulationGrowthReverse.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"GrowthReverse"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.population.comments" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldPopulationBasicsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' /> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' onActionPerformed='create()' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed' /> - </cell> - </row> - </Table> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.name" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldPopulationBasicsName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsGeographicID" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getGeographicId())}' + onKeyReleased='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationBasicsNbClasses" + text='{String.valueOf(getBean() == null ? "" : getBean().sizePopulationGroup())}' + editable="false" enabled='{isActive()}' decorator='boxed'/> + </cell> + <cell fill='horizontal'> + <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" + onActionPerformed='createGroups()' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{getBean() != null}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JAXXComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' + enabled='{isActive()}' decorator='boxed'/> + </cell> + <cell fill='horizontal'> + <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" + selected='{getBean().getPlusGroup()}' + onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"PlusGroup"'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0'> + <JTable id='tableAgeLength' rowHeight='24' enabled='false' decorator='boxed'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='growthEquation' constructorParams='this' + text='isisfish.populationBasics.growth' active='{isActive()}' + bean='{getBean()}' beanProperty='growth' formuleCategory='Growth' + clazz='{fr.ifremer.isisfish.equation.PopulationGrowth.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"Growth"'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='growthReverseEquation' constructorParams='this' + text='isisfish.populationBasics.growthReverse' active='{isActive()}' + bean='{getBean()}' formuleCategory='GrowthReverse' beanProperty='GrowthReverse' + clazz='{fr.ifremer.isisfish.equation.PopulationGrowthReverse.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"GrowthReverse"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.population.comments" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <JScrollPane> + <JTextArea id="fieldPopulationBasicsComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,15 +22,40 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <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="capturability" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + <script><![CDATA[ -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationCapturabilityComment.setText(""); + fieldPopulationCapturability.setMatrix(null); + } + if (evt.getNewValue() != null) { + if (getBean().getCapturability() != null) { + fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy()); + } + } + } + }); +} protected void populationCapturabilityMatrixChanged(MatrixPanelEvent event) { if (getBean() != null && fieldPopulationCapturability.getMatrix() != null) { @@ -38,29 +63,13 @@ } } -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - fieldPopulationCapturabilityComment.setText(""); - fieldPopulationCapturability.setMatrix(null); - } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); - at Override -public void refresh() { - Population population = getVerifier().getEntity(Population.class); - // add null before, for second to be considered as a changed event // otherwize, setBean has no effect setBean(null); - setBean((PopulationImpl) population); + setBean(population); if (getBean() != null){ if (getBean().getCapturability() != null) { @@ -71,48 +80,53 @@ // TODO add only once, not at all refresh //fieldPopulationCapturability.addMatrixListener(listener); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} +}*/ ]]> </script> - <Table id='body'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> - <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' - matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"Capturability"' - onMatrixChanged="populationCapturabilityMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> - <JLabel text="isisfish.populationCapturability.comments" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <JTextArea id="fieldPopulationCapturabilityComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCapturabilityComment())}' onKeyReleased='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> + <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' + matrix='{getBean().getCapturability() == null ? null : getBean().getCapturability().copy()}' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"Capturability"' + onMatrixChanged="populationCapturabilityMatrixChanged(event)" /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'> + <JLabel text="isisfish.populationCapturability.comments" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <JScrollPane> + <JTextArea id="fieldPopulationCapturabilityComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCapturabilityComment())}' + onKeyReleased='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,71 +22,76 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <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[ - -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; - - at Override -public void refresh() { - Population population = getVerifier().getEntity(Population.class); +/*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((PopulationImpl) population); + setBean(population); - getVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} + getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); +}*/ ]]> </script> - <Table id='body'> - <row> - <cell columns='2' fill='both' weightx='0.5' weighty='0.3'> - <InputOneEquationUI id='naturalDeathRate' constructorParams='this' - text='isisfish.populationEquation.naturalDeathRate' - bean='{getBean()}' formuleCategory='NaturalDeathRate' beanProperty='NaturalDeathRate' - clazz='{fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRate"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='meanWeight' constructorParams='this' - text='isisfish.populationEquation.meanWeight' - bean='{getBean()}' formuleCategory='MeanWeight' beanProperty='MeanWeight' - clazz='{fr.ifremer.isisfish.equation.PopulationMeanWeight.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"MeanWeight"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='price' constructorParams='this' - text='isisfish.populationEquation.price' - bean='{getBean()}' formuleCategory='Price' beanProperty='Price' - clazz='{fr.ifremer.isisfish.equation.PopulationPrice.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"Price"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='both' weightx='0.5' weighty='0.3'> + <InputOneEquationUI id='naturalDeathRate' constructorParams='this' + text='isisfish.populationEquation.naturalDeathRate' active="{isActive()}" + bean='{getBean()}' formuleCategory='NaturalDeathRate' beanProperty='NaturalDeathRate' + clazz='{fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class}' + decorator='boxed' _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='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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -32,80 +32,81 @@ seule, et contiennent les resulats des equations en simple visualisation. --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationGroupImpl id='populationGroup' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <Boolean id='popGroupNotNull' javaBean='false'/> + <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[ -import fr.ifremer.isisfish.entities.PopulationGroup; -import fr.ifremer.isisfish.entities.PopulationGroupImpl; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import org.nuiton.math.matrix.MatrixND; - -addPropertyChangeListener("populationGroup", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - fieldPopulationGroupMeanWeight.setText(""); - fieldPopulationGroupPrice.setText(""); - fieldPopulationGroupReproductionRate.setText(""); - fieldPopulationGroupAge.setText(""); - fieldPopulationGroupMinLength.setText(""); - fieldPopulationGroupMaxLength.setText(""); - fieldPopulationGroupComment.setText(""); - fieldPopulationGroupNaturalDeathRate.setMatrix(null); - setPopGroupNotNull(false); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setPopulationGroup(null); + } + if (evt.getNewValue() != null) { + if (getBean().getPopulationGroup() != null) { + jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), true); + } + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - } - } -}); + }); -/*fieldPopulationGroupNaturalDeathRate.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - if (getPopulationGroup() != null){ - // not sure of this code - // fieldPopulationGroupNaturalDeathRate contains of "part of" - // natural death rate matrix - // can't overrite matrix ... - // just enable save ? - save.setEnabled(true); + addPropertyChangeListener(PROPERTY_POPULATION_GROUP, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldPopulationGroupMeanWeight.setText(""); + fieldPopulationGroupPrice.setText(""); + fieldPopulationGroupReproductionRate.setText(""); + fieldPopulationGroupAge.setText(""); + fieldPopulationGroupMinLength.setText(""); + fieldPopulationGroupMaxLength.setText(""); + fieldPopulationGroupComment.setText(""); + fieldPopulationGroupNaturalDeathRate.setMatrix(null); + } + if (evt.getNewValue() != null) { + + } } - } -});*/ + }); +} - at Override -public void refresh() { - //if (!isActif()) { +/*public void refresh() { + //if (!isActive()) { setPopGroupNotNull(false); //} - Population population = getVerifier().getEntity(Population.class); + 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((PopulationImpl) population); + setBean(population); +}*/ - if (getBean() != null) { - if (getBean().getPopulationGroup() != null) { - jaxx.runtime.SwingUtil.fillComboBox(populationGroupPopulationGroupComboBox, getBean().getPopulationGroup(), getPopulationGroup(), true); - } - } -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - protected void setNaturalDeathRateMatrix() { try { Population population = getBean(); @@ -128,9 +129,9 @@ */ protected void populationGroupChanged() { PopulationGroup selectedPopulationGroup = (PopulationGroup)populationGroupPopulationGroupComboBox.getSelectedItem(); + setPopulationGroup(selectedPopulationGroup); if (selectedPopulationGroup != null) { - setPopulationGroup((PopulationGroupImpl)selectedPopulationGroup); - getVerifier().addCurrentEntity(selectedPopulationGroup); + getSaveVerifier().addCurrentEntity(selectedPopulationGroup); setNaturalDeathRateMatrix(); // init number editor (not working on bindings) @@ -138,123 +139,128 @@ fieldPopulationGroupAge.init(); fieldPopulationGroupMinLength.init(); fieldPopulationGroupMaxLength.init();*/ - - setPopGroupNotNull(true); } - else { - setPopGroupNotNull(false); - } } ]]> </script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id='populationGroupPopulationGroupComboBox' onActionPerformed='populationGroupChanged()' enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupMeanWeight" text='{getPopulationGroup().getMeanWeight()}' - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.price" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldPopulationGroupPrice" text='{getPopulationGroup().getPrice()}' - enabled='false' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' - enabled='false' decorator='boxed' _bean='{PopulationImpl.class}' _method='"NaturalDeathRateMatrix"' /> - <!-- this bindings totally break UI - matrix='{getBean() == null || getPopulationGroup() == null ? null : ((AbstractMatrixND)getBean().getNaturalDeathRateMatrix()).getSubMatrixOnSemantic(0, getPopulationGroup())}' --> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldPopulationGroupReproductionRate' constructorParams='this' - bean='{getPopulationGroup()}' property='reproductionRate' - useSign='true' enabled='{isPopGroupNotNull()}' decorator='boxed' - _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/--> - <JTextField id="fieldPopulationGroupReproductionRate" text='{getPopulationGroup().getReproductionRate()}' - onKeyReleased='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' - enabled='{isPopGroupNotNull()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"ReproductionRate"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.age" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='1.0'> - <!-- non editable age field --> - <JTextField id="fieldPopulationGroupAge" text='{getPopulationGroup().getAge()}' - onKeyReleased='getPopulationGroup().setAge(Double.parseDouble(fieldPopulationGroupAge.getText()))' - enabled='{getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' - decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"Age"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.length" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable min length field --> - <JTextField id="fieldPopulationGroupMinLength" text='{getPopulationGroup().getMinLength()}' - toolTipText="isisfish.populationGroup.minimumLength" - onKeyReleased='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' - enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MinLength"'/> - </cell> - <cell fill='both' weightx='0.5'> - <!-- non editable max length field --> - <JTextField id="fieldPopulationGroupMaxLength" text='{getPopulationGroup().getMaxLength()}' - toolTipText="isisfish.populationGroup.maximumLength" - onKeyReleased='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' - enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _bean='{PopulationGroupImpl.class}' _method='"MaxLength"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.populationGroup.comments" enabled='{isPopGroupNotNull()}'/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> - <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' - onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isPopGroupNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JAXXComboBox id='populationGroupPopulationGroupComboBox' onActionPerformed='populationGroupChanged()' enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldPopulationGroupMeanWeight" text='{String.valueOf(getPopulationGroup().getMeanWeight())}' + editable="false" + enabled='{getPopulationGroup() != null}' 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())}' + editable="false" + enabled='{getPopulationGroup() != null}' decorator='boxed'/> + </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='0.5'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationGroupNaturalDeathRate' + enabled='false' decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"NaturalDeathRateMatrix"' /> + <!-- this bindings totally break UI + matrix='{getBean() == null || getPopulationGroup() == null ? null : ((AbstractMatrixND)getBean().getNaturalDeathRateMatrix()).getSubMatrixOnSemantic(0, getPopulationGroup())}' --> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{getPopulationGroup() != null}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldPopulationGroupReproductionRate' constructorParams='this' + bean='{getPopulationGroup()}' property='reproductionRate' + useSign='true' enabled='{isPopGroupNotNull()}' decorator='boxed' + _sensitivityBean='{PopulationGroup.class}' _sensitivityMethod='"ReproductionRate"'/--> + <JTextField id="fieldPopulationGroupReproductionRate" text='{String.valueOf(getPopulationGroup().getReproductionRate())}' + onKeyReleased='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' + enabled='{getPopulationGroup() != null}' decorator='boxed' _sensitivityBean='{PopulationGroup.class}' _sensitivityMethod='"ReproductionRate"'/> + </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())}' + onKeyReleased='getPopulationGroup().setAge(Double.parseDouble(fieldPopulationGroupAge.getText()))' + enabled='{getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' + decorator='boxed' _sensitivityBean='{PopulationGroup.class}' _sensitivityMethod='"Age"'/> + </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" + onKeyReleased='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' + enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _sensitivityBean='{PopulationGroup.class}' _sensitivityMethod='"MinLength"'/> + </cell> + <cell fill='both' weightx='0.5'> + <!-- non editable max length field --> + <JTextField id="fieldPopulationGroupMaxLength" text='{String.valueOf(getPopulationGroup().getMaxLength())}' + toolTipText="isisfish.populationGroup.maximumLength" + onKeyReleased='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' + enabled='{!getPopulationGroup().getPopulation().getSpecies().getAgeGroupType()}' decorator='boxed' _sensitivityBean='{PopulationGroup.class}' _sensitivityMethod='"MaxLength"'/> + </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='0.5'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() for null values --> + <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.SwingUtil.getStringValue(getPopulationGroup().getComment())}' + onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,186 +22,165 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> <Boolean id='coefNonVide' javaBean='false'/> - <script><![CDATA[ -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.entities.PopulationGroup; -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.entities.Zone; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; + <import> + 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> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText(""); - populationMigrationEmigrationTable.setMatrix(null); + <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(); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); -populationMigrationEmigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - } -}); + }); +} - public void init(PopulationSeasonInfo pi){ - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); - populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); - } - - @Override - public void refresh(){ - Population population = getVerifier().getEntity(Population.class); +public void init(PopulationSeasonInfo pi){ + // add null before, for second to be considered as a changed event + // otherwize, setBean has no effect + //setPopInfo(null); + //setPopInfo(pi); + populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().copy()); +} - // setBean(null); useless here - setBean((PopulationImpl) population); +/*public void refresh(){ + Population population = getSaveVerifier().getEntity(Population.class); - refreshPanel(); - } - - @Override - public void setActionButtons() { + // setBean(null); useless here + setBean(population); - } - - public void refreshPanel() { - setFieldPopulationMigrationMigrationGroupChooserModel(); - setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); - remove.setEnabled(false); - setAddButton(); + refreshPanel(); +}*/ - /*populationMigrationEmigrationTable.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - if (popInfo != null){ - popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); - } - } - });*/ +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 populationMigrationEmigrationMatrixChanged(MatrixPanelEvent event) { - remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1); - if (popInfo != null){ - popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().clone()); - } +protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ + if (getBean() != null && getBean().getPopulationGroup() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationGroupChooser,getBean().getPopulationGroup(), null, true); } - - protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ - if (getBean() != null && getBean().getPopulationGroup() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationGroupChooser,getBean().getPopulationGroup(), null, true); - } +} +protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ + if (getBean() != null && getBean().getPopulationZone() != null){ + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); } - protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){ - if (getBean() != null && getBean().getPopulationZone() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationEmigrationDepartureZoneChooser,getBean().getPopulationZone(), null, true); - } - } - protected void add(){ - getContextValue(InputAction.class).addEmigration( - getPopInfo(), - (PopulationGroup) fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem(), - (Zone) fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem(), - Double.parseDouble(fieldPopulationMigrationEmigrationCoefficient.getText())); - populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().clone()); - } - - protected void remove() { - log.debug("removeEmigration called"); - try { - int row = populationMigrationEmigrationTable.getTable().getSelectedRow(); - Object group = populationMigrationEmigrationTable.getTable().getValueAt(row, 0); - Object departure = populationMigrationEmigrationTable.getTable().getValueAt(row, 1); +} +protected void add(){ + getContextValue(InputAction.class).addEmigration( + getPopInfo(), + (PopulationGroup) fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem(), + (Zone) fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem(), + Double.parseDouble(fieldPopulationMigrationEmigrationCoefficient.getText())); + populationMigrationEmigrationTable.setMatrix(getPopInfo().getEmigrationMatrix().clone()); +} - MatrixND mat = popInfo.getEmigrationMatrix().clone(); - mat.setValue(group, departure, 0); - popInfo.setEmigrationMatrix(mat); - remove.setEnabled(false); - } catch(Exception eee) { - log.error("Can't remove migration", eee); - } +protected void remove() { + 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> - <Table id='body'> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActif()}' onActionPerformed='zoneChanged()'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JPanel/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationEmigrationTable' - linearModel="true" enabled='{isActif()}' - onMatrixChanged="populationMigrationEmigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> +} +protected void groupChanged() { + setGPopSelected(fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem() != null); + setAddButton(); +} +protected void coefChanged() { + setCoefNonVide(!fieldPopulationMigrationEmigrationCoefficient.getText().equals("")); + setAddButton(); +} +protected void zoneChanged() { + setZoneDepartSelected(fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem() != null); + setAddButton(); +} +protected void setAddButton() { + add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getCoefNonVide()); +} +]]></script> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActive()}' onActionPerformed='groupChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActive()}' onKeyReleased='coefChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActive()}' onActionPerformed='zoneChanged()'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JPanel/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' + enabled='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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,62 +22,60 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <script><![CDATA[ -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> -public void init(PopulationSeasonInfo pi) { + <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((PopulationSeasonInfoImpl)pi); + //setPopInfo(null); + //setPopInfo(populationSeasonInfo); } - at Override -public void refresh() { - getVerifier().addCurrentPanel(immigrationEquation, emigrationEquation, migrationEquation); -} - - at Override -public void setActionButtons() { - -} +/*public void refresh() { + getSaveVerifier().addCurrentPanel(immigrationEquation, emigrationEquation, migrationEquation); +}*/ ]]> </script> - <Table> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='migrationEquation' constructorParams='this' - text='isisfish.common.migration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Migration' beanProperty='MigrationEquation' - clazz='{fr.ifremer.isisfish.equation.MigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"MigrationEquation"'/> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='emigrationEquation' constructorParams='this' - text='isisfish.common.emigration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Emigration' beanProperty='EmigrationEquation' - clazz='{fr.ifremer.isisfish.equation.EmigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"EmigrationEquation"'/> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <InputOneEquationUI id='immigrationEquation' constructorParams='this' - text='isisfish.common.immigration' actif='{isActif()}' - bean='{getPopInfo()}' formuleCategory='Immigration' beanProperty='ImmigrationEquation' - clazz='{fr.ifremer.isisfish.equation.ImmigrationEquation.class}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"ImmigrationEquation"'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <InputOneEquationUI id='migrationEquation' constructorParams='this' + text='isisfish.common.migration' active='{isActive()}' + bean='{getPopInfo()}' formuleCategory='Migration' beanProperty='MigrationEquation' + clazz='{fr.ifremer.isisfish.equation.MigrationEquation.class}' + decorator='boxed' _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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,90 +22,67 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> <Boolean id='coefNonVide' javaBean='false'/> - <script><![CDATA[ - -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.entities.PopulationGroup; -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.entities.Zone; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; + <import> + java.beans.PropertyChangeEvent; + 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> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - populationMigrationImmigrationTable.setMatrix(null); + <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(); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} -populationMigrationImmigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationImmigrationTable.getTable().getSelectedRow() != -1); - } -}); - -/*populationMigrationImmigrationTable.addMatrixListener(new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - if (getPopInfo() != null) { - getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); - } - } -});*/ - protected void populationMigrationImmigrationMatrixChanged(MatrixPanelEvent event) { if (getPopInfo() != null){ getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().clone()); } } -public void init(PopulationSeasonInfo pi) { +public void init(PopulationSeasonInfo populationSeasonInfo) { // add null before, for second to be considered as a changed event // otherwize, setBean has no effect - setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); + //setPopInfo(null); + //setPopInfo(populationSeasonInfo); populationMigrationImmigrationTable.setMatrix(getPopInfo().getImmigrationMatrix().copy()); } - at Override -public void refresh(){ +/*public void refresh(){ Population population = getVerifier().getEntity(Population.class); - setBean((PopulationImpl) population); + setBean(population); refreshPanel(); -} +}*/ - at Override -public void setActionButtons() { - -} - public void refreshPanel(){ setFieldPopulationMigrationMigrationGroupChooserModel(); setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); - - remove.setEnabled(false); setAddButton(); } protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ @@ -118,23 +95,24 @@ jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationMigrationImmigrationArrivalZoneChooser, getBean().getPopulationZone(), null, true); } } -protected void add(){ +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(){ +protected void remove() { int row = populationMigrationImmigrationTable.getTable().getSelectedRow(); - Object group = populationMigrationImmigrationTable.getTable().getValueAt(row, 0); - Object departure = populationMigrationImmigrationTable.getTable().getValueAt(row, 1); - Object arrival = populationMigrationImmigrationTable.getTable().getValueAt(row, 2); - - MatrixND mat = getPopInfo().getImmigrationMatrix().clone(); - mat.setValue(group, departure, arrival, 0); - getPopInfo().setImmigrationMatrix(mat); - remove.setEnabled(false); + 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); @@ -153,48 +131,52 @@ } ]]> </script> - <Table> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActif()}' onActionPerformed='zoneChanged()'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JPanel/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='populationMigrationImmigrationTable' - linearModel="true" enabled='{isActif()}' - onMatrixChanged="populationMigrationImmigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActive()}' onActionPerformed='groupChanged()'/> + </cell> + <cell> + <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActive()}' onKeyReleased='coefChanged()'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActive()}' onActionPerformed='zoneChanged()'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JPanel/> + </cell> + </row> + <row columns='4'> + <cell fill='horizontal' weightx='1.0'> + <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' + enabled='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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,50 +22,45 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> <Boolean id='gPopSelected' javaBean='false'/> <Boolean id='zoneDepartSelected' javaBean='false'/> <Boolean id='zoneArrivalSelected' javaBean='false'/> <Boolean id='coefNonVide' javaBean='false'/> - <script><![CDATA[ - -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.entities.PopulationGroup; -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.Zone; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; + <import> + 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> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - populationMigrationMigrationTable.setMatrix(null); + <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(); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} -populationMigrationMigrationTable.getTable().addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - remove.setEnabled(populationMigrationMigrationTable.getTable().getSelectedRow() != -1); - } -}); - protected void populationMigrationMigrationMatrixChanged(MatrixPanelEvent event) { if (getPopInfo() != null) { getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix().clone()); @@ -74,37 +69,26 @@ public void init(PopulationSeasonInfo pi) { // add null before, for second to be considered as a changed event // otherwize, setBean has no effect - setPopInfo(null); - setPopInfo((PopulationSeasonInfoImpl)pi); + //setPopInfo(null); + //setPopInfo(pi); - if (getPopInfo() != null && getPopInfo().getMigrationMatrix() != null){ - populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); - } + populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().copy()); } - at Override -public void refresh() { - Population population = getVerifier().getEntity(Population.class); +/*public void refresh() { + Population population = getSaveVerifier().getEntity(Population.class); // setBean(null); is useless here - setBean((PopulationImpl) population); + setBean(population); refreshPanel(); -} +}*/ - at Override -public void setActionButtons() { - -} - public void refreshPanel(){ setFieldPopulationMigrationMigrationGroupChooserModel(); setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); - //populationMigrationMigrationTable.addMatrixListener(listener); - - remove.setEnabled(false); - setAddButton(); + //setAddButton(); } protected void setFieldPopulationMigrationMigrationGroupChooserModel(){ if (getBean() != null && getBean().getPopulationGroup() != null){ @@ -129,18 +113,20 @@ Double.parseDouble(fieldPopulationMigrationMigrationCoefficient.getText())); populationMigrationMigrationTable.setMatrix(getPopInfo().getMigrationMatrix().clone()); } -protected void remove(){ +protected void remove() { int row = populationMigrationMigrationTable.getTable().getSelectedRow(); - 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); - remove.setEnabled(false); + 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(){ +/*protected void groupChanged(){ setGPopSelected(fieldPopulationMigrationMigrationGroupChooser.getSelectedItem() != null); setAddButton(); } @@ -155,57 +141,70 @@ 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); } -protected void setAddButton(){ - add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getZoneArrivalSelected() && getCoefNonVide()); -} ]]> </script> - <Table id='body'> - <row> - <cell> - <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActif()}' onActionPerformed='groupChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActif()}' onKeyReleased='coefChanged()'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActif()}' onActionPerformed='zoneDepartueChanged()'/> - </cell> - <cell> - <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActif()}' onActionPerformed='zoneArrivalChanged()'/> - </cell> - </row> - <row columns='4'> - <cell fill='horizontal' weightx='1.0'> - <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> - </cell> - </row> - <row columns='4'> - <cell fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='populationMigrationMigrationTable' - linearModel='{true}' enabled='{isActif()}' - onMatrixChanged="populationMigrationMigrationMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1.0'> - <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell> + <JLabel text="isisfish.common.populationGroup" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JAXXComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActive()}' + 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> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,43 +22,58 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <Boolean id="selectedPopulationSeasonInfo" javaBean='false' /> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='popInfo' javaBean='null'/> - <script><![CDATA[ + <import> + 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> -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboModel; -import fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboRenderer; + <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> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldPopulationMigrationComment.setText(""); - fieldUseEquationMigration.setSelected(false); + <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(); + } } - /*if (evt.getNewValue() != null) { + }); +} - }*/ - } -}); - - at Override public void refresh() { - Population population = getVerifier().getEntity(Population.class); + 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((PopulationImpl) population); + //setBean(null); + //setBean(population); // refresh psi list in combo box PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); @@ -80,37 +95,19 @@ else { model.setPopulationSeasonInfos(null); } - - getVerifier().addCurrentPanel(populationMigrationEquationUI, populationMigrationMigrationUI, populationMigrationImmigrationUI, populationMigrationEmigrationUI); - // addCurrentPanel set all to isActif() - // force it to isSelectedPopulationSeasonInfo() - // twice for real change event :( - setSelectedPopulationSeasonInfo(fieldPopulationMigrationSeasonChooser.getModel().getSelectedItem() == null); - setSelectedPopulationSeasonInfo(fieldPopulationMigrationSeasonChooser.getModel().getSelectedItem() != null); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} - protected void seasonChanged() { PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); PopulationSeasonInfo selectedPSI = (PopulationSeasonInfo)model.getSelectedItem(); - setPopInfo((PopulationSeasonInfoImpl)selectedPSI); + setPopInfo(selectedPSI); if (getPopInfo() != null) { - getVerifier().addCurrentEntity(getPopInfo()); + getSaveVerifier().addCurrentEntity(getPopInfo()); populationMigrationEquationUI.init(getPopInfo()); populationMigrationMigrationUI.init(getPopInfo()); populationMigrationImmigrationUI.init(getPopInfo()); populationMigrationEmigrationUI.init(getPopInfo()); - - setSelectedPopulationSeasonInfo(isActif()); } - else { - setSelectedPopulationSeasonInfo(false); - } refreshHidablePanel(); } protected void useEquationChanged() { @@ -129,75 +126,92 @@ } } } + at Override +public void setLayer(boolean active) { + super.setLayer(active); + populationMigrationEquationUI.setLayer(active); +} ]]> </script> - <Table id='body'> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationMigrationSeasonChooser" - model='{new PopulationSeasonInfoComboModel()}' - renderer="{new PopulationSeasonInfoComboRenderer()}" - onActionPerformed='seasonChanged()' - enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' anchor='west'> - <JCheckBox id="fieldUseEquationMigration" selected='{getPopInfo().getUseEquationMigration()}' - text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' enabled='{isSelectedPopulationSeasonInfo()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.7'> - <JPanel id="hidablePanel" layout='{new CardLayout()}'> - <JTabbedPane id="fieldUseMatrix" constraints='"fieldUseMatrix"' enabled='{isSelectedPopulationSeasonInfo()}'> - <tab title='{_("isisfish.populationMigrationMigration.title")}'> - <PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"MigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - <tab title='{_("isisfish.populationMigrationImmigration.title")}'> - <PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"ImmigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - <tab title='{_("isisfish.populationMigrationEmigration.title")}'> - <PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this' decorator='boxed' - _bean='{PopulationSeasonInfoImpl.class}' _method='"EmigrationMatrix"' actif='{isSelectedPopulationSeasonInfo()}' /> - </tab> - </JTabbedPane> - <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this' - actif='{isSelectedPopulationSeasonInfo()}' /> - </JPanel> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationMigration.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <!-- comment can be null jaxx.runtime.SwingUtil.getStringValue() --> - <JTextArea id="fieldPopulationMigrationComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getMigrationComment())}' - onKeyReleased='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' - enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldPopulationMigrationSeasonChooser" + model='{new PopulationSeasonInfoComboModel()}' + renderer="{new PopulationSeasonInfoComboRenderer()}" + onActionPerformed='seasonChanged()' + enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' anchor='west'> + <JCheckBox id="fieldUseEquationMigration" selected='{getPopInfo().getUseEquationMigration()}' + text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' + enabled='{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='{_("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='{_("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='{_("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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,30 +22,38 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <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[ -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; +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) { -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - fieldPopulationMonthGapBetweenReproRecrutement.setText(""); - fieldPopulationRecruitmentComment.setText(""); + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} protected void populationRecruitmentDistributionMatrixChanged(MatrixPanelEvent event) { if (getBean() != null){ @@ -55,17 +63,14 @@ } } - at Override -public void refresh() { - Population population = getVerifier().getEntity(Population.class); +/*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((PopulationImpl) population); + setBean(population); - getVerifier().addCurrentPanel(reproductionEquation); - if (getBean() != null && getBean().getRecruitmentDistribution() != null) { fieldPopulationRecruitmentDistribution.setMatrix(getBean().getRecruitmentDistribution().copy()); @@ -75,90 +80,92 @@ // TODO add only once //fieldPopulationRecruitmentDistribution.addMatrixListener(listener); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} +}*/ ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> - <InputOneEquationUI id='reproductionEquation' constructorParams='this' - text='isisfish.populationRecruitment.reproductionEquation' - bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' - clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' - decorator='boxed' _bean='{PopulationImpl.class}' _method='"ReproductionEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' - bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' - _method='"MonthGapBetweenReproRecrutement"'/--> - <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{getBean().getMonthGapBetweenReproRecrutement()}' - onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"MonthGapBetweenReproRecrutement"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' - matrix='{getBean().getRecruitmentDistribution() == null ? null : getBean().getRecruitmentDistribution().copy()}' - enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"RecruitmentDistribution"' - onMatrixChanged="populationRecruitmentDistributionMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='getAction().createRecruitmentDistribution(getBean())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> - <JTextArea id="fieldPopulationRecruitmentComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getRecruitmentComment())}' - onKeyReleased='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' - enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> -</Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='0.5'> + <InputOneEquationUI id='reproductionEquation' constructorParams='this' + text='isisfish.populationRecruitment.reproductionEquation' active="{isActive()}" + bean='{getBean()}' formuleCategory='Reproduction' beanProperty='ReproductionEquation' + clazz='{fr.ifremer.isisfish.equation.PopulationReproductionEquation.class}' + decorator='boxed' _sensitivityBean='{Population.class}' _sensitivityMethod='"ReproductionEquation"'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldPopulationMonthGapBetweenReproRecrutement' constructorParams='this' + bean='{getBean()}' property='monthGapBetweenReproRecrutement' useSign='true' + enabled='{isActive()}' decorator='boxed' _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.5'> + <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> + </row> + <row> + <cell> + <JPanel/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='getAction().createRecruitmentDistribution(getBean())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.3'> + <JScrollPane> + <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> + <JTextArea id="fieldPopulationRecruitmentComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getRecruitmentComment())}' + onKeyReleased='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' + enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,24 +22,26 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='populationSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <Boolean id='popSeasonInfoNotNull' javaBean='false'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> + <Boolean id='ageGroupType' javaBean='false'/> - <script><![CDATA[ -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.ui.util.ErrorHelper; + <import> + 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> -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixPanelEditor; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; - + <script><![CDATA[ protected void populationSeasonLengthMatrixChanged(MatrixPanelEvent event) { if (getPopulationSeasonInfo() != null && matrixPanelPopulationSeasonLengthChange.getMatrix() != null) { // must be a copy for fire event @@ -48,28 +50,11 @@ } } -/*addPropertyChangeListener("populationSeasonInfo", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - matrixPanelPopulationSeasonLengthChange.setMatrix(null); - } - if (evt.getNewValue() != null) { - matrixPanelPopulationSeasonLengthChange.setMatrix(getPopulationSeasonInfo().getLengthChangeMatrix().copy()); - } - } -});*/ - - at Override -public void refresh() { +/*public void refresh() { // TODO add only once //matrixPanelPopulationSeasonLengthChange.addMatrixListener(matrixPanelListener); -} +}*/ - at Override -public void setActionButtons() { - -} - /** * Called on spacialized radio button change. */ @@ -113,59 +98,62 @@ } MatrixPanelEditor panel = new MatrixPanelEditor(false, 800, 300); panel.setMatrix(lengthChangeMatrix); - JOptionPane.showMessageDialog(null, panel, _("isisfish.populationSeasons.spacialized.visualisation"), JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(this, panel, _("isisfish.populationSeasons.spacialized.visualisation"), JOptionPane.INFORMATION_MESSAGE); } ]]></script> - <Table> - <row> - <cell> - <Panel/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' - text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" - buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" - selected='{!getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' - text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' - visible='{isAgeGroupType()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' - enabled='{isPopSeasonInfoNotNull()}' onActionPerformed='computeMatrixChangeOfGroup()'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" - enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected()}' decorator='boxed' - onActionPerformed='showSpacializedMatrixChangeOfGroup()' - visible='{isAgeGroupType()}'/> - </cell> - </row> - <row> - <cell> - <Panel/> - </cell> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='matrixPanelPopulationSeasonLengthChange' - enabled='{isPopSeasonInfoNotNull()}' - _bean='{PopulationSeasonInfoImpl.class}' _method='"LengthChangeMatrix"' - visible='{isAgeGroupType()}' decorator='boxed' - matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getLengthChangeMatrix().copy()}' - onMatrixChanged="populationSeasonLengthMatrixChanged(event)" /> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell> + <Panel/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" + buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" + selected='{getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' + enabled='{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().getSimpleLengthChangeMatrix()}' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,103 +22,100 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='populationSeasonInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> - <Boolean id='popSeasonInfoNotNull' javaBean='false'/> + <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[ -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl; -import fr.ifremer.isisfish.types.Month; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.ui.widget.Interval; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; - -//protected MatrixPanelListener matrixPanelListener; protected Interval seasonInterval; protected boolean init = false; -/* - * Don't add both in same listener. - * When first is set, last value from getPopulationSeasonInfo() - * is erased by interval.getLast() default value. - */ -seasonIntervalPanel.addPropertyChangeListener("first", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getPopulationSeasonInfo() != null) { - getPopulationSeasonInfo().setFirstMonth(new Month(seasonInterval.getFirst())); - setReproductionDistributionMatrix(); + +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(); + } } - } -}); -seasonIntervalPanel.addPropertyChangeListener("last", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (getPopulationSeasonInfo() != null) { - getPopulationSeasonInfo().setLastMonth(new Month(seasonInterval.getLast())); - setReproductionDistributionMatrix(); + }); + + /* + * 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(); + } } - } -}); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldPopulationSeasonComment.setText(""); - fieldPopulationSeasonReproductionDistribution.setMatrix(null); + }); + seasonIntervalPanel.addPropertyChangeListener("last", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getPopulationSeasonInfo() != null) { + getPopulationSeasonInfo().setLastMonth(new Month(seasonInterval.getLast())); + setReproductionDistributionMatrix(); + } } - if (evt.getNewValue() != null) { - - } - } -}); + }); +} -create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); - setPopulationSeasonInfo((PopulationSeasonInfoImpl)seasonNew); - setPopulationSeasonInfoCombo(); - } -}); +protected void create() { + PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); + setPopulationSeasonInfo(seasonNew); + setPopulationSeasonInfoCombo(); +} -remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); - setPopulationSeasonInfoCombo(); - } -}); +protected void delete() { + getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); + setPopulationSeasonInfo(null); + setPopulationSeasonInfoCombo(); +} -save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getVerifier().topiaSave(); - setPopulationSeasonInfoCombo(); - } -}); +protected void save() { + getSaveVerifier().save(); + setPopulationSeasonInfoCombo(); +} -/*matrixPanelListener = new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { - MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); - if (log.isDebugEnabled()) { - log.debug("Matrix ReproductionDistribution modified : " + reproductionDistribution); - } - getPopulationSeasonInfo().setReproductionDistribution(reproductionDistribution); - } - } -};*/ - protected void populationSeasonReproductionDistributionMatrixChanged(MatrixPanelEvent event) { if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); @@ -129,19 +126,16 @@ } } - at Override public void refresh() { - if (!isActif()) { - setPopSeasonInfoNotNull(false); - } - - Population population = getVerifier().getEntity(Population.class); + 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((PopulationImpl) population); + //setBean(null); + //setBean(population); + setPopulationSeasonInfo(null); + // Model instanciation seasonInterval = new Interval(); seasonInterval.setMin(0); @@ -157,23 +151,15 @@ //fieldPopulationSeasonReproductionDistribution.addMatrixListener(matrixPanelListener); - if(getPopulationSeasonInfo() != null) { - PopulationSeasonInfoImpl popInfo = getPopulationSeasonInfo(); + /*if(getPopulationSeasonInfo() != null) { + PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); setPopulationSeasonInfo(null); setPopulationSeasonInfo(popInfo); - getVerifier().addCurrentEntity(getPopulationSeasonInfo()); - } - getVerifier().addCurrentPanel(populationSeasonSpecializedUI); + getSaveVerifier().addCurrentEntity(getPopulationSeasonInfo()); + }*/ + //getSaveVerifier().addCurrentPanel(populationSeasonSpecializedUI); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save, false); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "PopulationSeasonInfo", false); - getVerifier().setDeleteButton(remove, false); -} - protected void setSeasonInterval() { if(getPopulationSeasonInfo() != null) { try { @@ -211,8 +197,9 @@ protected void setPopulationSeasonInfoCombo() { if (getBean() != null) { - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationSeasonInfoChooser, - getBean().getPopulationSeasonInfo(), getPopulationSeasonInfo(), true); + PopulationSeasonInfoComboModel populationSeasonInfoModel = new PopulationSeasonInfoComboModel(getBean().getPopulationSeasonInfo()); + fieldPopulationSeasonInfoChooser.setModel(populationSeasonInfoModel); + populationSeasonInfoModel.setSelectedItem(getPopulationSeasonInfo()); } } @@ -228,11 +215,12 @@ if (log.isDebugEnabled()) { log.debug("Season changed : " + seasonInfoSelected); } - setPopulationSeasonInfo((PopulationSeasonInfoImpl)seasonInfoSelected); - setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null); + setPopulationSeasonInfo(seasonInfoSelected); + if (seasonInfoSelected != null) { + getSaveVerifier().addCurrentEntity(seasonInfoSelected); + } setSeasonInterval(); setReproductionDistributionMatrix(); - getVerifier().addCurrentEntity(getPopulationSeasonInfo()); init = false; } @@ -252,106 +240,129 @@ populationSeasonSpecializedUI.setVisible(result); return result; } + + at Override +public void setLayer(boolean active) { + super.setLayer(active); + populationSeasonSpecializedUI.setLayer(active); +} ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldPopulationSeasonInfoChooser" - onActionPerformed='seasonChanged()' - enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.common.season" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='both'> - <JPanel/> - </cell> - <cell fill='both' weightx='1.0'> - <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" selected='{getPopulationSeasonInfo().getGroupChange()}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"GroupChange"' - onActionPerformed='seasonGroupChanged()' enabled='{isPopSeasonInfoNotNull()}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> - <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' bean='{getBean()}' - populationSeasonInfo='{getPopulationSeasonInfo()}' popSeasonInfoNotNull='{isPopSeasonInfoNotNull()}' - ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().getReproduction()}' - onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' - text="isisfish.populationSeasons.Reproduction" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isPopSeasonInfoNotNull()}' - visible='{getPopulationSeasonInfo().getReproduction()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.2'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationSeasonReproductionDistribution' - matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getReproductionDistribution().copy()}' - enabled='{isPopSeasonInfoNotNull()}' - visible='{getPopulationSeasonInfo().getReproduction()}' - decorator='boxed' _bean='{PopulationSeasonInfoImpl.class}' _method='"ReproductionDistribution"' - onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.comments" enabled='{isPopSeasonInfoNotNull()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.1'> - <JScrollPane> - <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> - <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getSeasonsComment())}' onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JComboBox id="fieldPopulationSeasonInfoChooser" + onItemStateChanged='seasonChanged()' enabled='{isActive() && !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().getGroupChange()}' + decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"GroupChange"' + onActionPerformed='seasonGroupChanged()' enabled='{getPopulationSeasonInfo() != null}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> + </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().getAgeGroupType())}'/> + </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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,69 +22,78 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> - - <script><![CDATA[ -import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabbedPaneListener; + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> -setButtonTitle(_("isisfish.input.continueGears")); -setNextPath("$root/$gears"); + <import> + static org.nuiton.i18n.I18n.n_ + </import> - at Override -public void refresh() { - + <script><![CDATA[ +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueGears")); + setNextPath(n_("isisfish.input.tree.gears")); + // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(populationTab); +} +/*public void refresh() { // reverse ordre is no more needed - getVerifier().addCurrentPanel(populationMigrationUI, populationRecruitementUI, populationCapturabilityUI, + getSaveVerifier().addCurrentPanel(populationMigrationUI, populationRecruitementUI, populationCapturabilityUI, populationSeasonsUI, populationZoneUI, populationEquationUI, populationGroupUI, populationBasicsUI); -} +}*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(populationTab); +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); } ]]> </script> - <JPanel id='body' layout='{new BorderLayout()}'> - <JTabbedPane id="populationTab" constraints='BorderLayout.CENTER'> + <JPanel id='body'> + <JTabbedPane id="populationTab"> <!-- Saisie des populations --> - <tab title='{_("isisfish.populationBasics.title")}'> - <PopulationBasicsUI id='populationBasicsUI' constructorParams='this'/> + <tab title='isisfish.populationBasics.title'> + <PopulationBasicsUI id='populationBasicsUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Zones --> - <tab title='{_("isisfish.populationZones.title")}'> - <PopulationZonesUI id='populationZoneUI' constructorParams='this'/> + <tab title='isisfish.populationZones.title'> + <PopulationZonesUI id='populationZoneUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisons --> - <tab title='{_("isisfish.populationSeasons.title")}'> - <PopulationSeasonsUI id='populationSeasonsUI' constructorParams='this'/> + <tab title='isisfish.populationSeasons.title'> + <PopulationSeasonsUI id='populationSeasonsUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des équations --> - <tab title='{_("isisfish.populationEquation.title")}'> - <PopulationEquationUI id='populationEquationUI' constructorParams='this'/> + <tab title='isisfish.populationEquation.title'> + <PopulationEquationUI id='populationEquationUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des reproductions --> - <tab title='{_("isisfish.populationRecruitment.title")}'> - <PopulationRecruitmentUI id='populationRecruitementUI' constructorParams='this'/> + <tab title='isisfish.populationRecruitment.title'> + <PopulationRecruitmentUI id='populationRecruitementUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Saisie des groupes de population --> - <tab title='{_("isisfish.populationGroup.title")}'> - <PopulationGroupUI id='populationGroupUI' constructorParams='this'/> + <tab title='isisfish.populationGroup.title'> + <PopulationGroupUI id='populationGroupUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!--Capturabilité --> - <tab title='{_("isisfish.populationCapturability.title")}'> - <PopulationCapturabilityUI id='populationCapturabilityUI' constructorParams='this'/> + <tab title='isisfish.populationCapturability.title'> + <PopulationCapturabilityUI id='populationCapturabilityUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <!-- Migration --> - <tab title='{_("isisfish.populationMigration.title")}'> - <PopulationMigrationUI id='populationMigrationUI' constructorParams='this'/> + <tab title='isisfish.populationMigration.title'> + <PopulationMigrationUI id='populationMigrationUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,66 +22,80 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <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[ -import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.ui.input.population.ZoneListModel; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; +protected boolean init = false; -/*MatrixPanelListener listener = new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent event) { - fieldPopulationMappingZoneReproZoneRecruChanged(); - } -};*/ +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + } + if (evt.getNewValue() != null) { + init = true; + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + init = false; + } + } + }); +} protected void populationMappingZoneReproZoneRecruMatrixChanged(MatrixPanelEvent event) { - //fieldPopulationMappingZoneReproZoneRecruChanged(); getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().clone()); } - at Override -public void refresh(){ +/*public void refresh() { setPopulationZonesPresenceModel(); setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); //fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener); setFieldPopulationMappingZoneReproZoneRecru(); //fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); -} +}*/ - at Override -public void setActionButtons() { - -} - -/*protected void fieldPopulationMappingZoneReproZoneRecruChanged(){ - getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix()); -}*/ -protected void setFieldPopulationMappingZoneReproZoneRecru(){ - if (getBean() != null){ - if (getBean().getMappingZoneReproZoneRecru() != null){ +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 = getRegion().getZone(); +protected void setPopulationZonesPresenceModel() { + if (getBean() != null) { + java.util.List<Zone> zones = getFisheryRegion().getZone(); setModel(zones, getBean().getPopulationZone(), populationZonesPresence); } } -protected void setFieldPopulationZonesReproductionModel(java.util.List<Zone> zones){ - if (getBean() != null){ +protected void setFieldPopulationZonesReproductionModel(List<Zone> zones) { + if (getBean() != null) { setModel(zones, getBean().getReproductionZone(), fieldPopulationZonesReproduction); } } -protected void setFieldPopulationZonesRecruitmentModel(java.util.List<Zone> zones){ - if (getBean() != null){ +protected void setFieldPopulationZonesRecruitmentModel(List<Zone> zones) { + if (getBean() != null) { setModel(zones, getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment); } } @@ -90,7 +104,7 @@ * Change model of {@code associatedList} with all available zones, but keep * selection with {@code selectedZones}. */ -protected void setModel(java.util.List<Zone> availableZones, java.util.List<Zone> selectedZones, JList associatedList){ +protected void setModel(List<Zone> availableZones, List<Zone> selectedZones, JList associatedList) { ZoneListModel zoneModel = new ZoneListModel(availableZones); associatedList.setModel(zoneModel); @@ -102,27 +116,36 @@ } } } -protected void presenceChanged(){ - getBean().setPopulationZone(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); - setFieldPopulationMappingZoneReproZoneRecru(); + +protected void presenceChanged() { + if (!init) { + getBean().setPopulationZone(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesReproductionModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationZonesRecruitmentModel(getSelectedValues(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); + } } -protected void reproductionChanged(){ - getBean().setReproductionZone(getSelectedValues(fieldPopulationZonesReproduction)); - setFieldPopulationMappingZoneReproZoneRecru(); + +protected void reproductionChanged() { + if (!init) { + getBean().setReproductionZone(getSelectedValues(fieldPopulationZonesReproduction)); + setFieldPopulationMappingZoneReproZoneRecru(); + } } -protected void recruitementChanged(){ - getBean().setRecruitmentZone(getSelectedValues(fieldPopulationZonesRecruitment)); - setFieldPopulationMappingZoneReproZoneRecru(); + +protected void recruitementChanged() { + if (!init) { + getBean().setRecruitmentZone(getSelectedValues(fieldPopulationZonesRecruitment)); + setFieldPopulationMappingZoneReproZoneRecru(); + } } /** * Get selected values for components as list. */ -protected java.util.List<Zone> getSelectedValues(JList component){ +protected List<Zone> getSelectedValues(JList component) { Object[] selectedValues = component.getSelectedValues(); - java.util.List<Zone> selectedZone = new ArrayList<Zone>(); + List<Zone> selectedZone = new ArrayList<Zone>(); for (Object value : selectedValues) { selectedZone.add((Zone)value); } @@ -130,46 +153,48 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="populationZonesPresence" onMouseClicked='presenceChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="fieldPopulationZonesReproduction" onMouseClicked='reproductionChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - <cell fill='both' weightx='0.3' weighty='0.5'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="fieldPopulationZonesRecruitment" onMouseClicked='recruitementChanged()' enabled='{isActif()}'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='3' anchor='west'> - <JLabel text="isisfish.populationZones.betweenSpawningRecruitmentAreas" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='3' fill='both' weightx='1.0' weighty='0.5'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationMappingZoneReproZoneRecru' - constructorParams='false' enabled='{isActif()}' - onMatrixChanged="populationMappingZoneReproZoneRecruMatrixChanged(event)" /> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.3'> + <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell fill='both' weightx='0.3' weighty='0.5'> + <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> + <JList id="populationZonesPresence" 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)" /> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,50 +22,52 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Population'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + <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[ - -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; - - at Override -public void refresh() { - Population population = getVerifier().getEntity(Population.class); +/*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((PopulationImpl) population); + setBean(population); - getVerifier().addCurrentPanel(popZones); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); -} + getSaveVerifier().addCurrentPanel(popZones); +}*/ ]]> </script> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1'> - <PopulationZonesEditorUI id='popZones' constructorParams='this' - bean='{getBean()}' actif='{isActif()}' decorator='boxed' - _bean='{PopulationImpl.class}' _method='"MappingZoneReproZoneRecru"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1'> + <PopulationZonesEditorUI id='popZones' constructorParams='this' + bean='{getBean()}' active='{isActive()}' decorator='boxed' + _sensitivityBean='{Population.class}' _sensitivityMethod='"MappingZoneReproZoneRecru"'/> + </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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,102 +22,99 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Port'> <!-- bean property --> - <fr.ifremer.isisfish.entities.PortImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Port id='bean' javaBean='null'/> + <import> + static org.nuiton.i18n.I18n.n_ + fr.ifremer.isisfish.entities.Port + fr.ifremer.isisfish.entities.Cell + com.bbn.openmap.gui.Tool + com.bbn.openmap.gui.OMToolSet + fr.ifremer.isisfish.map.CellSelectionLayer + fr.ifremer.isisfish.map.CopyMapToClipboardListener + 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[ -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.PortImpl; -import fr.ifremer.isisfish.entities.Cell; -import com.bbn.openmap.gui.Tool; -import com.bbn.openmap.gui.OMToolSet; -import fr.ifremer.isisfish.map.CellSelectionLayer; -import fr.ifremer.isisfish.map.CopyMapToClipboardListener; -import com.bbn.openmap.event.SelectMouseMode; - protected OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; boolean portChanged = true; -toolSet.setupListeners(portMap); -toolMap.add((Tool)toolSet); +protected void $afterCompleteSetup() { + toolSet.setupListeners(portMap); + toolMap.add((Tool)toolSet); + + // add copy to clipboard support + portMap.addMapMouseListener(new CopyMapToClipboardListener(portMap)); + new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + 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; + } + }; -// add copy to clipboard support -portMap.addMapMouseListener(new CopyMapToClipboardListener(portMap)); - -setMapListener(); -setButtonTitle(_("isisfish.input.continueSpecies")); -setNextPath("$root/$species"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldPortName.setText(""); - fieldPortComment.setText(""); + setButtonTitle(_("isisfish.input.continueSpecies")); + setNextPath(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(); + } } - if (evt.getNewValue() != null) { + }); +} - } - } -}); - - at Override -public void refresh() { - Port port = getVerifier().getEntity(Port.class); +/*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((PortImpl) port); + setBean(port); // reload region in map refreshRegionInMap(portMap); +}*/ - fillList(); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Port"); - getVerifier().setDeleteButton(remove); -} - -protected void fillList() { +protected void fillCellList() { if (getBean() != null) { portChanged = false; - portCell.fillList(getRegion().getCell(), getBean().getCell()); + portCell.fillList(getFisheryRegion().getCell(), getBean().getCell()); portCell.setSelectedValue(getBean().getCell()); portChanged = true; } } -protected void setMapListener() { - if (mapListener == null) { - mapListener = new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - for (Cell c : portMap.getSelectedCells()) { - if (getBean() != null) { - if (getBean().getCell() != null) { - if (!getBean().getCell().getTopiaId().equals(c.getTopiaId())){ - getBean().setCell(c); - return true; - } - } - else { - getBean().setCell(c); - return true; - } - } - } - return true; - } - }; - } -} protected void portChanged() { if (portChanged) { @@ -125,70 +122,82 @@ } } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JSplitPane id="PortTab" name="Ports" - oneTouchExpandable="true" dividerLocation="270" orientation="horizontal"> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JLabel text="isisfish.port.name" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JTextField id="fieldPortName" text='{SwingUtil.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldPortName.getText())' enabled='{isActif()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' > - <JLabel text="isisfish.port.cell" enabled='{isActif()}'/> - - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> - <JScrollPane> - <JList id="portCell" selectedValue='{getBean().getCell()}' selectionMode="0" onMouseClicked='portChanged()' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel text="isisfish.port.comments" enabled='{isActif()}'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.3' weightx='1.0' > - <JScrollPane> - <JTextArea id="fieldPortComment" text='{SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPortComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' decorator='boxed'/> - <fr.ifremer.isisfish.map.IsisMapBean id='portMap' selectedCells='{getBean().getCell()}' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' constraints='BorderLayout.CENTER' selectionMode="1" decorator='boxed' fisheryRegion='{getRegion()}'/> - </JPanel> - </JSplitPane> - </cell> - </row> - </Table> + <JPanel id="body"> + <JSplitPane oneTouchExpandable="true" dividerLocation="270" orientation="horizontal"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JLabel text="isisfish.port.name" enabled='{isActive()}'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JTextField id="fieldPortName" text='{SwingUtil.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldPortName.getText())' enabled='{isActive()}' decorator='boxed' /> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' > + <JLabel text="isisfish.port.cell" enabled='{isActive()}'/> + + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> + <JScrollPane 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()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' javaBean='new com.bbn.openmap.gui.ToolPanel()' + constraints='BorderLayout.NORTH' decorator='boxed' enabled='{getBean() != null}' /> + <fr.ifremer.isisfish.map.IsisMapBean id='portMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + constraints='BorderLayout.CENTER' selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.SINGLE_SELECTION}" + decorator='boxed' enabled='{getBean() != null}' fisheryRegion='{getFisheryRegion()}' + selectedCells='{getBean() == null ? null : bean.getCell()}' /> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,37 +22,49 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> - <script><![CDATA[ -import fr.ifremer.isisfish.types.RangeOfValues; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; + <import> + fr.ifremer.isisfish.types.RangeOfValues + fr.ifremer.isisfish.entities.Gear + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener + java.util.ArrayList + </import> -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldGearParamPossibleValue.setText(""); - } - if (evt.getNewValue() != null) { + <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; + } } - } -}); + }); +} -boolean init = false; - - at Override -public void refresh() { - Gear gear = getVerifier().getEntity(Gear.class); +/*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((GearImpl) gear); + setBean(gear); if (getBean() != null) { java.util.List<Object> values = new ArrayList<Object>(); @@ -64,29 +76,25 @@ jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); init = false; } -} +}*/ - at Override -public void setActionButtons() { - -} - protected void gearParamChanged() { - if (fieldGearParamType.getSelectedItem() != null) { - if (!init) { - getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); - } + if (fieldGearParamType.getSelectedItem() != null && !init) { + getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); } } ]]></script> - <Table id='body'> - <row> - <cell fill='horizontal' weightx='0.5'> - <JComboBox id="fieldGearParamType" onActionPerformed='gearParamChanged()' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue() == null ? "" : getBean().getPossibleValue().getValues()}' onKeyReleased='gearParamChanged()' enabled='{isActif()}'/> - </cell> - </row> - </Table> -</fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file + <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: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,180 +0,0 @@ -<!-- - #%L - IsisFish - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-2.0.html>. - #L% - --> -<fr.ifremer.isisfish.ui.input.InputContentUI> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> - - <fr.ifremer.isisfish.entities.PopulationImpl id='population' javaBean='null'/> - - <Boolean id='selectivityPopulationSelected' javaBean='false'/> - - <script><![CDATA[ -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.entities.Selectivity; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.ui.input.gear.GearPopulationSelectivityModel; -import fr.ifremer.isisfish.ui.input.gear.PopulationComboModel; -import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor; - -selectivityTable.addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - // le bouton ne doit pas s'activer dans l'analyse de sensibilite - if (isActif()) { - removeSelectivityButton.setEnabled(selectivityTable.getSelectedRow() != -1); - } - } -}); - - at Override -public void refresh() { - - Gear gear = (Gear)getVerifier().getEntity(Gear.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean((GearImpl) gear); - - if (getBean() != null) { - setSelectivityPopulationSelected(false); - setSelectivityTableModel(); - fieldSelectivityPopulation.setModel(getSelectivityPopulationModel()); - } - getVerifier().addCurrentPanel(selectivityEquation); - - // reset to false after addCurrentPanel refresh - selectivityEquation.setActif(false); - - setSelectivityPopulationSelected(false); - removeSelectivityButton.setEnabled(false); -} - - at Override -public void setActionButtons() { - -} - -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()) { - getVerifier().addCurrentEntity(oneSelectivity); - selectivitiesList.add(oneSelectivity); - } - } - - // 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((Population)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); - setSelectivityTableModel(); - removeSelectivityButton.setEnabled(false); -} - -protected DefaultComboBoxModel getSelectivityPopulationModel() { - java.util.List<Species> species = getRegion().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() { - setSelectivityPopulationSelected(fieldSelectivityPopulation.getSelectedItem() != null); - // FIXME remove Impl reference - setPopulation((PopulationImpl)fieldSelectivityPopulation.getSelectedItem()); - addSelectivityButton.setEnabled(isSelectivityPopulationSelected()); -} - ]]></script> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActif()}' decorator='boxed' /> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSelectivityPopulation" onActionPerformed='selectivityChanged()' enabled='{isActif()}' - decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0' insets="0"> - <InputOneEquationUI id='selectivityEquation' constructorParams='this' - text='isisfish.selectivity.equation' - bean='{getBean()}' formuleCategory='Selectivity' actif='{isSelectivityPopulationSelected()}' - clazz='{fr.ifremer.isisfish.equation.SelectivityEquation.class}' - decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="addSelectivityButton" text="isisfish.common.add" onActionPerformed='addSelectivity()' - enabled='{isSelectivityPopulationSelected()}' decorator='boxed' /> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTable id="selectivityTable" rowHeight='24' enabled='{isActif()}' decorator='boxed' /> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JButton id="removeSelectivityButton" text="isisfish.common.remove" onActionPerformed='removeSelectivity()' - enabled='false' decorator='boxed' /> - </cell> - </row> - </Table> -</fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,47 +22,188 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Gear'> <!-- bean property --> - <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.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[ -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.GearImpl; +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(); + } + } + }); +} - at Override public void refresh() { - Gear gear = (Gear)getVerifier().getEntity(Gear.class); - + + 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((GearImpl) gear); + //setBean(null); + //setBean(gear); + + if (getBean() != null) { + setSelectivityTableModel(); + fieldSelectivityPopulation.setModel(getSelectivityPopulationModel()); + } +} + +protected void setSelectivityTableModel() { - getVerifier().addCurrentPanel(editor); + 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()); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); +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); + 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> - <Table> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> - <SelectivityEditorUI id='editor' constructorParams='this' bean='{getBean()}' - _bean='{GearImpl.class}' _method='"PopulationSelectivity"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell columns="2" fill='both' weightx='1.0' weighty='1.0'> + <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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,54 +22,75 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='SetOfVessels'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> - <script><![CDATA[ + <import> + 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 + jaxx.runtime.swing.editor.NumberEditor + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + </import> -import org.nuiton.topia.TopiaException; -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.SetOfVessels; -import jaxx.runtime.swing.editor.NumberEditor; -import fr.ifremer.isisfish.entities.SetOfVesselsImpl; + <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; - at Override -public void refresh() { - SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class); +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((SetOfVesselsImpl) setOfVessels); + setBean(setOfVessels); if (getBean() != null) { init = true; - jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort(), true); - jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType(), true); + jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsPort,getFisheryRegion().getPort(), getBean().getPort(), true); + jaxx.runtime.SwingUtil.fillComboBox(fieldSetOfVesselsVesselType,getFisheryRegion().getVesselType(), getBean().getVesselType(), true); init=false; - getVerifier().addCurrentPanel(technicalEfficiency); + getSaveVerifier().addCurrentPanel(technicalEfficiency); // NumberEditor is not working //fieldSetOfVesselsNumberOfVessels.init(); //fieldSetOfVesselsFixedCosts.init(); } -} +}*/ - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "SetOfVessels"); - getVerifier().setDeleteButton(remove); -} - protected void portChanged() { if (!init) { getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem()); @@ -82,106 +103,122 @@ } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldSetOfVesselsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.common.port" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSetOfVesselsPort" onActionPerformed='portChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldSetOfVesselsVesselType" onActionPerformed='vesselTypeChanged()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldSetOfVesselsNumberOfVessels' constructorParams='this' - bean='{getBean()}' property='numberOfVessels' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{SetOfVesselsImpl.class}' _method='"NumberOfVessels"'/--> - <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{getBean().getNumberOfVessels()}' - onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"NumberOfVessels"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldSetOfVesselsFixedCosts' constructorParams='this' - bean='{getBean()}' property='fixedCosts' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{SetOfVesselsImpl.class}' _method='"FixedCosts"'/--> - <JTextField id="fieldSetOfVesselsFixedCosts" text='{getBean().getFixedCosts()}' - onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"FixedCosts"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='0.3'> - <InputOneEquationUI id='technicalEfficiency' constructorParams='this' - text='isisfish.setOfVessels.technicalEfficiency' - bean='{getBean()}' formuleCategory='TechnicalEfficiency' beanProperty='TechnicalEfficiencyEquation' - clazz='{fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class}' - decorator='boxed' _bean='{SetOfVesselsImpl.class}' _method='"TechnicalEfficiencyEquation"'/> - </cell> - </row> - <row> - <cell anchor='east'> - <JLabel text="isisfish.setOfVessels.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <JTextArea id="fieldSetOfVesselsComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='east'> + <JLabel text="isisfish.setOfVessels.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldSetOfVesselsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='east'> + <JLabel text="isisfish.common.port" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,38 +22,46 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.SetOfVessels'> + <fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.n_ + </import> + <script><![CDATA[ -setButtonTitle(_("isisfish.input.continueStrategies")); -setNextPath("$root/$strategies"); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueStrategies")); + setNextPath(n_("isisfish.input.tree.strategies")); - at Override -public void refresh() { - // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(setOfVesselsTab); - - getVerifier().addCurrentPanel(setOfVesselsBasicsUI, effortDescriptionUI, effortParametersUI); } +/*public void refresh() { + getSaveVerifier().addCurrentPanel(setOfVesselsBasicsUI, effortDescriptionUI, effortParametersUI); +}*/ + @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(setOfVesselsTab); +public void setLayer(boolean active) { + super.setLayer(active); + setOfVesselsBasicsUI.setLayer(active); + effortDescriptionUI.setLayer(active); + effortParametersUI.setLayer(active); } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JTabbedPane id="setOfVesselsTab" constraints='BorderLayout.CENTER'> - <tab title='{_("isisfish.setOfVessels.title")}'> - <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' constructorParams='this'/> + <JPanel id="body"> + <JTabbedPane id="setOfVesselsTab"> + <tab title='isisfish.setOfVessels.title'> + <SetOfVesselsBasicsUI id='setOfVesselsBasicsUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> - <tab title='{_("isisfish.effortDescription.title")}'> - <EffortDescriptionUI id='effortDescriptionUI' constructorParams='this'/> + <tab title='isisfish.effortDescription.title'> + <EffortDescriptionUI id='effortDescriptionUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> - <tab title='{_("isisfish.effortDescription.parametersTitle")}'> - <EffortDescriptionParametersUI id='effortParametersUI' constructorParams='this'/> + <tab title='isisfish.effortDescription.parametersTitle'> + <EffortDescriptionParametersUI id='effortParametersUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,22 +22,11 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> -<Table> - <fr.ifremer.isisfish.entities.SpeciesImpl id='bean' javaBean='null'/> - <Boolean id='actif' javaBean='false'/> - <script><![CDATA[ - - @Override - public void refresh() { +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> - } - - @Override - public void setActionButtons() { - - } + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> + <script><![CDATA[ protected void dynamicChanged() { if (getBean() != null) { getBean().setAgeGroupType(fieldSpeciesDynamicAge.isSelected()); @@ -45,15 +34,18 @@ } ]]> </script> - <row> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().getAgeGroupType()}' - buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().getAgeGroupType()}' - buttonGroup="structuredGroup" enabled='{isActif()}'/> - </cell> - </row> -</Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().getAgeGroupType()}' + buttonGroup="structuredGroup" onItemStateChanged='dynamicChanged()' enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().getAgeGroupType()}' + buttonGroup="structuredGroup" enabled='{isActive()}'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,148 +22,182 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Species'> <!-- bean property --> - <fr.ifremer.isisfish.entities.SpeciesImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/> + <import> + static org.nuiton.i18n.I18n.n_ + fr.ifremer.isisfish.entities.Species; + jaxx.runtime.swing.editor.NumberEditor; + 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[ -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.SpeciesImpl; -import jaxx.runtime.swing.editor.NumberEditor; +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continuePopulations")); + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldSpeciesName.setText(""); + fieldSpeciesScientificName.setText(""); + fieldSpeciesCodeRubbin.setText(""); + fieldSpeciesCEE.setText(""); + fieldSpeciesComment.setText(""); + } + if (evt.getNewValue() != null) { -setButtonTitle(_("isisfish.input.continuePopulations")); + } + } + }); +} -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldSpeciesName.setText(""); - fieldSpeciesScientificName.setText(""); - fieldSpeciesCodeRubbin.setText(""); - fieldSpeciesCEE.setText(""); - fieldSpeciesComment.setText(""); + at 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")); } - if (evt.getNewValue() != null) { + else { + inputUI.getHandler().setTreeSelection(this, getBean().getTopiaId(), n_("isisfish.input.tree.populations")); } } -}); +} -public void refresh() { - Species species = (Species)getVerifier().getEntity(Species.class); +/*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((SpeciesImpl) species); + setBean(species); if (getBean() != null) { setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations"); // Number Editor is not working //fieldSpeciesCEE.init(); } -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Species"); - getVerifier().setDeleteButton(delete); -} - +}*/ ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell> - <JLabel text="isisfish.species.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldSpeciesName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesScientificName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getScientificName())}' - onKeyReleased='getBean().setScientificName(fieldSpeciesScientificName.getText())' - enabled='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"ScientificName"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <JTextField id="fieldSpeciesCodeRubbin" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getCodeRubbin())}' - onKeyReleased='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActif()}' - decorator='boxed' _bean='{SpeciesImpl.class}' _method='"CodeRubbin"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.cee" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' columns='2' weightx='1.0'> - <!--NumberEditor id='fieldSpeciesCEE' constructorParams='this' - bean='{getBean()}' property='codeCEE' - decorator='boxed' _bean='{SpeciesImpl.class}' - useSign='true' _method='"CodeCEE"'/--> - <JTextField id="fieldSpeciesCEE" text='{getBean().getCodeCEE()}' - onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"CodeCEE"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.structured" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1' columns='2'> - <SpeciesStructuredUI bean='{getBean()}' actif='{isActif()}' decorator='boxed' _bean='{SpeciesImpl.class}' _method='"AgeGroupType"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.species.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' columns='2' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldSpeciesComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id='body'> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell> + <JLabel text="isisfish.species.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <JTextField id="fieldSpeciesName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldSpeciesName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.species.scientificName" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' columns='2' weightx='1.0'> + <JTextField id="fieldSpeciesScientificName" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getScientificName())}' + onKeyReleased='getBean().setScientificName(fieldSpeciesScientificName.getText())' + enabled='{isActive()}' decorator='boxed' _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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,101 +22,217 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + + <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> + org.apache.commons.lang.StringUtils + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + static org.nuiton.i18n.I18n._ + </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[ -import org.apache.commons.lang.StringUtils; +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); + } + 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)); + } + } + }); +} - at Override +/*@Override public void refresh() { - strategyJanuary.init(0); - strategyFebuary.init(1); - strategyMarch.init(2); - strategyApril.init(3); - strategyMay.init(4); - strategyJune.init(5); - strategyJuly.init(6); - strategyAugust.init(7); - strategySeptember.init(8); - strategyOctober.init(9); - strategyNovember.init(10); - strategyDecember.init(11); - getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, - strategyApril, strategyMay, strategyJune, - strategyJuly, strategyAugust, strategySeptember, - strategyOctober, strategyNovember, strategyDecember); -} + //getSaveVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, + // strategyApril, strategyMay, strategyJune, + // strategyJuly, strategyAugust, strategySeptember, + // strategyOctober, strategyNovember, strategyDecember); +}*/ @Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); +public void setLayer(boolean 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); } ]]></script> - <JPanel id='body' layout='{new BorderLayout()}'> + <JPanel id='body'> <Table constraints='BorderLayout.CENTER'> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.january"))}' /> + <StrategyOneMonthInfoUI id='strategyJanuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo0()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.january"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.february"))}' /> + <StrategyOneMonthInfoUI id='strategyFebuary' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo1()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.february"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.march"))}' /> + <StrategyOneMonthInfoUI id='strategyMarch' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo2()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.march"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyApril' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.april"))}' /> + <StrategyOneMonthInfoUI id='strategyApril' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo3()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.april"))}' /> </cell> </row> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyMay' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.may"))}' /> + <StrategyOneMonthInfoUI id='strategyMay' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo4()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.may"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJune' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.june"))}' /> + <StrategyOneMonthInfoUI id='strategyJune' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo5()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.june"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.july"))}' /> + <StrategyOneMonthInfoUI id='strategyJuly' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo6()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.july"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.august"))}' /> + <StrategyOneMonthInfoUI id='strategyAugust' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo7()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.august"))}' /> </cell> </row> <row> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.september"))}' /> + <StrategyOneMonthInfoUI id='strategySeptember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo8()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.september"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.october"))}' /> + <StrategyOneMonthInfoUI id='strategyOctober' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo9()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.october"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.november"))}' /> + <StrategyOneMonthInfoUI id='strategyNovember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo10()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.november"))}' /> </cell> <cell fill='both' weightx='1' weighty='1' insets='0'> - <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='this' - strategieMonthText='{StringUtils.capitalize(_("isisfish.month.december"))}' /> + <StrategyOneMonthInfoUI id='strategyDecember' bean="{getBean()}" active="{isActive()}" constructorParams='this' + strategyMonthInfo="{getStrategyMonthInfo11()}" strategieMonthText='{StringUtils.capitalize(_("isisfish.month.december"))}' /> </cell> </row> </Table> <Table constraints='BorderLayout.SOUTH'> <row> <cell fill='horizontal' weightx='1'> - <JButton id='save' decorator='boxed'/> + <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'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{changeModel.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,25 +22,45 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> <String id="strategieMonthText" javaBean='null'/> <!-- bean property --> - <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> - <fr.ifremer.isisfish.entities.StrategyMonthInfoImpl id='strategyMonthInfo' javaBean='null'/> + <fr.ifremer.isisfish.entities.StrategyMonthInfo id='strategyMonthInfo' javaBean='null'/> + <import> + fr.ifremer.isisfish.entities.Strategy + fr.ifremer.isisfish.entities.StrategyMonthInfo + org.nuiton.math.matrix.gui.MatrixPanelEvent + jaxx.runtime.swing.editor.NumberEditor + fr.ifremer.isisfish.entities.TripType + org.nuiton.math.matrix.gui.MatrixPanelListener + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.input.model.TripTypeComboModel + </import> + <script><![CDATA[ -import fr.ifremer.isisfish.entities.StrategyMonthInfoImpl; -import fr.ifremer.isisfish.entities.Strategy; -import fr.ifremer.isisfish.entities.StrategyImpl; -import org.nuiton.math.matrix.gui.MatrixPanelEvent; -import jaxx.runtime.swing.editor.NumberEditor; -import fr.ifremer.isisfish.entities.TripType; +protected boolean init; -protected int month = 0; +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; + } + } + }); +} + protected void strategyMonthInfoProportionMatrixChanged(MatrixPanelEvent event) { if (getStrategyMonthInfo() != null && fieldStrategyMonthInfoProportion.getMatrix() != null) { if (log.isDebugEnabled()) { @@ -50,58 +70,26 @@ } } - at Override public void refresh() { - Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class); - - // don't use setBean(null) here - setBean((StrategyImpl)strategy); + if (getStrategyMonthInfo() != null) { + numberOfTrips.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); + fieldStrategyMonthInfoProportion.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); + fieldStrategyMonthInfoMinInactivityDays.putClientProperty("sensitivityBeanID", getStrategyMonthInfo().getTopiaId()); - if (getBean() != null) { - Object[] monthInfos = getBean().getStrategyMonthInfo().toArray(); - if (monthInfos.length != 0) { - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setStrategyMonthInfo(null); - setStrategyMonthInfo((StrategyMonthInfoImpl) monthInfos[month]); - getVerifier().addCurrentEntity(getStrategyMonthInfo()); - - if (getStrategyMonthInfo() != null) { - numberOfTrips.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); - fieldStrategyMonthInfoProportion.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); - fieldStrategyMonthInfoMinInactivityDays.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); - ActionListener[] listeners = fieldStrategyMonthInfoTripType.getActionListeners(); - for (ActionListener listener : listeners) { - fieldStrategyMonthInfoTripType.removeActionListener(listener); - } - jaxx.runtime.SwingUtil.fillComboBox(fieldStrategyMonthInfoTripType,getRegion().getTripType(), getStrategyMonthInfo().getTripType(), true); - for (ActionListener listener : listeners) { - fieldStrategyMonthInfoTripType.addActionListener(listener); - } - setProportionMetierMatrix(); - } - else { - // don't put in addPropertyChangeListener - // if called after, remove content :( - numberOfTrips.setText(""); - fieldStrategyMonthInfoMinInactivityDays.setText(""); - fieldStrategyMonthInfoProportion.setMatrix(null); - } - } + TripTypeComboModel model = new TripTypeComboModel(getFisheryRegion().getTripType()); + fieldStrategyMonthInfoTripType.setModel(model); + fieldStrategyMonthInfoTripType.setSelectedItem(getStrategyMonthInfo().getTripType()); + setProportionMetierMatrix(); } - //fieldStrategyMonthInfoProportion.addMatrixListener(matrixListener); + else { + // don't put in addPropertyChangeListener + // if called after, remove content :( + numberOfTrips.setText(""); + fieldStrategyMonthInfoMinInactivityDays.setText(""); + fieldStrategyMonthInfoProportion.setMatrix(null); + } } - at Override -public void setActionButtons() { - -} - -public void init(int m) { - month = m; -} - protected void setProportionMetierMatrix() { if (getStrategyMonthInfo().getProportionMetier() != null) { fieldStrategyMonthInfoProportion.setMatrix(getStrategyMonthInfo().getProportionMetier().copy()); @@ -111,48 +99,51 @@ } } ]]></script> - <Table id='body'> - <row> - <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'> - <JLabel enabled='{isActif()}' text="{getStrategieMonthText()}" font-weight="bold"/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel id='numberOfTrips' text='{getStrategyMonthInfo().getNumberOfTrips()}' enabled='{isActif()}' - decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"NumberOfTrips"'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5' anchor='west'> - <JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <!-- NumberEditor id='fieldStrategyMonthInfoMinInactivityDays' constructorParams='this' - bean='{getStrategyMonthInfo()}' property='minInactivityDays' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/--> - <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{getStrategyMonthInfo().getMinInactivityDays()}' - onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"MinInactivityDays"'/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" linearModelShowDefault='{true}' - linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' - onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" - enabled='{isActif()}' decorator='boxed' _bean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _method='"ProportionMetier"'/> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'> + <JLabel enabled='{isActive()}' text="{getStrategieMonthText()}" font-weight="bold"/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JComboBox id="fieldStrategyMonthInfoTripType" + onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5' anchor='west'> + <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='0.5' anchor='west'> + <JLabel id='numberOfTrips' text='{String.valueOf(getStrategyMonthInfo().getNumberOfTrips())}' enabled='{isActive()}' + decorator='boxed' _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> + <row> + <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" linearModelShowDefault='{true}' + linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' + onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"ProportionMetier"'/> + </cell> + </row> + </Table> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,37 +22,61 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Strategy'> <!-- bean property --> - <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + <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[ -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.StrategyImpl; -import fr.ifremer.isisfish.entities.Strategy; -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.SetOfVessels; -import org.nuiton.topia.persistence.TopiaEntity; -import fr.ifremer.isisfish.ui.WelcomePanelUI; +protected boolean init; - at Override -public void refresh() { - Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class); +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((StrategyImpl) strategy); + //setBean(null); + //setBean(strategy); if (getBean() != null) { setSetOfVesselsModel(); //fieldStrategyProportionSetOfVessels.init(); // code to replace bindings : - strategyInactivity.setActif(isActif() && getBean().getInactivityEquationUsed()); + strategyInactivity.setActive(isActive() && getBean().getInactivityEquationUsed()); - getVerifier().addCurrentPanel(strategyInactivity); + //getSaveVerifier().addCurrentPanel(strategyInactivity); } else { // listener seam to be called after refresh and remove content :( @@ -62,122 +86,126 @@ fieldStrategyComment.setText(""); // code to replace bindings : - strategyInactivity.setActif(isActif()); + strategyInactivity.setActive(isActive()); } -} +}*/ - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Strategy"); - getVerifier().setDeleteButton(remove); -} - protected void setSetOfVesselsModel() { - ActionListener[] listeners = fieldStrategySetOfVessels.getActionListeners(); - for (ActionListener listener : listeners) { - fieldStrategySetOfVessels.removeActionListener(listener); - } - jaxx.runtime.SwingUtil.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels(), true); - for (ActionListener listener : listeners) { - fieldStrategySetOfVessels.addActionListener(listener); - } + SetOfVesselsComboModel modelVessel = new SetOfVesselsComboModel(getFisheryRegion().getSetOfVessels()); + fieldStrategySetOfVessels.setModel(modelVessel); + fieldStrategySetOfVessels.setSelectedItem(getBean().getSetOfVessels()); } -protected void inactivityEquationActionPerformed() { - boolean checked = fieldUseEquationInactivity.isSelected(); - getBean().setInactivityEquationUsed(checked); - strategyInactivity.setActif(checked); +protected void setOfVesselsChanged() { + if (!init) { + getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem()); + } } ]]></script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldStrategyName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldStrategyName.getText())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.common.setOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JComboBox id="fieldStrategySetOfVessels" onActionPerformed='getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem())' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!-- NumberEditor id='fieldStrategyProportionSetOfVessels' constructorParams='this' - bean='{getBean()}' property='proportionSetOfVessels' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{StrategyImpl.class}' _method='"ProportionSetOfVessels"'/--> - <JTextField id="fieldStrategyProportionSetOfVessels" text='{getBean().getProportionSetOfVessels()}' - onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{StrategyImpl.class}' _method='"ProportionSetOfVessels"'/> - </cell> - </row> - <row> - <cell> - <JPanel/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().getInactivityEquationUsed()}' - text="isisfish.strategy.inactivityEquationUsed" - onActionPerformed='inactivityEquationActionPerformed()' enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell columns="2" fill='both' weightx='1.0' weighty='0.5'> - <InputOneEquationUI id="strategyInactivity" constructorParams='this' - text='isisfish.strategy.inactivity' - bean='{getBean()}' formuleCategory='Inactivity' beanProperty='InactivityEquation' - clazz='{fr.ifremer.isisfish.equation.StrategyInactivityEquation.class}' - decorator='boxed' _bean='{StrategyImpl.class}' _method='"Inactivity"'/> <!-- bindings not work well actif='{getBean().getInactivityEquationUsed()}' --> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.5'> - <JScrollPane> - <JTextArea id="fieldStrategyComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell anchor='west'> + <JLabel text="isisfish.strategy.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldStrategyName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldStrategyName.getText())' enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text="isisfish.common.setOfVessels" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <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().getInactivityEquationUsed()}' + 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.getInactivityEquationUsed()}" + 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().getInactivityEquationUsed()}' --> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text="isisfish.strategy.comments" enabled='{isActive()}'/> + </cell> + <cell fill='both' weightx='1.0' weighty='0.5'> + <JScrollPane> + <JTextArea id="fieldStrategyComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActive()}' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='1.0'> + <Table> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + 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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,31 +22,35 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Strategy'> + + <fr.ifremer.isisfish.entities.Strategy id='bean' javaBean='null'/> + <script><![CDATA[ - at Override -public void refresh() { - +protected void $afterCompleteSetup() { // install change listener // (depends on sensitivity can't be done on constructor) installChangeListener(strategyTab); - - getVerifier().addCurrentPanel(strategyMonthInfoUI, strategyTabUI); } +/*public void refresh() { + getSaveVerifier().addCurrentPanel(strategyMonthInfoUI, strategyTabUI); +}*/ + @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(strategyTab); +public void setLayer(boolean active) { + super.setLayer(active); + strategyTabUI.setLayer(active); + strategyMonthInfoUI.setLayer(active); } ]]></script> - <JPanel layout='{new BorderLayout()}'> - <JTabbedPane id="strategyTab" constraints='BorderLayout.CENTER'> + <JPanel id="body"> + <JTabbedPane id="strategyTab"> <tab title='isisfish.strategy.title'> - <StrategyTabUI id='strategyTabUI' constructorParams='this'/> + <StrategyTabUI id='strategyTabUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> <tab title='isisfish.strategyMonthInfo.title'> - <StrategyMonthInfoUI id='strategyMonthInfoUI' constructorParams='this'/> + <StrategyMonthInfoUI id='strategyMonthInfoUI' bean="{getBean()}" active="{isActive()}" constructorParams='this'/> </tab> </JTabbedPane> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,125 +22,139 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='TripType'> <!-- bean property --> - <fr.ifremer.isisfish.entities.TripTypeImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.TripType id='bean' javaBean='null'/> + <import> + 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[ -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.TripTypeImpl; -import fr.ifremer.isisfish.types.TimeUnit; +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueVesselTypes")); + setNextPath(n_("isisfish.input.tree.vesseltypes")); -setButtonTitle(_("isisfish.input.continueVesselTypes")); -setNextPath("$root/$vesselTypes"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - fieldTripTypeName.setText(""); - fieldTripTypeDuration.setText(""); - fieldTripTypeMinTimeBetweenTrip.setText(""); - fieldTripTypeComment.setText(""); + 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) { + + } } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); + }); +} - at Override -public void refresh() { - TripType tripType = (TripType)getVerifier().getEntity(TripType.class); +/*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((TripTypeImpl) tripType); -} - - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "TripType"); - getVerifier().setDeleteButton(delete); -} + setBean(tripType); +}*/ ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell> - <JLabel text="isisfish.tripType.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeName" text='{getBean().getName()}' - onKeyReleased='getBean().setName(fieldTripTypeName.getText())' - enabled='{isActif()}' decorator='boxed'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.duration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeDuration" text='{getBean().getTripDuration().getHour()}' toolTipText="isisfish.common.duration.inhours" - onKeyReleased='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' - enabled='{isActif()}' decorator='boxed' _bean='{TripTypeImpl.class}' _method='"TripDuration"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.minTime" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='{getBean().getMinTimeBetweenTrip().getHour()}' - onKeyReleased='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' - enabled='{isActif()}' decorator='boxed' _bean='{TripTypeImpl.class}' _method='"MinTimeBetweenTrip"'/> - </cell> - </row> - <row> - <cell> - <JLabel text="isisfish.tripType.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JScrollPane> - <JTextArea id="fieldTripTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell> + <JLabel text="isisfish.tripType.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldTripTypeName" text='{getBean().getName()}' + onKeyReleased='getBean().setName(fieldTripTypeName.getText())' + enabled='{isActive()}' decorator='boxed'/> + </cell> + </row> + <row> + <cell> + <JLabel text="isisfish.tripType.duration" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldTripTypeDuration" text='{String.valueOf(getBean().getTripDuration().getHour())}' toolTipText="isisfish.common.duration.inhours" + onKeyReleased='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' + enabled='{isActive()}' decorator='boxed' _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: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,229 +22,255 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='VesselType'> <!-- bean property --> - <fr.ifremer.isisfish.entities.VesselTypeImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.VesselType id='bean' javaBean='null'/> + <import> + 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 + jaxx.runtime.swing.editor.NumberEditor + 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[ -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.VesselTypeImpl; -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.types.TimeUnit; -import fr.ifremer.isisfish.ui.input.triptype.TripTypeListModel; -import jaxx.runtime.swing.editor.NumberEditor; +protected boolean init; +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continueSetOfVessels")); + setNextPath(n_("isisfish.input.tree.setofvessels")); -setButtonTitle(_("isisfish.input.continueSetOfVessels")); -setNextPath("$root/$setOfVessels"); -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldVesselTypeName.setText(""); - fieldVesselTypeLength.setText(""); - fieldVesselTypeSpeed.setText(""); - fieldVesselTypeMaxTripDuration.setText(""); - fieldVesselTypeActivityRange.setText(""); - fieldVesselTypeMinCrewSize.setText(""); - fieldVesselTypeSpeed.setText(""); - fieldVesselTypeUnitFuelCostOfTravel.setText(""); - fieldVesselTypeComment.setText(""); + 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(); + } } - if (evt.getNewValue() != null) { - } - } -}); + }); +} - at Override -public void refresh() { - VesselType vesselType = getVerifier().getEntity(VesselType.class); +/*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((VesselTypeImpl) vesselType); + setBean(vesselType); if (getBean() != null) { setListModel(); - /* NumberEditor is not working - fieldVesselTypeLength.init(); - fieldVesselTypeLength.init(); - fieldVesselTypeSpeed.init(); - fieldVesselTypeActivityRange.init(); - fieldVesselTypeMinCrewSize.init(); - fieldVesselTypeSpeed.init(); - fieldVesselTypeUnitFuelCostOfTravel.init(); */ + // NumberEditor is not working + //fieldVesselTypeLength.init(); + //fieldVesselTypeLength.init(); + //fieldVesselTypeSpeed.init(); + //fieldVesselTypeActivityRange.init(); + //fieldVesselTypeMinCrewSize.init(); + //fieldVesselTypeSpeed.init(); + //fieldVesselTypeUnitFuelCostOfTravel.init(); } -} +}*/ - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "VesselType"); - getVerifier().setDeleteButton(delete); -} - -protected void setListModel() { - java.util.List<TripType> tripTypes = getRegion().getTripType(); +protected void setTripTypeListModel() { + init = true; + List<TripType> tripTypes = getFisheryRegion().getTripType(); TripTypeListModel tripTypeModel = new TripTypeListModel(tripTypes); vesselTypeTripType.setModel(tripTypeModel); if (getBean() != null && getBean().getTripType() != null) { - vesselTypeTripType.setSelectedValues(getBean().getTripType().toArray()); + for (TripType tripType : getBean().getTripType()) { + int index = tripTypes.indexOf(tripType); + vesselTypeTripType.addSelectionInterval(index, index); + } } + init = false; } -protected void tripTypeChanged(){ - java.util.List<TripType> tripTypes = new java.util.ArrayList<TripType>(); - for (Object o : vesselTypeTripType.getSelectedValues()) { - tripTypes.add((TripType)o); +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); } - getBean().setTripType(tripTypes); } ]]></script> - <Table id='body' constraints='BorderLayout.CENTER'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <Table> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.name" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldVesselTypeName" text='{getBean().getName()}' enabled='{isActif()}' - onKeyReleased='getBean().setName(fieldVesselTypeName.getText())' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.length" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeLength' constructorParams='this' - bean='{getBean()}' property='length' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"Length"'/--> - <JTextField id="fieldVesselTypeLength" text='{getBean().getLength()}' enabled='{isActif()}' - onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"Length"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.speed" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeSpeed' constructorParams='this' - bean='{getBean()}' property='speed' useSign='true' - enabled='{isActif()}' decorator='boxed' - _bean='{VesselTypeImpl.class}' _method='"Speed"'/--> - <JTextField id="fieldVesselTypeSpeed" text='{getBean().getSpeed()}' enabled='{isActif()}' - onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"Speed"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.maxDuration" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <JTextField id="fieldVesselTypeMaxTripDuration" text='{getBean().getMaxTripDuration().getHour()}' toolTipText="isisfish.common.duration.inhours" - enabled='{isActif()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText()) * 3600))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"MaxTripDuration"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.activityRange" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeActivityRange' constructorParams='this' - bean='{getBean()}' property='activityRange' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"ActivityRange"'/--> - <JTextField id="fieldVesselTypeActivityRange" text='{getBean().getActivityRange()}' enabled='{isActif()}' - onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"ActivityRange"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.miniCrew" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeMinCrewSize' constructorParams='this' - bean='{getBean()}' property='minCrewSize' useSign='true' - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' - _method='"MinCrewSize"'/--> - <JTextField id="fieldVesselTypeMinCrewSize" text='{getBean().getMinCrewSize()}' enabled='{isActif()}' - onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))' - decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"MinCrewSize"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.fuelCost" enabled='{isActif()}'/> - </cell> - <cell fill='horizontal' weightx='1.0'> - <!--NumberEditor id='fieldVesselTypeUnitFuelCostOfTravel' constructorParams='this' - bean='{getBean()}' property='unitFuelCostOfTravel' - enabled='{isActif()}' decorator='boxed' useSign='true' - _bean='{VesselTypeImpl.class}' _method='"UnitFuelCostOfTravel"'/--> - <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{getBean().getUnitFuelCostOfTravel()}' - onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"UnitFuelCostOfTravel"'/> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.tripType" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.7'> - <JScrollPane> - <JList id="vesselTypeTripType" selectedValues='{getBean().getTripType() == null ? null : getBean().getTripType().toArray()}' - onMouseClicked='tripTypeChanged()' - cellRenderer="{new fr.ifremer.isisfish.ui.input.triptype.TripTypeListRenderer()}" - enabled='{isActif()}' decorator='boxed' _bean='{VesselTypeImpl.class}' _method='"TripType"'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.vesselType.comments" enabled='{isActif()}'/> - </cell> - <cell fill='both' weightx='1.0' weighty='0.3'> - <JScrollPane> - <JTextArea id="fieldVesselTypeComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - onKeyReleased='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActif()}' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell fill='both' weightx='1.0'> - <Table> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <JPanel id="body"> + <Table> + <row> + <cell fill='both' weightx='1.0' weighty='1.0'> + <Table> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.name" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <JTextField id="fieldVesselTypeName" text='{getBean().getName()}' enabled='{isActive()}' + onKeyReleased='getBean().setName(fieldVesselTypeName.getText())' decorator='boxed'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor='east'> + <JLabel text="isisfish.vesselType.length" enabled='{isActive()}'/> + </cell> + <cell fill='horizontal' weightx='1.0'> + <!--NumberEditor id='fieldVesselTypeLength' constructorParams='this' + bean='{getBean()}' property='length' + enabled='{isActive()}' decorator='boxed' useSign='true' + _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> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,16 +23,19 @@ #L% --> <JPanel id="wizardGroup" layout='{new BorderLayout()}'> - <script> - <![CDATA[ + <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> - import org.nuiton.topia.TopiaContext; - import fr.ifremer.isisfish.IsisFishDAOHelper; - import fr.ifremer.isisfish.entities.Equation; - import fr.ifremer.isisfish.entities.Population; - import fr.ifremer.isisfish.entities.PopulationGroup; - import fr.ifremer.isisfish.entities.PopulationGroupDAO; - + <script><![CDATA[ + protected String current = null; protected boolean ageType = false; protected boolean inputType = false; @@ -49,8 +52,8 @@ protected double step = 1; protected PopulationBasicsUI popBasic; - public void init(PopulationBasicsUI p){ - popBasic = p; + public void init(PopulationBasicsUI popBasic) { + this.popBasic = popBasic; } /** @@ -227,26 +230,25 @@ } try { - Population pop = (Population)getContextValue(InputSaveVerifier.class).getEntity(Population.class); + Population pop = popBasic.getBean(); // remove maturity group pop.setMaturityGroup(null); - // remove all old group - TopiaContext isisContext = pop.getTopiaContext(); pop.clearPopulationGroup(); - PopulationGroupDAO dao = IsisFishDAOHelper.getPopulationGroupDAO(isisContext); + 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 = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(id); group.setPopulation(pop); group.setAge(ageFirst + id); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); } } else if (isInputType()) { double minLength = getFirst(); @@ -254,13 +256,13 @@ for(int i=0; i<values.length; i++){ if (!"".equals(values[i])) { double length = Double.parseDouble(values[i]); - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(minLength); group.setMaxLength(length); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); minLength = length; } } @@ -279,13 +281,13 @@ double maxLength = minLength; for(int i=0; i<numberOfGroup; i++){ maxLength = minLength + step; - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(minLength); group.setMaxLength(maxLength); pop.addPopulationGroup(group); - group.update(); + populationGroupDAO.update(group); minLength = maxLength; } } else if (isGrowthCurveType()) { @@ -301,7 +303,7 @@ double Lmin = minLength; for(int i=0; i<numberOfGroup; i++){ // on creer la classe avec une valeur Lmax fausses ... - PopulationGroup group = dao.create(); + PopulationGroup group = populationGroupDAO.create(); group.setId(i); group.setPopulation(pop); group.setMinLength(Lmin); @@ -452,7 +454,7 @@ </cell> </row> </Table> - <Table constraints='"endInputGroupLength"'> + <Table constraints='"endInputGroupLength"'> <row> <cell columns='2' fill='horizontal' weightx='1.0'> <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> @@ -464,7 +466,7 @@ </cell> <cell fill='horizontal' weightx='1.0'> <JTextField id="firstInputLength" onFocusLost='firstInputLengthChanged()'/> - </cell> + </cell> </row> <row> <cell> @@ -472,7 +474,7 @@ </cell> <cell fill='horizontal' weightx='1.0'> <JTextField id="maximalGroupsLength" onFocusLost='maximalGroupsLengthChanged()'/> - </cell> + </cell> </row> <row> <cell columns='2' fill='horizontal' weightx='1.0'> @@ -526,7 +528,7 @@ </cell> </row> </Table> - <Table constraints='"endGrowthCurveGroupLength"'> + <Table constraints='"endGrowthCurveGroupLength"'> <row> <cell columns='2' fill='horizontal' weightx='1.0'> <JLabel text="isisfish.wizardGroupCreation.populationCharacteristics" horizontalAlignment="CENTER"/> @@ -561,7 +563,7 @@ <JLabel text="isisfish.wizardGroupCreation.undefinedGrowthEquation"/> </cell> </row> - </Table> + </Table> </JPanel> <Table id="navButton" constraints='BorderLayout.SOUTH'> <row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -22,109 +22,92 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> <!-- bean property --> - <fr.ifremer.isisfish.entities.ZoneImpl id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> - <script><![CDATA[ -import javax.swing.event.ListSelectionEvent; -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.entities.ZoneImpl; -import fr.ifremer.isisfish.map.CellSelectionLayer; -import fr.ifremer.isisfish.map.CopyMapToClipboardListener; -import com.bbn.openmap.event.SelectMouseMode; -import com.bbn.openmap.gui.Tool; -import com.bbn.openmap.gui.OMToolSet; + <import> + static org.nuiton.i18n.I18n.n_ + 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.ui.input.model.TopiaEntityListModel + com.bbn.openmap.event.SelectMouseMode + com.bbn.openmap.gui.Tool + com.bbn.openmap.gui.OMToolSet + 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 OMToolSet toolSet = new OMToolSet(); -protected OpenMapEvents mapListener = null; -toolSet.setupListeners(zoneMap); -toolMap.add((Tool)toolSet); +protected void $afterCompleteSetup() { + setButtonTitle(_("isisfish.input.continuePorts")); + setNextPath(n_("isisfish.input.tree.ports")); -// add copy to clipboard support -zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); + toolSet.setupListeners(zoneMap); + toolMap.add((Tool)toolSet); -zoneMap.addMapMouseListener(getMapListener()); -setButtonTitle(_("isisfish.input.continuePorts")); -setNextPath("$root/$ports"); - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("bean changed " + evt.getOldValue() + " : " + evt.getNewValue()); + // add copy to clipboard support + zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); + new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + boolean result = false; + if (getBean() != null) { // impossible de desactiver la carte :( + getBean().setCell(zoneMap.getSelectedCells()); + setZoneCells(); + } + return result; } - if (evt.getOldValue() != null || evt.getNewValue() == null) { - fieldZoneName.setText(""); - fieldZoneComment.setText(""); - zoneMap.setSelectedCells((Cell)null); - } - if (evt.getNewValue() != null) { + }; + 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(); + } } - } -}); - - at Override -public void refresh() { - Zone zone = getVerifier().getEntity(Zone.class); - - // add null before, for second to be considered as a changed event - // otherwize, setBean has no effect - setBean(null); - setBean((ZoneImpl) zone); - - // reload region in map - refreshRegionInMap(zoneMap); - - if (getBean() != null) { - setZoneCells(); - zoneMap.setSelectedCells(getBean().getCell()); - } + }); } - at Override -public void setActionButtons() { - getVerifier().setSaveButton(save); - getVerifier().setCancelButton(cancel); - getVerifier().setNewButton(create, "Zone"); - getVerifier().setDeleteButton(remove); -} - -protected void setZoneCells(){ - if (getBean() != null){ - DefaultListModel model = new DefaultListModel(); - for (Cell c : getRegion().getCell()) - model.addElement(c); +protected void setZoneCells() { + if (getBean() != null) { + List<Cell> cells = getFisheryRegion().getCell(); + TopiaEntityListModel model = new TopiaEntityListModel(cells); zoneCells.setModel(model); - if (getBean().getCell() != null){ - zoneCells.setSelectedValues(getBean().getCell().toArray()); + if (getBean().getCell() != null) { + for (Cell selectedCell : getBean().getCell()) { + int index = cells.indexOf(selectedCell); + zoneCells.addSelectionInterval(index, index); + } } } } -protected OpenMapEvents getMapListener() { - if (mapListener == null) { - mapListener = new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - getBean().setCell(zoneMap.getSelectedCells()); - if (getBean().getCell() != null){ - zoneCells.setSelectedValues(getBean().getCell().toArray()); - } - return true; - } - }; - } - return mapListener; -} protected void zoneCellsChange(ListSelectionEvent event) { // sans ca, ca boucle (modification depuis la carte) if (event.getValueIsAdjusting()) { // pas a faie dans le cas d'une AS - if (isActif()) { + if (isActive()) { java.util.List<Cell> cells = new ArrayList<Cell>(); for (Object o : zoneCells.getSelectedValues()) { cells.add((Cell) o); @@ -132,95 +115,94 @@ getBean().setCell(cells); } } - else { - if (log.isDebugEnabled()) { - log.debug("Duplicated event skipped"); - } - } } ]]> </script> - <Table id='body'> - <row> - <cell fill='both' weightx='1.0' weighty='1.0'> - <JSplitPane id="ZoneTab" name="Zones" - oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.name"/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldZoneName" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' - enabled='{isActif()}' decorator='boxed' - onKeyReleased='getBean().setName(fieldZoneName.getText())'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.cells"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> - <JScrollPane> - <!-- FIXME le binding genere un tas d'envenement multiples ! --> - <JList id="zoneCells" enabled='{isActif()}' selectedValues='{getBean().getCell() == null ? null : getBean().getCell().toArray()}' - onValueChanged='zoneCellsChange(event)' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActif()}' text="isisfish.zone.comments"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.3' weightx='1.0'> - <JScrollPane> - <JTextArea id="fieldZoneComment" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - enabled='{isActif()}' - decorator='boxed' - onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' - javaBean='new com.bbn.openmap.gui.ToolPanel()' - decorator='boxed' - constraints='BorderLayout.NORTH'/> - <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' - javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' - selectionMode="2" - fisheryRegion='{getRegion()}' - selectedCells='{getBean().getCell()}' - decorator='boxed' - constraints='BorderLayout.CENTER'/> - </JPanel> - </JSplitPane> - </cell> - </row> - </Table> + <JPanel id='body'> + <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.name"/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldZoneName" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' + enabled='{isActive()}' decorator='boxed' + onKeyReleased='getBean().setName(fieldZoneName.getText())'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> + <JScrollPane 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()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' + javaBean='new com.bbn.openmap.gui.ToolPanel()' + decorator='boxed' constraints='BorderLayout.NORTH'/> + <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" + fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}' + decorator='boxed' constraints='BorderLayout.CENTER'/> + <!-- FIXME echatellier 20110429 : binding --> + </JPanel> + </JSplitPane> + </JPanel> </fr.ifremer.isisfish.ui.input.InputContentUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckRegion.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckRegion.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckRegion.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -33,6 +33,8 @@ import java.util.List; import java.util.Set; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; import org.nuiton.math.matrix.MatrixIterator; import org.nuiton.math.matrix.MatrixND; @@ -107,62 +109,56 @@ static public void check(PopulationGroup classPop, CheckResult result){ // error - if(classPop.getMeanWeight() < 0){ + if (classPop.getMeanWeight() < 0) { result.addError(classPop, _("isisfish.error.invalid.mean.weight")); } - // if(classPop.getMortaliteNaturelle() < 0){ - // result.addError(classPop, _("isisfish.error.invalidate.natural.death")); - // } // warning - if(classPop.getMeanWeight() == 0){ + if (classPop.getMeanWeight() == 0) { result.addWarning(classPop, _("isisfish.error.not.null.mean.weight")); } - // if(classPop.getMortaliteNaturelle() == 0){ - // result.addWarning(classPop, _("isisfish.error.not.null.natural.death")); - // } } - static public void check(Gear engin, CheckResult result){ - if("".equals(engin.getName())){ + static public void check(Gear engin, CheckResult result) { + if (StringUtils.isBlank(engin.getName())) { result.addWarning(engin, _("isisfish.error.empty.name")); } - if("".equals(engin.getEffortUnit())){ + if (StringUtils.isBlank(engin.getEffortUnit())) { result.addWarning(engin, _("isisfish.error.empty.unit")); } Collection<Selectivity> selectivites = engin.getPopulationSelectivity(); - if(selectivites.size() == 0){ + if (CollectionUtils.isEmpty(selectivites)) { result.addWarning(engin, _("isisfish.error.empty.selectivity")); - }else{ - for(Selectivity selectivity : selectivites){ + } else { + for (Selectivity selectivity : selectivites) { check(selectivity, result); } } - if(engin.getPossibleValue() == null){ + if (engin.getPossibleValue() == null) { result.addWarning(engin, _("isisfish.error.invalid.range")); } - if("".equals(engin.getParameterName())){ + if (StringUtils.isBlank(engin.getParameterName())) { result.addInfo(engin, _("isisfish.error.empty.params.name")); } } static public void check(MetierSeasonInfo infoSaisonMetier, CheckResult result){ - if(infoSaisonMetier.getZone() == null || infoSaisonMetier.getZone().size() == 0){ + if (CollectionUtils.isEmpty(infoSaisonMetier.getZone())) { result.addWarning(infoSaisonMetier, _("isisfish.error.no.sector")); } Collection<TargetSpecies> especeCaptus = infoSaisonMetier.getSpeciesTargetSpecies(); - if(especeCaptus.size() == 0){ + if (CollectionUtils.isEmpty(especeCaptus)) { result.addInfo(infoSaisonMetier, _("isisfish.error.empty.species")); - }else{ - for(TargetSpecies i : especeCaptus){ + } else { + for (TargetSpecies i : especeCaptus) { check(i, result); } } } - static public boolean isEmptyMatrix(MatrixND mat) { + static public boolean isEmptyMatrix(Object entity, MatrixND mat) { boolean result = true; for (MatrixIterator i = mat.iterator(); result && i.next();) { result = false; @@ -199,75 +195,87 @@ static public void check(PopulationSeasonInfo infoSaisonPop, CheckResult result){ if (infoSaisonPop.getUseEquationMigration()) { check(infoSaisonPop, "MigrationEquation", infoSaisonPop.getMigrationEquation(), result); - check(infoSaisonPop, "Emigration", infoSaisonPop.getEmigrationEquation(), result); + check(infoSaisonPop, "EmigrationEquation", infoSaisonPop.getEmigrationEquation(), result); check(infoSaisonPop, "ImmigrationEquation", infoSaisonPop.getImmigrationEquation(), result); } else { - - // FIXME chatellier 20110221 NPE in getMigrationMatrix() - // with null zones or populations - if (isEmptyMatrix(infoSaisonPop.getMigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.migration")); - } else if(isNullMatrix(infoSaisonPop.getMigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.migration")); - } else if(isNegativeMatrix(infoSaisonPop.getMigrationMatrix())) { - result.addError(infoSaisonPop, _("isisfish.error.migration.negative")); + + try { + if (isEmptyMatrix(infoSaisonPop, infoSaisonPop.getMigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.migration")); + } else if(isNullMatrix(infoSaisonPop.getMigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.migration")); + } else if(isNegativeMatrix(infoSaisonPop.getMigrationMatrix())) { + result.addError(infoSaisonPop, _("isisfish.error.migration.negative")); + } } + catch (NullPointerException e) { + result.addError(infoSaisonPop, _("isisfish.error.null.semantics", "MigrationEquation")); + } - - if (isEmptyMatrix(infoSaisonPop.getEmigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.emigration")); - } else if(isNullMatrix(infoSaisonPop.getEmigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.emigration")); - } else if(isNegativeMatrix(infoSaisonPop.getEmigrationMatrix())) { - result.addError(infoSaisonPop, _("isisfish.error.emigration.negative")); + try { + if (isEmptyMatrix(infoSaisonPop, infoSaisonPop.getEmigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.emigration")); + } else if(isNullMatrix(infoSaisonPop.getEmigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.emigration")); + } else if(isNegativeMatrix(infoSaisonPop.getEmigrationMatrix())) { + result.addError(infoSaisonPop, _("isisfish.error.emigration.negative")); + } } + catch (NullPointerException e) { + result.addError(infoSaisonPop, _("isisfish.error.null.semantics", "EmigrationEquation")); + } - if (isEmptyMatrix(infoSaisonPop.getImmigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.immigration")); - } else if(isNullMatrix(infoSaisonPop.getImmigrationMatrix())) { - result.addInfo(infoSaisonPop, _("isisfish.error.empty.immigration")); - } else if(isNegativeMatrix(infoSaisonPop.getImmigrationMatrix())) { - result.addError(infoSaisonPop, _("isisfish.error.immigration.negative")); + try { + if (isEmptyMatrix(infoSaisonPop, infoSaisonPop.getImmigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.immigration")); + } else if(isNullMatrix(infoSaisonPop.getImmigrationMatrix())) { + result.addInfo(infoSaisonPop, _("isisfish.error.empty.immigration")); + } else if(isNegativeMatrix(infoSaisonPop.getImmigrationMatrix())) { + result.addError(infoSaisonPop, _("isisfish.error.immigration.negative")); + } } + catch (NullPointerException e) { + result.addError(infoSaisonPop, _("isisfish.error.null.semantics", "ImmigrationEquation")); + } } } - static public void check(Cell maille, CheckResult result){ - if("".equals(maille.getName())){ + static public void check(Cell maille, CheckResult result) { + if (StringUtils.isBlank(maille.getName())) { result.addWarning(maille, _("isisfish.error.empty.name")); } } static public void check(Species metaPop, CheckResult result){ Collection<Population> pops = metaPop.getPopulation(); - if(pops.size() == 0){ + if (CollectionUtils.isEmpty(pops)) { result.addWarning(metaPop, _("isisfish.error.empty.population")); - }else{ - for(Population pop : pops){ + } else { + for (Population pop : pops) { check(pop, result); } } - if("".equals(metaPop.getName())){ + if (StringUtils.isBlank(metaPop.getName())) { result.addInfo(metaPop, _("isisfish.error.empty.species.name")); } - if("".equals(metaPop.getScientificName())){ + if (StringUtils.isBlank(metaPop.getScientificName())) { result.addInfo(metaPop, _("isisfish.error.empty.scientific.name")); } - if("".equals(metaPop.getCodeRubbin())){ + if (StringUtils.isBlank(metaPop.getCodeRubbin())) { result.addInfo(metaPop, _("isisfish.error.empty.code.rubbin")); } } static public void check(Metier metier, CheckResult result){ - if("".equals(metier.getName())){ + if (StringUtils.isBlank(metier.getName())) { result.addWarning(metier, _("isisfish.error.empty.name")); } List<MetierSeasonInfo> infoSaisons = metier.getMetierSeasonInfo(); - if(infoSaisons.size() == 0){ + if (CollectionUtils.isEmpty(infoSaisons)) { result.addWarning(metier, _("isisfish.error.empty.season")); - }else{ + } else { Set<Month> months = new HashSet<Month>(); - for(MetierSeasonInfo info : infoSaisons){ + for (MetierSeasonInfo info : infoSaisons) { if (!Collections.disjoint(months, info.getMonths())) { result.addError(info, _("isisfish.error.overlap.season")); } @@ -275,71 +283,64 @@ check(info, result); } } - if(metier.getGear() == null){ + if (metier.getGear() == null) { result.addError(metier, _("isisfish.error.undefined.gear")); - }else{ + } else { check(metier.getGear(), result); - } - - try { - if (!metier.getGear().getPossibleValue().contains(metier.getGearParameterValue())) { + + try { + if (!metier.getGear().getPossibleValue().contains(metier.getGearParameterValue())) { + result.addWarning(metier, _("isisfish.error.invalid.values.params")); + } + } catch(Exception e) { + // can't happen StringIndexOutOfBoundsException + // if gear.PossibleValue if not valid result.addWarning(metier, _("isisfish.error.invalid.values.params")); } - } catch(Exception e) { - // can't happen StringIndexOutOfBoundsException - // if gear.PossibleValue if not valid - result.addWarning(metier, _("isisfish.error.invalid.values.params")); } - } static public void check(Population pop, CheckResult result){ - if("".equals(pop.getName())){ + if (StringUtils.isBlank(pop.getName())) { result.addWarning(pop, _("isisfish.error.empty.name")); } - if("".equals(pop.getGeographicId())){ + if (StringUtils.isBlank(pop.getGeographicId())) { result.addInfo(pop, _("isisfish.error.empty.id.geographic")); } - if(pop.getMaturityGroup() == null){ + if (pop.getMaturityGroup() == null) { result.addInfo(pop, _("isisfish.error.not.null.class.grown")); } check(pop, "Growth", pop.getGrowth(), result); check(pop, "GrowthReverse", pop.getGrowthReverse(), result); List<PopulationGroup> classes = pop.getPopulationGroup(); - if(classes.size() == 0){ + if (CollectionUtils.isEmpty(classes)) { result.addWarning(pop, _("isisfish.error.undefined.classes")); - }else{ - for(PopulationGroup group : classes){ + } else { + for (PopulationGroup group : classes) { check(group, result); } } - // if(pop.getMortNatClasseNaissance() == 0){ - // result.addInfo(pop, _("isisfish.error.undefined.natural.death")); - // } - // if(pop.getMortNatClasseNaissance() < 0){ - // result.addWarning(pop, _("isisfish.error.invalid.natural.death")); - // } - if(pop.getMonthGapBetweenReproRecrutement() < 0){ + if (pop.getMonthGapBetweenReproRecrutement() < 0) { result.addWarning(pop, _("isisfish.error.invalid.interval.reproduction.recruitment")); } if (isNullMatrix(pop.getMappingZoneReproZoneRecru())) { result.addWarning(pop, _("isisfish.error.undefined.correspondence.zones.reproduction.recruitment")); } - if(pop.getPopulationZone() == null || pop.getPopulationZone().size() == 0){ + if (CollectionUtils.isEmpty(pop.getPopulationZone())) { result.addWarning(pop, _("isisfish.error.undefined.zone.population")); } - if(pop.getRecruitmentZone() == null || pop.getRecruitmentZone().size() == 0){ + if (CollectionUtils.isEmpty(pop.getRecruitmentZone())) { result.addWarning(pop, _("isisfish.error.undefined.zone.recruitment")); } - if(pop.getReproductionZone() == null || pop.getReproductionZone().size() == 0){ + if (CollectionUtils.isEmpty(pop.getReproductionZone())) { result.addWarning(pop, _("isisfish.error.undefined.zone.reproduction")); } List<PopulationSeasonInfo> infoSaisons = pop.getPopulationSeasonInfo(); - if(infoSaisons.size() == 0){ + if (CollectionUtils.isEmpty(infoSaisons)) { result.addWarning(pop, _("isisfish.error.empty.season")); - }else{ + } else { Set<Month> months = new HashSet<Month>(); - for(PopulationSeasonInfo info : infoSaisons){ + for (PopulationSeasonInfo info : infoSaisons) { if (!Collections.disjoint(months, info.getMonths())) { result.addError(info, _("isisfish.error.overlap.season")); } @@ -352,64 +353,63 @@ check(pop, "ReproductionEquation", pop.getReproductionEquation(), result); check(pop, "NaturalDeathRate", pop.getNaturalDeathRate(), result); - // FIXME chatellier 20110221 NPE pop.getRecruitmentDistribution() - if (sumMatrix(pop.getRecruitmentDistribution()) != 1) { + if (pop.getRecruitmentDistribution() == null || sumMatrix(pop.getRecruitmentDistribution()) != 1) { result.addWarning(pop, _("isisfish.error.invalid.distribution.recruitment")); } } static public void check(FisheryRegion region, CheckResult result){ - if("".equals(region.getName())){ + if (StringUtils.isBlank(region.getName())) { result.addWarning(region, _("isisfish.error.empty.name")); } List<Zone> secteurs = region.getZone(); - if(secteurs.size() == 0){ + if (CollectionUtils.isEmpty(secteurs)) { result.addWarning(region, _("isisfish.error.undefined.sector")); - }else{ - for(Zone zone : secteurs){ + } else { + for(Zone zone : secteurs) { check(zone, result); } } List<Cell> mailles = region.getCell(); - if(mailles.size() == 0){ + if (CollectionUtils.isEmpty(mailles)) { result.addWarning(region, _("isisfish.error.undefined.mesh")); - }else{ - for(Cell cell : mailles){ + } else { + for (Cell cell : mailles) { check(cell, result); } } List<Species> metaPops = region.getSpecies(); - if(metaPops.size() == 0){ + if (CollectionUtils.isEmpty(metaPops)) { result.addWarning(region, _("isisfish.error.undefined.meta.population")); - }else{ - for(Species species : metaPops){ + } else { + for (Species species : metaPops) { check(species, result); } } List<Metier> metiers = region.getMetier(); - if(metiers.size() == 0){ + if (CollectionUtils.isEmpty(metiers)) { result.addWarning(region, _("isisfish.error.undefined.meta.population")); - }else{ - for(Metier metier : metiers){ + } else { + for (Metier metier : metiers) { check(metier, result); } } List<Strategy> strategies = region.getStrategy(); - if(strategies.size() == 0){ + if (CollectionUtils.isEmpty(strategies)){ result.addWarning(region, _("isisfish.error.undefined.stategy")); - }else{ - for(Strategy strategy : strategies){ + } else { + for (Strategy strategy : strategies) { check(strategy, result); } } } static public void check(Zone secteur, CheckResult result){ - if("".equals(secteur.getName())){ + if (StringUtils.isBlank(secteur.getName())) { result.addWarning(secteur, _("isisfish.error.empty.name")); } - if(secteur.getCell().size() == 0){ + if (CollectionUtils.isEmpty(secteur.getCell())) { result.addWarning(secteur, _("isisfish.error.undefined.mesh.sector")); } } @@ -419,17 +419,17 @@ } - static public void check(Strategy strategy, CheckResult result){ - if("".equals(strategy.getName())){ + static public void check(Strategy strategy, CheckResult result) { + if (StringUtils.isBlank(strategy.getName())) { result.addWarning(strategy, _("isisfish.error.empty.name")); } check(strategy.getSetOfVessels(), result); List<StrategyMonthInfo> smi = strategy.getStrategyMonthInfo(); - if(smi.size() != 12){ + if (smi == null || smi.size() != 12) { result.addWarning(strategy, _("isisfish.error.undefined.stategy.months")); - }else{ - for(StrategyMonthInfo info : smi){ + } else { + for (StrategyMonthInfo info : smi) { check(info, result); } } @@ -438,22 +438,22 @@ static public void check(SetOfVessels sov, CheckResult result){ check(sov.getPort(), result); - if(sov.getNumberOfVessels() < 0){ + if (sov.getNumberOfVessels() < 0) { result.addWarning(sov, _("isisfish.error.invalid.number")); } - if(sov.getFixedCosts() < 0){ + if (sov.getFixedCosts() < 0) { result.addWarning(sov, _("isisfish.error.invalid.costs.fix")); } Collection<EffortDescription> efforts = sov.getPossibleMetiers(); - if(efforts.size() == 0){ + if (CollectionUtils.isEmpty(efforts)) { result.addWarning(sov, _("isisfish.error.not.possible.metier")); - }else{ - for(EffortDescription effort : efforts) { + } else { + for (EffortDescription effort : efforts) { check(effort, result); } } } - + // TODO check for VesselType, TripType, Port, StrategyMonthInfo static public void check(EffortDescription effort, CheckResult result){ @@ -468,7 +468,12 @@ } static public void check(Port port, CheckResult result){ - + if (StringUtils.isBlank(port.getName())) { + result.addWarning(port, _("isisfish.error.empty.name")); + } + if (port.getCell() == null) { + result.addWarning(port, _("isisfish.error.undefined.mesh.sector")); + } } } // CheckSaisie Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResult.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResult.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResult.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,10 +25,13 @@ package fr.ifremer.isisfish.ui.input.check; +import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashSet; -import java.util.Iterator; -import java.util.HashMap; import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Classe permettant de créer le résultat d'une vérification de la bonne saisie des objets. @@ -44,60 +47,62 @@ */ public class CheckResult { // CheckResult - LinkedHashSet order = new LinkedHashSet(); + protected Set<Object> order = new LinkedHashSet<Object>(); - HashMap info = new HashMap(); - HashMap warning = new HashMap(); - HashMap error = new HashMap(); + protected Map<Object, List<String>> info = new HashMap<Object, List<String>>(); + protected Map<Object, List<String>> warning = new HashMap<Object, List<String>>(); + protected Map<Object, List<String>> error = new HashMap<Object, List<String>>(); public StringBuffer getInfo() { StringBuffer result = new StringBuffer(); - for(Iterator i=order.iterator(); i.hasNext();){ + for (Iterator i = order.iterator(); i.hasNext();) { Object o = i.next(); StringBuffer tmp = getInfo(o); - if(tmp.length() != 0){ + if (tmp.length() != 0) { String title = o.toString(); tmp.insert(0, "\n"); - for(int e=0; e<title.length(); e++){ + for (int e = 0; e < title.length(); e++) { tmp.insert(0, "="); } - tmp.insert(0, title+"\n"); + tmp.insert(0, title + "\n"); tmp.append("\n"); result.append(tmp.toString()); } } return result; } + public StringBuffer getWarning() { StringBuffer result = new StringBuffer(); - for(Iterator i=order.iterator(); i.hasNext();){ + for (Iterator i = order.iterator(); i.hasNext();) { Object o = i.next(); StringBuffer tmp = getWarning(o); - if(tmp.length() != 0){ + if (tmp.length() != 0) { String title = o.toString(); tmp.insert(0, "\n"); - for(int e=0; e<title.length(); e++){ + for (int e = 0; e < title.length(); e++) { tmp.insert(0, "="); } - tmp.insert(0, title+"\n"); + tmp.insert(0, title + "\n"); tmp.append("\n"); result.append(tmp.toString()); } } return result; } + public StringBuffer getError() { StringBuffer result = new StringBuffer(); - for(Iterator i=order.iterator(); i.hasNext();){ + for (Iterator i = order.iterator(); i.hasNext();) { Object o = i.next(); StringBuffer tmp = getError(o); - if(tmp.length() != 0){ + if (tmp.length() != 0) { String title = o.toString(); tmp.insert(0, "\n"); - for(int e=0; e<title.length(); e++){ + for (int e = 0; e < title.length(); e++) { tmp.insert(0, "="); } - tmp.insert(0, title+"\n"); + tmp.insert(0, title + "\n"); tmp.append("\n"); result.append(tmp.toString()); } @@ -107,37 +112,39 @@ public StringBuffer getInfo(Object o) { StringBuffer result = new StringBuffer(); - LinkedList list = (LinkedList)info.get(o); - if(list != null && list.size() != 0){ + List list = info.get(o); + if (list != null && list.size() != 0) { result.append("Info\n"); result.append("----\n"); - for(Iterator i=list.iterator(); i.hasNext();){ + for (Iterator i = list.iterator(); i.hasNext();) { result.append(i.next().toString()); result.append("\n"); } } return result; } + public StringBuffer getWarning(Object o) { StringBuffer result = new StringBuffer(); - LinkedList list = (LinkedList)warning.get(o); - if(list != null && list.size() != 0){ + List list = warning.get(o); + if (list != null && list.size() != 0) { result.append("Problème\n"); result.append("--------\n"); - for(Iterator i=list.iterator(); i.hasNext();){ + for (Iterator i = list.iterator(); i.hasNext();) { result.append(i.next().toString()); result.append("\n"); } } return result; } + public StringBuffer getError(Object o) { StringBuffer result = new StringBuffer(); - LinkedList list = (LinkedList)error.get(o); - if(list != null && list.size() != 0){ + List list = error.get(o); + if (list != null && list.size() != 0) { result.append("Erreur\n"); result.append("------\n"); - for(Iterator i=list.iterator(); i.hasNext();){ + for (Iterator i = list.iterator(); i.hasNext();) { result.append(i.next().toString()); result.append("\n"); } @@ -145,27 +152,27 @@ return result; } - public StringBuffer getAll(Object o){ + public StringBuffer getAll(Object o) { StringBuffer result = new StringBuffer(); result.append(getError(o).toString()); result.append(getWarning(o).toString()); result.append(getInfo(o).toString()); - if (result.length() != 0){ + if (result.length() != 0) { String title = o.toString(); result.insert(0, "\n"); - for(int i=0; i<title.length(); i++){ + for (int i = 0; i < title.length(); i++) { result.insert(0, "="); } - result.insert(0, title+"\n"); + result.insert(0, title + "\n"); } result.append("\n"); return result; } - public StringBuffer getAll(){ + public StringBuffer getAll() { StringBuffer result = new StringBuffer(); - for(Iterator i=order.iterator(); i.hasNext();){ + for (Iterator i = order.iterator(); i.hasNext();) { result.append(getAll(i.next())); } return result; @@ -173,45 +180,47 @@ /** * Permet d'ajouter une info sur un objet. - * @param o l'objet sur lequel le message porte, surment un descendant d'un DBobjet + * + * @param o l'objet sur lequel le message porte * @param message le message à ajouter */ - public void addInfo(Object o, String message){ + public void addInfo(Object o, String message) { order.add(o); - LinkedList list = (LinkedList)info.get(o); - if(list == null){ - info.put(o, list = new LinkedList()); + List<String> list = info.get(o); + if (list == null) { + info.put(o, list = new LinkedList<String>()); } list.add(message); } /** * Permet d'ajouter un avertissement sur un objet. - * @param o l'objet sur lequel le message porte, surment un descendant d'un DBobjet + * + * @param o l'objet sur lequel le message porte * @param message le message à ajouter */ - public void addWarning(Object o, String message){ + public void addWarning(Object o, String message) { order.add(o); - LinkedList list = (LinkedList)warning.get(o); - if(list == null){ - warning.put(o, list = new LinkedList()); + List<String> list = warning.get(o); + if (list == null) { + warning.put(o, list = new LinkedList<String>()); } list.add(message); } /** * Permet d'ajouter une error sur un objet. - * @param o l'objet sur lequel le message porte, surment un descendant d'un DBobjet + * + * @param o l'objet sur lequel le message porte * @param message le message à ajouter */ - public void addError(Object o, String message){ + public void addError(Object o, String message) { order.add(o); - LinkedList list = (LinkedList)error.get(o); - if(list == null){ - error.put(o, list = new LinkedList()); + List<String> list = error.get(o); + if (list == null) { + error.put(o, list = new LinkedList<String>()); } list.add(message); } } // CheckResult - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultFrame.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultFrame.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultFrame.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -74,4 +74,3 @@ } } // CheckResultFrame - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -56,7 +56,6 @@ * @param formules formules list */ public FormuleComboModel(List<Formule> formules) { - super(); this.formules = formules; } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.entities.Formule; @@ -43,8 +42,7 @@ * Last update : $Date$ * By : $Author: chatellier $ */ -public class FormuleComboRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class FormuleComboRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -8277883340386163087L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,7 +34,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.AnalysePlanStorage; import fr.ifremer.isisfish.simulator.AnalysePlan; @@ -49,8 +48,7 @@ * Last update : $Date$ * By : $Author$ */ -public class AnalyzePlanComboRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class AnalyzePlanComboRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.AnalysePlanStorage; import fr.ifremer.isisfish.simulator.AnalysePlan; @@ -44,8 +43,7 @@ * Last update : $Date$ * By : $Author$ */ -public class AnalyzePlanListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class AnalyzePlanListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.export.Export; @@ -44,8 +43,7 @@ * Last update : $Date$ * By : $Author$ */ -public class ExportListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class ExportListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -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 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.models.export; - -import java.util.List; - -import javax.swing.DefaultListModel; - -/** - * Model pour la liste des noms d'exports. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ExportNameListModel extends DefaultListModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Analyze plan names. */ - protected List<String> exportNames; - - /** - * Empty constructor. - */ - public ExportNameListModel() { - this(null); - } - - /** - * Constructor with export list. - * - * @param exportNames exports Names - */ - public ExportNameListModel(List<String> exportNames) { - super(); - setExportNames(exportNames); - } - - /** - * Get exports names. - * - * @return the analyze plan names - */ - public List<String> getExportNames() { - return exportNames; - } - - /** - * Set analyze plan names. - * - * @param exportNames the exports names to set - */ - public void setExportNames(List<String> exportNames) { - this.exportNames = exportNames; - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public Object getElementAt(int index) { - return exportNames.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (exportNames != null) { - size = exportNames.size(); - } - return size; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,7 +34,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.export.Export; @@ -49,8 +48,7 @@ * Last update : $Date$ * By : $Author$ */ -public class ExportNameListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class ExportNameListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,29 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 1999 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ +/** + * Swing models used by both plan simulation and sensitivity simulation interface. + */ +package fr.ifremer.isisfish.ui.models; + Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -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 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.models.result; - -import java.util.List; - -import javax.swing.DefaultListModel; - -/** - * Model pour la liste des noms de resultats de simulation. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ResultListModel extends DefaultListModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Results names. */ - protected List<String> resultsNames; - - /** - * Empty constructor. - */ - public ResultListModel() { - this(null); - } - - /** - * Constructor with result names list. - * - * @param resultsNames result Names - */ - public ResultListModel(List<String> resultsNames) { - super(); - setResultNames(resultsNames); - } - - /** - * Get result names. - * - * @return the result plan names - */ - public List<String> getResultNames() { - return resultsNames; - } - - /** - * Set result names. - * - * @param resultsNames the result names to set - */ - public void setResultNames(List<String> resultsNames) { - this.resultsNames = resultsNames; - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public Object getElementAt(int index) { - return resultsNames.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (resultsNames != null) { - size = resultsNames.size(); - } - return size; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -35,7 +35,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.ScriptStorage; import fr.ifremer.isisfish.ui.util.TooltipHelper; @@ -52,8 +51,7 @@ * Last update : $Date$ * By : $Author$ */ -public class ResultListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class ResultListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,100 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.models.rule; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; - -import fr.ifremer.isisfish.datastore.RuleStorage; -import fr.ifremer.isisfish.rule.Rule; -import fr.ifremer.isisfish.ui.util.TooltipHelper; - -/** - * Renderer pour la combo des noms de regles. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class RuleComboRenderer extends DefaultListCellRenderer implements - ListCellRenderer { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Rule cache. */ - protected Map<String, Rule> ruleCache; - - /** - * Empty constructor. - */ - public RuleComboRenderer() { - ruleCache = new HashMap<String, Rule>(); - } - - /* - * @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); - - String ruleName = (String)value; - c.setText(ruleName); - - // c'est tres couteux d'avoir une instance - // on les met en cache - try { - Rule rule = ruleCache.get(ruleName); - if (rule == null) { - RuleStorage storage = RuleStorage.getRule(ruleName); - rule = storage.getNewRuleInstance(); - ruleCache.put(ruleName, rule); - } - - c.setToolTipText(rule.getDescription()); - } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(_("isisfish.error.compile.fileerror", ruleName)); - c.setToolTipText(errorTooltip); - } - - return c; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.rule.Rule; @@ -44,8 +43,7 @@ * Last update : $Date$ * By : $Author$ */ -public class RuleListCellRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class RuleListCellRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -948394724922547715L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,15 +25,10 @@ package fr.ifremer.isisfish.ui.models.rule; -import java.awt.Component; import java.util.List; import javax.swing.AbstractListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; -import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.rule.Rule; /** @@ -45,8 +40,7 @@ * Last update : $Date$ * By : $Author$ */ -public class RuleListModel extends AbstractListModel implements - ListCellRenderer { +public class RuleListModel extends AbstractListModel { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; @@ -66,7 +60,6 @@ * @param rules rules */ public RuleListModel(List<Rule> rules) { - super(); this.rules = rules; } @@ -86,6 +79,7 @@ */ public void setRules(List<Rule> rules) { this.rules = rules; + fireContentsChanged(this, 0, rules.size() - 1); } /* @@ -108,31 +102,4 @@ } return size; } - - /* - * @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) { - - Rule rule = rules.get(index); - - JLabel label = new JLabel(); - - try { - label.setToolTipText(rule.getDescription()); - } catch (Exception e) { - // can't get exception - } - label.setText(RuleStorage.getName(rule)); - - if (isSelected) { - label.setBackground(list.getSelectionBackground()); - label.setForeground(list.getSelectionForeground()); - label.setOpaque(true); // background won't work - } - - return label; - } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,98 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.models.rule; + +import static org.nuiton.i18n.I18n._; + +import java.awt.Component; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; +import javax.swing.JList; + +import fr.ifremer.isisfish.datastore.RuleStorage; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.ui.util.TooltipHelper; + +/** + * Renderer pour les listes des noms de regles. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RuleNamesListRenderer extends DefaultListCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID = -4070846632975105788L; + + /** Rule cache. */ + protected Map<String, Rule> ruleCache; + + /** + * Empty constructor. + */ + public RuleNamesListRenderer() { + ruleCache = new HashMap<String, Rule>(); + } + + /* + * @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); + + String ruleName = (String)value; + c.setText(ruleName); + + // c'est tres couteux d'avoir une instance + // on les met en cache + try { + Rule rule = ruleCache.get(ruleName); + if (rule == null) { + RuleStorage storage = RuleStorage.getRule(ruleName); + rule = storage.getNewRuleInstance(); + ruleCache.put(ruleName, rule); + } + + c.setToolTipText(rule.getDescription()); + } catch (Exception e) { + String errorTooltip = TooltipHelper.getErrorTooltip(_("isisfish.error.compile.fileerror", ruleName)); + c.setToolTipText(errorTooltip); + } + + return c; + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellEditor.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellEditor.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellEditor.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellEditor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,127 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 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 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.models.rule; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.EventObject; + +import javax.swing.AbstractCellEditor; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.TableCellEditor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.Resource; + +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.datastore.RuleStorage; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.ui.simulator.RuleChooser; +import fr.ifremer.isisfish.ui.simulator.SimulAction; + +/** + * Specific editor for rule parameters. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RuleParametersFactorTableCellEditor extends AbstractCellEditor + implements TableCellEditor { + + /** serialVersionUID. */ + private static final long serialVersionUID = -1655744662816030649L; + + private static Log log = LogFactory.getLog(RuleParametersFactorTableCellEditor.class); + + protected RuleChooser ruleChooser; + + protected Rule rule; + + /** + * Constructor. + * + * Super dependant de l'ui {@link RuleChooser} et de {@link SimulAction}. + * + * @param ruleChooser rule chooser ui + * @param rule rule + */ + public RuleParametersFactorTableCellEditor(RuleChooser ruleChooser, Rule rule) { + this.ruleChooser = ruleChooser; + this.rule = rule; + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, + boolean isSelected, int row, int column) { + + Component comp = null; + + final String paramName = (String)value; + try { + Object paramValue = RuleStorage.getParameterValue(rule, paramName); + //SensitivityInputHandler handler = ruleChooser.getContextValue(SensitivityInputHandler.class); + // FIXME chatellier : number n'est pas correct ici mais j'ai pas d'idée :( + if (/*handler.canBeContinue(paramValue) || */paramValue instanceof Number) { + JButton button = new JButton(Resource.getIcon("/icons/building_add.png")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cancelCellEditing(); + SimulAction simulAction = ruleChooser.getContextValue(SimulAction.class); + simulAction.addRuleParameterFactor(ruleChooser, rule, paramName); + } + }); + comp = button; + } + } catch (IsisFishException ex) { + if (log.isWarnEnabled()) { + log.warn("Can't get value type", ex); + } + } + + if (comp == null) { + comp = new JLabel(); + } + + return comp; + } + + /* + * @see javax.swing.CellEditor#getCellEditorValue() + */ + @Override + public Object getCellEditorValue() { + return null; + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellRenderer.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellRenderer.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellRenderer.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersFactorTableCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,100 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 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 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.models.rule; + +import java.awt.Component; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.Resource; + +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.datastore.RuleStorage; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.ui.simulator.RuleChooser; + +/** + * Specific editor for rule parameters. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RuleParametersFactorTableCellRenderer extends DefaultTableCellRenderer { + + /** serialVersionUID. */ + private static final long serialVersionUID = -1655744662816030649L; + + /** Class logger. */ + private static Log log = LogFactory.getLog(RuleParametersFactorTableCellRenderer.class); + + protected RuleChooser ruleChooser; + + protected Rule rule; + + public RuleParametersFactorTableCellRenderer(RuleChooser ruleChooser, Rule rule) { + this.ruleChooser = ruleChooser; + this.rule = rule; + } + + /* + * @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 comp = null; + + String paramName = (String)value; + try { + Object paramValue = RuleStorage.getParameterValue(rule, paramName); + //SensitivityInputHandler handler = ruleChooser.getContextValue(SensitivityInputHandler.class); + // FIXME chatellier : number n'est pas correct ici mais j'ai pas d'idée :( + if (/*handler.canBeContinue(paramValue) || */paramValue instanceof Number) { + comp = new JButton(Resource.getIcon("/icons/building_add.png")); + } + } catch (IsisFishException ex) { + if (log.isWarnEnabled()) { + log.warn("Can't get value type", ex); + } + } + + if (comp == null) { + comp = super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column); + } + + return comp; + } + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -57,8 +57,6 @@ * @param rule rule */ public RuleParametersTableCellEditor(Rule rule) { - super(); - this.rule = rule; ruleParametersTypes = new ArrayList<Class<?>>(); //TODO map may be sorted Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -30,7 +30,6 @@ import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellRenderer; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.rule.Rule; @@ -46,8 +45,7 @@ * Last update : $Date$ * By : $Author$ */ -public class RuleParametersTableCellRenderer extends DefaultTableCellRenderer - implements TableCellRenderer { +public class RuleParametersTableCellRenderer extends DefaultTableCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -1655744662816030649L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -46,6 +46,7 @@ * Columns : * <li>Parameter name</li> * <li>Parameter value</li> + * <li>Parameter factor (if enabled)</li> * * @author chatellier * @version $Revision$ @@ -56,35 +57,46 @@ public class RuleParametersTableModel extends AbstractTableModel { /** Log. */ - private static Log log = LogFactory - .getLog(RuleParametersTableModel.class); + private static Log log = LogFactory.getLog(RuleParametersTableModel.class); /** serialVersionUID. */ private static final long serialVersionUID = 3169786638868209920L; /** Columns names. */ - public final static String[] COLUMN_NAMES = { _("isisfish.common.name"), - _("isisfish.common.value") }; + public final static String[] COLUMN_NAMES = { + _("isisfish.common.name"), + _("isisfish.common.value"), + _("isisfish.common.ellipsis")}; protected Rule rule; + protected List<String> ruleParametersNames; + /** If {@code true} display optional. */ + protected boolean showFactorColumn; + + public void setShowFactorColumn(boolean showFactorColumn) { + this.showFactorColumn = showFactorColumn; + fireTableStructureChanged(); + } + /** - * Constructor with data. - * - * @param rule rule to edit parameters + * Set new rule, and fire changed event. + * + * @param rule */ - public RuleParametersTableModel(Rule rule) { - super(); + public void setRule(Rule rule) { this.rule = rule; - //TODO map may be sorted ruleParametersNames = new ArrayList<String>(); - Map<String, Class<?>> ruleParametersNamesAndTypes = RuleStorage - .getParameterNames(rule); - for (String names : ruleParametersNamesAndTypes.keySet()) { - ruleParametersNames.add(names); + if (rule != null) { + Map<String, Class<?>> ruleParametersNamesAndTypes = RuleStorage + .getParameterNames(rule); + for (String names : ruleParametersNamesAndTypes.keySet()) { + ruleParametersNames.add(names); + } } + fireTableDataChanged(); } /* @@ -92,7 +104,11 @@ */ @Override public int getColumnCount() { - return COLUMN_NAMES.length; + int result = 2; + if (showFactorColumn) { + result = 3; + } + return result; } /* @@ -100,7 +116,11 @@ */ @Override public int getRowCount() { - return ruleParametersNames.size(); + int result = 0; + if (ruleParametersNames != null) { + result = ruleParametersNames.size(); + } + return result; } /* @@ -125,6 +145,9 @@ } } break; + case 2: + result = name; + break; default: throw new IndexOutOfBoundsException("No such column " + columnIndex); } @@ -147,6 +170,9 @@ case 1: result = Object.class; break; + case 2: + result = String.class; + break; default: throw new IndexOutOfBoundsException("No such column " + columnIndex); } @@ -191,6 +217,10 @@ } } break; + case 2: + // appelé parce qu'on ne peut pas l'empecher + // pour la colonne Action, + break; default: throw new IndexOutOfBoundsException("Can't edit column " + columnIndex); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,7 +34,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.SensitivityStorage; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; @@ -49,8 +48,7 @@ * Last update : $Date$ * By : $Author$ */ -public class SensitivityCalculatorComboRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class SensitivityCalculatorComboRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.SensitivityStorage; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; @@ -44,8 +43,7 @@ * Last update : $Date$ * By : $Author$ */ -public class SensitivityCalculatorListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class SensitivityCalculatorListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,7 +30,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.export.SensitivityExport; @@ -44,8 +43,7 @@ * Last update : $Date$ * By : $Author: chatellier $ */ -public class SensitivityExportListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class SensitivityExportListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -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 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.models.sensitivityexport; - -import java.util.List; - -import javax.swing.DefaultListModel; - -/** - * Model pour la liste des noms d'exports. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author: chatellier $ - */ -public class SensitivityExportNameListModel extends DefaultListModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Analyze plan names. */ - protected List<String> sensitivityExportNames; - - /** - * Empty constructor. - */ - public SensitivityExportNameListModel() { - this(null); - } - - /** - * Constructor with export list. - * - * @param exportNames exports Names - */ - public SensitivityExportNameListModel(List<String> exportNames) { - super(); - setSensitivityExportNames(exportNames); - } - - /** - * Get exports names. - * - * @return the analyze plan names - */ - public List<String> getSensitivityExportNames() { - return sensitivityExportNames; - } - - /** - * Set export names. - * - * @param sensitivityExportNames the exports names to set - */ - public void setSensitivityExportNames(List<String> sensitivityExportNames) { - this.sensitivityExportNames = sensitivityExportNames; - } - - /* - * @see javax.swing.ListModel#getElementAt(int) - */ - @Override - public Object getElementAt(int index) { - return sensitivityExportNames.get(index); - } - - /* - * @see javax.swing.ListModel#getSize() - */ - @Override - public int getSize() { - int size = 0; - - if (sensitivityExportNames != null) { - size = sensitivityExportNames.size(); - } - return size; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -34,7 +34,6 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.JLabel; import javax.swing.JList; -import javax.swing.ListCellRenderer; import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.export.SensitivityExport; @@ -49,8 +48,7 @@ * Last update : $Date$ * By : $Author: chatellier $ */ -public class SensitivityExportNameListRenderer extends DefaultListCellRenderer implements - ListCellRenderer { +public class SensitivityExportNameListRenderer extends DefaultListCellRenderer { /** serialVersionUID. */ private static final long serialVersionUID = -4070846632975105788L; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/queue/QueueUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,11 +23,14 @@ #L% --> <Table> + <import> + fr.ifremer.isisfish.simulator.launcher.SimulationServiceTableModel; + fr.ifremer.isisfish.simulator.launcher.SimulationService; + javax.swing.JProgressBar; + javax.swing.ListSelectionModel; + </import> <script><![CDATA[ - import fr.ifremer.isisfish.simulator.launcher.SimulationServiceTableModel; - import fr.ifremer.isisfish.simulator.launcher.SimulationService; - import javax.swing.JProgressBar; - import javax.swing.ListSelectionModel; + queueTable.setDefaultRenderer(JProgressBar.class, new ComponentTableCellRenderer()); queueTableDone.setDefaultRenderer(JProgressBar.class, new ComponentTableCellRenderer()); Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,131 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.io.File; -import java.io.FileWriter; -import java.util.Iterator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.util.FileUtil; - -/** - * Objet permettant l'affichage des donnees resultats sous forme de - * matrice. - */ -public class DataResult extends DataResultUI { // IfremerSimulation - - /** serialVersionUID. */ - private static final long serialVersionUID = -4089377865270062094L; - - /** Class logger. */ - private static Log log = LogFactory.getLog(DataResult.class); - - protected MatrixND matrix; - - public DataResult() { - super(); - init(); - } - - public MatrixND getMatrix() { - return matrix; - } - - public void setMatrix(MatrixND v) { - this.matrix = v; - reload(); - } - - public void reload(){ - loadDescription(); - loadMatrice(); - } - - /** - * Affiche le titre de la matrice - */ - public void loadDescription(){ - getDescriptionLabel().setText(getMatrix().getName()); - } - - /** - * Affiche la matrice dans le panel de matrice - */ - public void loadMatrice(){ - // TODO remplacer la table specifique comme expliqué dans le FIXME - // pour l'affichage des data - // par le panel des matrix qui fait la meme chose - // Il faut juste ajouter que si la matrice a 2 dimensions - // le coin en haut a gauche affiche l'intitulé des dimension - // par exemple 'date/population' - -// getMatrixPanel().setMatrice(getMatrix()); - // FIXME si le composant ou dessus fonctionne, supprimer la ligne - // suivante et sans doute aussi le MatrixInfoTableModel. - getMatriceTable().setModel(new MatrixInfoTableModel(getMatrix())); - - } - - public void on_exportButton_clicked(){ - String result = getMatrix().getName() + ";"; - try{ - File file = FileUtil.getFile(".+.csv", "CSV file"); - if(file != null){ - for (Iterator i=getMatrix().getSemantics(1).iterator(); - i.hasNext();){ - - result += i.next().toString(); - if(i.hasNext()){ - result += ";"; - }else{ - result += "\n"; - } - } - - int y=0; - for (Iterator i=getMatrix().getSemantics(0).iterator(); - i.hasNext(); y++){ - result += i.next().toString()+";"; - for(int x=0; x<getMatrix().getDim(1); x++){ - result += getMatrix().getValue(y, x) + ";"; - } - result += "\n"; - } - - FileWriter writer = new FileWriter(file); - writer.write(result); - writer.close(); - } - }catch(Exception eee){ - log.error(":104:Error during export"+eee); - } - } - -} - Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,235 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.JTableHeader; - -public abstract class DataResultUI extends JPanel implements DataResultUICallback{ - - protected void init(){ - DataResultUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getDataResultChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getDataResultChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable2()); - return result; - } - - private JPanel __table2__ = null; - public JPanel getTable2(){ - if(__table2__ == null){ - Vector childs = getTable2Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 6; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 2; - c.weightx = 1; - c.weighty = 5; - c.gridwidth = 1; - c.gridheight = 4; - c.fill = GridBagConstraints.BOTH; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table2__ = result; - } - return __table2__; - } - - public Vector getTable2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getDescriptionLabel()); - result.add(getExportButton()); - result.add(getScrolledwindow2()); - return result; - } - - private JLabel __descriptionLabel__ = null; - public JLabel getDescriptionLabel(){ - if(__descriptionLabel__ == null){ - JLabel result = new JLabel(_("isisfish.simulation.name")); - - __descriptionLabel__ = result; - } - return __descriptionLabel__; - } - - private JButton __exportButton__ = null; - public JButton getExportButton(){ - if(__exportButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.dataResult.export.csv"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_exportButton_clicked(); - } - }); - - __exportButton__ = result; - } - return __exportButton__; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMatriceTable()); - return result; - } - - private JTable __matriceTable__ = null; - public JTable getMatriceTable(){ - if(__matriceTable__ == null){ - Vector head = getMatriceTableHead(); - JTable result = - new JTable(new DefaultTableModel(new Vector(), head)); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - setSignalMatriceTableHeader(result); - - __matriceTable__ = result; - } - return __matriceTable__; - } - - public Vector getMatriceTableHead(){ - Vector<String> result = new Vector<String>(); - result.add(_("isisfish.dataResult.label")); - result.add(_("isisfish.dataResult.label")); - result.add(_("isisfish.dataResult.label")); - return result; - } - - public void setSignalMatriceTableHeader(JTable table){ - JTableHeader result = table.getTableHeader(); - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,31 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - - -public interface DataResultUICallback{ - - public void on_exportButton_clicked(); -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,229 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.editor.ChartEditor; -import org.jfree.chart.editor.ChartEditorManager; -import org.jfree.chart.labels.StandardCategoryToolTipGenerator; -import org.jfree.chart.renderer.category.AreaRenderer; -import org.jfree.chart.renderer.category.BarRenderer; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.chart.renderer.category.LineAndShapeRenderer; -import org.jfree.chart.renderer.category.LineRenderer3D; -import org.jfree.chart.renderer.category.MinMaxCategoryRenderer; -import org.jfree.chart.renderer.category.StackedAreaRenderer; -import org.jfree.chart.renderer.category.StackedBarRenderer; - -/** - * GraphBean. - * - * Created: Mon Apr 29 17:48:40 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphBean extends GraphBeanUI implements GraphBeanUICallback, - GraphListener { - - /** serialVersionUID */ - private static final long serialVersionUID = -4474836708965453250L; - - protected GraphBeanModel model; - protected JPanel graphPalette; - protected ChartPanel chartPanel; - protected JFreeChart chart; - - public GraphBean() { - super(); - init(); - getGraphRendererCombo().setEditable(false); - getGraphRendererCombo().setRenderer(new GraphComboRenderer()); - loadGraphRendererCombo(); - } - - protected void loadGraphRendererCombo() { - DefaultComboBoxModel model = new DefaultComboBoxModel(); - - // rendu : vertical bar - BarRenderer barRenderer = new BarRenderer(); - barRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(barRenderer); - - // rendu : vertical bar 3d - BarRenderer3D barRenderer3D = new BarRenderer3D(); - barRenderer3D.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(barRenderer3D); - - // rendu stacked bar - StackedBarRenderer stackedBarRenderer = new StackedBarRenderer(); - stackedBarRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(stackedBarRenderer); - - // rendu aire - AreaRenderer areaRenderer = new AreaRenderer(); - areaRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(areaRenderer); - - // rendu aire empilée - StackedAreaRenderer stackedAreaRenderer = new StackedAreaRenderer(); - stackedAreaRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(stackedAreaRenderer); - - // rendu line aire - LineAndShapeRenderer lineAndShapeRenderer = new LineAndShapeRenderer(); - lineAndShapeRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(lineAndShapeRenderer); - - // rendu ligne 3d - LineRenderer3D lineRenderer3D = new LineRenderer3D(); - lineRenderer3D.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(lineRenderer3D); - - // rendu mix/max - MinMaxCategoryRenderer minMaxCategoryRenderer = new MinMaxCategoryRenderer(); - minMaxCategoryRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(minMaxCategoryRenderer); - - model.setSelectedItem(null); - getGraphRendererCombo().setModel(model); - } - - /** - * Get the value of model. - * @return value of model. - */ - public GraphBeanModel getModel() { - return model; - } - - /** - * Set the value of model. - * @param v Value to assign to model. - */ - public void setModel(GraphBeanModel v) { - this.model = v; - model.addGraphListener(this); - // displayGraph(); - } - - public void graphChanged(GraphEvent e) { - displayGraph(); - } - - /** - * Get the value of chartPanel. - * @return value of chartPanel. - */ - public ChartPanel getChartPanel() { - return chartPanel; - } - - /** - * Set the value of chartPanel. - * @param v Value to assign to chartPanel. - */ - public void setChartPanel(ChartPanel v) { - this.chartPanel = v; - } - - /** - * Get the value of graphPalette. - * @return value of graphPalette. - */ - public JPanel getGraphPalette() { - return graphPalette; - } - - /** - * Set the value of graphPalette. - * @param v Value to assign to graphPalette. - */ - public void setGraphPalette(JPanel v) { - this.graphPalette = v; - } - - /** - * Get the value of chart. - * @return value of chart. - */ - public JFreeChart getChart() { - return chart; - } - - /** - * Set the value of chart. - * @param v Value to assign to chart. - */ - public void setChart(JFreeChart v) { - this.chart = v; - } - - public void displayGraph() { - - JFreeChart chart = new JFreeChart(getModel().getTitle(), - JFreeChart.DEFAULT_TITLE_FONT, getModel().getCategoryPlot(), true); - - setChart(chart); - setChartPanel(new ChartPanel(chart)); - - // C'est un DefaultChartEditor (mais en visibilite package) - // qui etend JPanel et ChartEditor (en version 1.0.13 du moins) - setGraphPalette((JPanel) ChartEditorManager.getChartEditor(this.chart)); - - //getGraphSplitPane().setDividerLocation(1.0); - - getGraphPanel().removeAll(); - getPalettePanel().removeAll(); - getGraphPanel().add(getChartPanel()); - getPalettePanel().add(getGraphPalette()); - getGraphPanel().invalidate(); - getPalettePanel().invalidate(); - getGraphPanel().validate(); - getPalettePanel().validate(); - getGraphPanel().repaint(); - getPalettePanel().repaint(); - } - - public void on_appliquer_clicked() { - ((ChartEditor) getGraphPalette()).updateChart(getChart()); - } - - public void on_graphRendererCombo_selectionChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - getModel().setRenderer( - (CategoryItemRenderer) getGraphRendererCombo() - .getSelectedItem()); - } - } - -}// GraphBean Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,194 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.HashSet; -import java.util.Iterator; - -import org.jfree.chart.axis.CategoryAxis; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.axis.NumberAxis3D; -import org.jfree.chart.axis.ValueAxis; -import org.jfree.chart.labels.StandardCategoryToolTipGenerator; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.data.category.CategoryDataset; -import org.nuiton.math.matrix.MatrixND; - -/** - * GraphBeanModel. - * - * Created: Fri May 17 13:29:47 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphBeanModel { - - // protected VerticalCategoryPlot verticalCategoryPlot; - protected CategoryDataset categoryDataset; - protected CategoryAxis horizontalAxis; - protected ValueAxis verticalAxis; - protected CategoryItemRenderer renderer; - protected MatrixND matrix; - - // table de toutes les vues du modèle - private HashSet listeners = new HashSet(); - - public GraphBeanModel() { - horizontalAxis = new CategoryAxis(); - horizontalAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); - renderer = new BarRenderer3D(); - renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - verticalAxis = new NumberAxis3D(); - } - - /** - * Méthode qui permet d'ajouter une vue au modèle - * @param view la nouvelle vue - */ - public void addGraphListener(GraphListener view) { - listeners.add(view); - } - - /** - * Méthode qui retire une vue du modèle - * @param view la vue à retirer - */ - public void removeGraphListener(GraphListener view) { - listeners.remove(view); - } - - /** - * Accesseur sur la table des listeners du modèle - * @return la collection des listeners - */ - public HashSet getGraphListeners() { - return listeners; - } - - /** - * Accesseur en écriture sur la table des listeners du modèle - * @param obs la collection des listeners - */ - public void setGraphListeners(HashSet obs) { - listeners = obs; - } - - /** - * Previent les vues que le model a change - * - */ - protected void fireGraphChanged() { - // Iterateur pour parcourir les vues - Iterator listenersIterator = listeners.iterator(); - GraphEvent ge = new GraphEvent(this); - - while (listenersIterator.hasNext()) { - GraphListener listener = ((GraphListener) listenersIterator.next()); - listener.graphChanged(ge); - } - } - - /** - * Get the value of title. - * @return value of title. - */ - public String getTitle() { - return matrix.getName(); - } - - /** - * Get the value of categoryDataset. - * @return value of categoryDataset. - */ - public CategoryDataset getCategoryDataset() { - return categoryDataset; - } - - /** - * Set the value of categoryDataset. - * @param v Value to assign to categoryDataset. - */ - public void setCategoryDataset(CategoryDataset v) { - this.categoryDataset = v; - fireGraphChanged(); - } - - public void setMatrix(MatrixND mi) { - matrix = mi; - setCategoryDataset(new GraphMatrixNDDataset(mi)); - } - - public CategoryPlot getCategoryPlot() { - return new CategoryPlot(getCategoryDataset(), getHorizontalAxis(), - getVerticalAxis(), getRenderer()); - } - - /** - * Get the value of horizontalAxis. - * @return value of horizontalAxis. - */ - public CategoryAxis getHorizontalAxis() { - horizontalAxis.setLabel(matrix.getDimensionName(0)); - return horizontalAxis; - } - - /** - * Get the value of renderer. - * @return value of renderer. - */ - public CategoryItemRenderer getRenderer() { - return renderer; - } - - /** - * Set the value of renderer. - * @param v Value to assign to renderer. - */ - public void setRenderer(CategoryItemRenderer v) { - this.renderer = v; - fireGraphChanged(); - } - - /** - * Get the value of verticalAxis. - * @return value of verticalAxis. - */ - public ValueAxis getVerticalAxis() { - return verticalAxis; - } - - /** - * Set the value of verticalAxis. - * @param v Value to assign to verticalAxis. - */ - public void setVerticalAxis(ValueAxis v) { - this.verticalAxis = v; - fireGraphChanged(); - } - -}// GraphBeanModel Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,394 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JViewport; - -public abstract class GraphBeanUI extends JPanel implements GraphBeanUICallback{ - - protected void init(){ - GraphBeanUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getGraphBeanChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getGraphBeanChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphSplitPane()); - return result; - } - - private JSplitPane __graphSplitPane__ = null; - public JSplitPane getGraphSplitPane(){ - if(__graphSplitPane__ == null){ - Vector childs = getGraphSplitPaneChilds(); - Component child1 = null; - Component child2 = null; - if(childs.size() >= 1) - child1 = (Component)childs.get(0); - if(childs.size() >= 2) - child2 = (Component)childs.get(1); - - JSplitPane result = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - child1, child2); - result.setOneTouchExpandable(true); - result.setDividerSize(10); - - __graphSplitPane__ = result; - } - return __graphSplitPane__; - } - - public Vector getGraphSplitPaneChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable3()); - result.add(getTable1()); - return result; - } - - private JPanel __table3__ = null; - public JPanel getTable3(){ - if(__table3__ == null){ - Vector childs = getTable3Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 3; - c.gridwidth = 2; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table3__ = result; - } - return __table3__; - } - - public Vector getTable3Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel1()); - result.add(getScrolledwindow1()); - result.add(getGraphRendererCombo()); - return result; - } - - private JLabel __label1__ = null; - public JLabel getLabel1(){ - if(__label1__ == null){ - JLabel result = new JLabel(_("isisfish.graphBean.graph.render")); - - __label1__ = result; - } - return __label1__; - } - - private JScrollPane __scrolledwindow1__ = null; - public JScrollPane getScrolledwindow1(){ - if(__scrolledwindow1__ == null){ - Vector childs = getScrolledwindow1Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow1__ = result; - } - return __scrolledwindow1__; - } - - public Vector getScrolledwindow1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getViewport1()); - return result; - } - - private JViewport __viewport1__ = null; - public JViewport getViewport1(){ - if(__viewport1__ == null){ - JViewport result = new JViewport(); - Vector childs = getViewport1Childs(); - for (Object child : childs) result.add((Component) child); - - __viewport1__ = result; - } - return __viewport1__; - } - - public Vector getViewport1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable99()); - return result; - } - - private JPanel __table99__ = null; - public JPanel getTable99(){ - if(__table99__ == null){ - Vector childs = getTable99Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table99__ = result; - } - return __table99__; - } - - public Vector getTable99Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphPanel()); - return result; - } - - private javax.swing.JPanel __graphPanel__ = null; - public javax.swing.JPanel getGraphPanel(){ - if(__graphPanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __graphPanel__ = result; - } - return __graphPanel__; - } - - private JComboBox __graphRendererCombo__ = null; - public JComboBox getGraphRendererCombo(){ - if(__graphRendererCombo__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_graphRendererCombo_selectionChanged(e); - } - }); - - __graphRendererCombo__ = result; - } - return __graphRendererCombo__; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable2()); - result.add(getAppliquer()); - return result; - } - - private JPanel __table2__ = null; - public JPanel getTable2(){ - if(__table2__ == null){ - Vector childs = getTable2Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table2__ = result; - } - return __table2__; - } - - public Vector getTable2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getPalettePanel()); - return result; - } - - private javax.swing.JPanel __palettePanel__ = null; - public javax.swing.JPanel getPalettePanel(){ - if(__palettePanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __palettePanel__ = result; - } - return __palettePanel__; - } - - private JButton __appliquer__ = null; - public JButton getAppliquer(){ - if(__appliquer__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.apply"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_appliquer_clicked(); - } - }); - - __appliquer__ = result; - } - return __appliquer__; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,34 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -public interface GraphBeanUICallback{ - - public void on_graphRendererCombo_selectionChanged(ItemEvent e); - public void on_appliquer_clicked(); -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,87 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; - -import org.jfree.chart.renderer.category.AreaRenderer; -import org.jfree.chart.renderer.category.BarRenderer; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.IntervalBarRenderer; -import org.jfree.chart.renderer.category.LayeredBarRenderer; -import org.jfree.chart.renderer.category.LineAndShapeRenderer; -import org.jfree.chart.renderer.category.LineRenderer3D; -import org.jfree.chart.renderer.category.MinMaxCategoryRenderer; -import org.jfree.chart.renderer.category.StackedAreaRenderer; -import org.jfree.chart.renderer.category.StackedBarRenderer; - -/** - * GraphComboRenderer. - * - * Created: Thu Sep 12 19:55:10 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphComboRenderer extends DefaultListCellRenderer { - - /** serialVersionUID */ - private static final long serialVersionUID = 5439698068065934760L; - - public GraphComboRenderer() { - super(); - } - - public Component getListCellRendererComponent(JList liste, Object o, - int attributeIndex, boolean isSelected, boolean hasFocus) { - super.getListCellRendererComponent(liste, o, attributeIndex, - isSelected, hasFocus); - if (o instanceof StackedBarRenderer) { - setText(_("isisfish.graphCombo.render.bar.stacked")); - } else if (o instanceof BarRenderer3D) { - setText(_("isisfish.graphCombo.render.bar.3d")); - } else if (o instanceof BarRenderer) { - setText(_("isisfish.graphCombo.render.bar")); - } else if (o instanceof StackedAreaRenderer) { - setText(_("isisfish.graphCombo.render.surface.stacked")); - } else if (o instanceof AreaRenderer) { - setText(_("isisfish.graphCombo.render.surface")); - } else if (o instanceof LineRenderer3D) { - setText(_("isisfish.graphCombo.render.line.3d")); - } else if (o instanceof LineAndShapeRenderer) { - setText(_("isisfish.graphCombo.render.line")); - } else if (o instanceof MinMaxCategoryRenderer) { - setText(_("isisfish.graphCombo.render.min.max")); - } else { - setText((o == null) ? "" : o.toString()); - } - return this; - } -}// GraphComboRenderer Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,45 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.EventObject; - -/** - * GraphEvent.java - * - * Created: Tue May 21 16:42:58 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphEvent extends EventObject { - /** serialVersionUID */ - private static final long serialVersionUID = 4189617216481564748L; - - public GraphEvent(GraphBeanModel gbm) { - super((Object) gbm); - } - -}// GraphEvent Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,39 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.EventListener; - -/** - * GraphListener. - * - * Created: Tue May 21 16:36:39 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public interface GraphListener extends EventListener { - public void graphChanged(GraphEvent e); -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,255 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ResourceBundle; - -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.AbstractSeriesDataset; -import org.jfree.data.resources.DataPackageResources; -import org.nuiton.math.matrix.MatrixND; - -/** - * GraphMatrixNDDataset. - * - * Created: Fri May 17 16:26:19 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphMatrixNDDataset extends AbstractSeriesDataset implements - CategoryDataset { //XYDataset { - - /** serialVersionUID. */ - private static final long serialVersionUID = -891382923646394164L; - - /** The series names. */ - protected List seriesNames; - - /** The categories. */ - protected List categories; - - /** Storage for the data. */ - protected MatrixND mat; - - public GraphMatrixNDDataset(MatrixND mat) { - this(mat.getSemantic(1), mat.getSemantic(0), mat); - } - - /** - * Constructs a GraphMatrixNDDataset, populates it with the matrix, and uses the - * supplied names for the series and the supplied objects for the categories. - * - * @param seriesNames The series names. - * @param categories The categories. - * @param mat The matrix. - */ - public GraphMatrixNDDataset(List seriesNames, List categories, MatrixND mat) { - - this.mat = mat; - - if (mat != null && mat.getDimCount() > 1) { - - String baseName = DataPackageResources.class.getCanonicalName(); - ResourceBundle resources = ResourceBundle.getBundle(baseName); - - int series_count = mat.getDim(1); - if (series_count > 0) { - - // set up the series names... - if (seriesNames != null) { - - if (seriesNames.size() != series_count) { - throw new IllegalArgumentException( - "DefaultCategoryDataset: the number of " - + "series names does not match the number of series in the data."); - } - - this.seriesNames = seriesNames; - } else { - String prefix = resources - .getString("series.default-prefix") - + " "; - this.seriesNames = this.generateNames(series_count, prefix); - } - - if (mat.getDimCount() > 1) { - // set up the category names... - int categoryCount = mat.getDim(0); - if (categories != null) { - if (categories.size() != categoryCount) { - throw new IllegalArgumentException( - "DefaultCategoryDataset: the number of " - + "categories does not match the number of categories in the data."); - } - this.categories = categories; - } else { - String prefix = resources - .getString("categories.default-prefix") - + " "; - this.categories = this.generateNames(categoryCount, - prefix); - } - } else { - this.categories = null; - } - } else { - this.seriesNames = null; - this.categories = null; - } - } else { - this.seriesNames = null; - this.categories = null; - } - } - - /** - * Generates an array of names, by appending a space plus an integer (starting with 1) - * to the supplied prefix string. - * @param count The number of names required. - * @param prefix The name prefix. - */ - private List generateNames(int count, String prefix) { - - List result = new ArrayList(); - String name; - for (int i = 0; i < count; i++) { - name = prefix + (i + 1); - result.add(name); - } - return result; - - } - - /* - * @see org.jfree.data.general.AbstractSeriesDataset#getSeriesCount() - */ - @Override - public int getSeriesCount() { - int result = 0; - if (mat != null && mat.getNbDim() > 1) { - result = mat.getDim(1); - } - return result; - } - - /* - * @see org.jfree.data.general.AbstractSeriesDataset#getSeriesKey(int) - */ - @Override - public Comparable getSeriesKey(int series) { - return seriesNames.get(series).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnIndex(java.lang.Comparable) - */ - @Override - public int getColumnIndex(Comparable key) { - return categories.indexOf(key); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnKey(int) - */ - @Override - public Comparable getColumnKey(int column) { - return categories.get(column).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnKeys() - */ - @Override - public List getColumnKeys() { - - // the CategoryDataset interface expects a list of categories, but we've stored them in - // an array... - if (categories == null) { - return new ArrayList(); - } else { - return Collections.unmodifiableList(categories); - } - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowIndex(java.lang.Comparable) - */ - @Override - public int getRowIndex(Comparable key) { - return seriesNames.indexOf(key); - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowKey(int) - */ - @Override - public Comparable getRowKey(int row) { - return seriesNames.get(row).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowKeys() - */ - @Override - public List getRowKeys() { - return seriesNames; - } - - /* - * @see org.jfree.data.KeyedValues2D#getValue(java.lang.Comparable, java.lang.Comparable) - */ - @Override - public Number getValue(Comparable rowKey, Comparable columnKey) { - return new Double(mat.getValue(columnKey, rowKey)); - } - - /* - * @see org.jfree.data.Values2D#getColumnCount() - */ - @Override - public int getColumnCount() { - return categories.size(); - } - - /* - * @see org.jfree.data.Values2D#getRowCount() - */ - @Override - public int getRowCount() { - return seriesNames.size(); - } - - /* - * @see org.jfree.data.Values2D#getValue(int, int) - */ - @Override - public Number getValue(int row, int column) { - return new Double(mat.getValue(column, row)); - } -} // GraphMatrixNDDataset Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,97 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.ListSelectionModel; - -import org.nuiton.util.Resource; - -/** - * InfoItem.java - * - * Created: Thu Jul 06 13:54:59 2000 - * - * @author PERNEL Xavier - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class InfoItem extends InfoItemUI implements InfoPanelable { - - protected int position; - - public InfoItem() { - super(); - init(); - - ImageIcon sigmabarre = Resource.getIcon("images/sigma-barre.gif"); - ImageIcon sigma = Resource.getIcon("images/sigma.gif"); - getSumButton().setSelectedIcon(sigma); - getSumButton().setIcon(sigmabarre); - getSumButton().setBorder(BorderFactory.createEtchedBorder()); - getSumButton().setBorderPainted(true); - getSumButton().setToolTipText(_("isisfish.infoItem.sum")); - - getList().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - } - - /** - * Get the value of position. - * @return value of position. - */ - public int getPosition() { - return position; - } - - /** - * Set the value of position. - * @param v Value to assign to position. - */ - public void setPosition(int v) { - this.position = v; - } - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(){ - if (getSumButton().isSelected()){ - return -1; - }else{ - return 1; - } - } -} // InfoItem Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,111 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -/** -* InfoItemDate.java -* -* -* Created: Thu Jul 06 14:06:32 2000 -* -* @author PERNEL Xavier -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.ListSelectionModel; - -import org.nuiton.util.Resource; - -public class InfoItemDate extends InfoItemDateUI implements InfoPanelable { - - protected int position; - - public InfoItemDate() { - super(); - init(); - - getLabel().setText(_("isisfish.common.date")); - ImageIcon sigmabarre = Resource.getIcon("images/sigma-barre.gif"); - ImageIcon sigma = Resource.getIcon("images/sigma.gif"); - getSumButton().setSelectedIcon(sigma); - getSumButton().setIcon(sigmabarre); - getSumButton().setBorder(BorderFactory.createEtchedBorder()); - getSumButton().setBorderPainted(true); - getSumButton().setToolTipText(_("isisfish.infoItem.sum")); - - ImageIcon sigmaAnBarre = Resource.getIcon("images/sigma_an-barre.gif"); - ImageIcon sigmaAn = Resource.getIcon("images/sigma_an.gif"); - getSumAnButton().setSelectedIcon(sigmaAn); - getSumAnButton().setIcon(sigmaAnBarre); - getSumAnButton().setBorder(BorderFactory.createEtchedBorder()); - getSumAnButton().setBorderPainted(true); - getSumAnButton().setToolTipText(_("isisfish.infoItem.sum.year")); - - getList().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - getList().setCellRenderer(new InfoItemDateListRenderer()); - } - - /** - * Get the value of position. - * @return value of position. - */ - public int getPosition() { - return position; - } - - /** - * Set the value of position. - * @param v Value to assign to position. - */ - public void setPosition(int v) { - this.position = v; - } - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(){ - if (getSumButton().isSelected()){ - return -1; - }else if (getSumAnButton().isSelected()){ - return 12; - }else{ - return 1; - } - } -} // InfoItemDate Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,63 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.awt.Component; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; - -import fr.ifremer.isisfish.types.Date; - -/** - * InfoItemDateListRenderer. - * - * Created: Thu Sep 12 20:16:20 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class InfoItemDateListRenderer extends DefaultListCellRenderer { - - /** serialVersionUID */ - private static final long serialVersionUID = -3340579108147857972L; - - public InfoItemDateListRenderer (){ - super(); - } - - public Component getListCellRendererComponent(JList liste, - Object o, - int attributeIndex, - boolean isSelected, - boolean hasFocus){ - super.getListCellRendererComponent(liste, o, attributeIndex,isSelected, hasFocus); - if (o instanceof Date) - setText((o == null) ? "" : ((Date)o).getMonth().toString()+" "+((Date)o).getYear()); - else - setText((o == null) ? "" : o.toString()); - return this; - } -}// InfoItemDateListRenderer Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,265 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; - -public abstract class InfoItemDateUI extends JPanel implements InfoItemDateUICallback{ - - protected void init(){ - InfoItemDateUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getInfoItemDateChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = (ButtonGroup)hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getInfoItemDateChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable31()); - return result; - } - - private JPanel __table31__ = null; - public JPanel getTable31(){ - if(__table31__ == null){ - Vector childs = getTable31Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table31__ = result; - } - return __table31__; - } - - public Vector getTable31Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable32()); - result.add(getScrolledwindow2()); - return result; - } - - private JPanel __table32__ = null; - public JPanel getTable32(){ - if(__table32__ == null){ - Vector childs = getTable32Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table32__ = result; - } - return __table32__; - } - - public Vector getTable32Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel()); - result.add(getSumAnButton()); - result.add(getSumButton()); - return result; - } - - private JLabel __label__ = null; - public JLabel getLabel(){ - if(__label__ == null){ - JLabel result = new JLabel(_("isisfish.infoItem.label")); - - __label__ = result; - } - return __label__; - } - - private JToggleButton __sumAnButton__ = null; - public JToggleButton getSumAnButton(){ - if(__sumAnButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.common.sum")); - - __sumAnButton__ = result; - } - return __sumAnButton__; - } - - private JToggleButton __sumButton__ = null; - public JToggleButton getSumButton(){ - if(__sumButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.infoItem.sum")); - - __sumButton__ = result; - } - return __sumButton__; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getList()); - return result; - } - - private JList __list__ = null; - public JList getList(){ - if(__list__ == null){ - JList result = new JList(new DefaultListModel()); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - __list__ = result; - } - return __list__; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface InfoItemDateUICallback{ - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,242 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; - -public abstract class InfoItemUI extends JPanel implements InfoItemUICallback{ - - protected void init(){ - InfoItemUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getInfoItemChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String, ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getInfoItemChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable29()); - return result; - } - - private JPanel __table29__ = null; - public JPanel getTable29(){ - if(__table29__ == null){ - Vector childs = getTable29Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table29__ = result; - } - return __table29__; - } - - public Vector getTable29Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable30()); - result.add(getScrolledwindow1()); - return result; - } - - private JPanel __table30__ = null; - public JPanel getTable30(){ - if(__table30__ == null){ - Vector childs = getTable30Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table30__ = result; - } - return __table30__; - } - - public Vector getTable30Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel()); - result.add(getSumButton()); - return result; - } - - private JLabel __label__ = null; - public JLabel getLabel(){ - if(__label__ == null){ - JLabel result = new JLabel(_("isisfish.infoItem.label")); - - __label__ = result; - } - return __label__; - } - - private JToggleButton __sumButton__ = null; - public JToggleButton getSumButton(){ - if(__sumButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.common.sum")); - - __sumButton__ = result; - } - return __sumButton__; - } - - private JScrollPane __scrolledwindow1__ = null; - public JScrollPane getScrolledwindow1(){ - if(__scrolledwindow1__ == null){ - Vector childs = getScrolledwindow1Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow1__ = result; - } - return __scrolledwindow1__; - } - - public Vector getScrolledwindow1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getList()); - return result; - } - - private JList __list__ = null; - public JList getList(){ - if(__list__ == null){ - JList result = new JList(new DefaultListModel()); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - __list__ = result; - } - return __list__; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface InfoItemUICallback{ - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,54 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import javax.swing.*; - -/** - * InfoPanelable. - * - * Created: Mon Jun 3 18:58:09 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public interface InfoPanelable { - - public JLabel getLabel(); - public JList getList(); - public int getPosition(); - public void setPosition(int i); - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(); - -}// InfoPanelable Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,99 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.ImageObserver; + +import javax.swing.JComponent; + +/** + * TODO add comment here. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class LegendGraphic extends JComponent { + + /** serialVersionUID. */ + private static final long serialVersionUID = -4493919765232743572L; + + protected LegendModel model; + + /** + * Constructeur + */ + public LegendGraphic(LegendModel m) { + setModel(m); + } + + public void setModel(LegendModel m) { + this.model = m; + repaint(); + } + + /** + * Dessine sur le graphique la legende courante + */ + protected void redraw(Graphics g) { + //double coef = (double)getSize().width / (double)(model.getMax()-model.getMin()); + float coef = (float) getSize().width / 255f; + + int width = getSize().width; + int height = getSize().height; + + Image ImageBuffer = createImage(width, height); + Graphics tmpg = ImageBuffer.getGraphics(); + + int rgb; + for (int i = 0; i <= 255; i++) { + rgb = 255 - i; + tmpg.setColor(new Color(rgb, rgb, rgb)); + // tmpg.setColor(model.getLegendColor()); + tmpg.fillRect(Math.round((float) (i * coef)), 0, Math.round(coef), + height); + tmpg.drawRect(Math.round((float) (i * coef)), 0, Math.round(coef), + height); + } + + g.drawImage(ImageBuffer, 0, 0, getSize().width, getSize().height, + new ImageObserver() { + public boolean imageUpdate(Image img, int infoflags, int x, + int y, int width, int height) { + return true; + } + }); + } + + @Override + public void paint(Graphics g) { + redraw(g); + } + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -37,14 +37,14 @@ protected double min; protected double max; - - public LegendModel (){ - this(0,0); + + public LegendModel() { + this(0, 0); } - - public LegendModel (double min,double max){ - this.min = min; - this.max = max; + + public LegendModel(double min, double max) { + this.min = min; + this.max = max; } /** @@ -52,31 +52,31 @@ * @return value of min. */ public double getMin() { - return min; + return min; } - + /** * Set the value of min. * @param v Value to assign to min. */ - public void setMin(double v) { - this.min = v; + public void setMin(double v) { + this.min = v; } - + /** * Get the value of max. * @return value of max. */ public double getMax() { - return max; + return max; } - + /** * Set the value of max. * @param v Value to assign to max. */ - public void setMax(double v) { - this.max = v; + public void setMax(double v) { + this.max = v; } - + }// LegendModel Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,15 +25,10 @@ package fr.ifremer.isisfish.ui.result; -import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.image.ImageObserver; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; @@ -49,7 +44,7 @@ /** serialVersionUID */ private static final long serialVersionUID = -6803899655178581165L; - + private final static int DEFAULT_WIDTH = 110; private final static int DEFAULT_HEIGHT = 50; @@ -58,137 +53,77 @@ protected JLabel labelMax; protected JLabel labelMin; - - public LegendPanel (){ - this(null); + public LegendPanel() { + this(null); } - public LegendPanel(LegendModel model){ - this(model, DEFAULT_WIDTH, DEFAULT_HEIGHT); + public LegendPanel(LegendModel model) { + this(model, DEFAULT_WIDTH, DEFAULT_HEIGHT); } - public LegendPanel(LegendModel model, int width, int height){ - if(model == null) - model = new LegendModel(0,0); - this.model = model; + public LegendPanel(LegendModel model, int width, int height) { + if (model == null) { + model = new LegendModel(0, 0); + } + this.model = model; - setPreferredSize(new Dimension(width, height)); - this.setLayout(new GridBagLayout()); + setPreferredSize(new Dimension(width, height)); + this.setLayout(new GridBagLayout()); - graph = new LegendGraphic(this.model); - labelMin = new JLabel(Double.toString(model.getMin())); - labelMax = new JLabel(Double.toString(model.getMax())); - labelMin.setVisible(true); - labelMax.setVisible(true); - graph.setVisible(true); + graph = new LegendGraphic(this.model); + labelMin = new JLabel(Double.toString(model.getMin())); + labelMax = new JLabel(Double.toString(model.getMax())); + labelMin.setVisible(true); + labelMax.setVisible(true); + graph.setVisible(true); - GridBagConstraints c = null; + GridBagConstraints c = null; - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - this.add(labelMin,c); + c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + c.weightx = 0; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.HORIZONTAL; + this.add(labelMin, c); - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - this.add(graph,c); + c = new GridBagConstraints(); + c.gridx = 1; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.BOTH; + this.add(graph, c); - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - this.add(labelMax,c); + c = new GridBagConstraints(); + c.gridx = 2; + c.gridy = 0; + c.weightx = 0; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.HORIZONTAL; + this.add(labelMax, c); } - public LegendModel getModel(){ - return model; + public LegendModel getModel() { + return model; } - public void setModel(LegendModel model){ - this.model = model; - graph.setModel(model); - labelMin.setText(Double.toString(model.getMin())); - labelMax.setText(Double.toString(model.getMax())); + public void setModel(LegendModel model) { + this.model = model; + graph.setModel(model); + labelMin.setText(Double.toString(model.getMin())); + labelMax.setText(Double.toString(model.getMax())); } - public void setEnabled(boolean enable){ - graph.setEnabled(enable); - labelMin.setEnabled(enable); - labelMax.setEnabled(enable); + public void setEnabled(boolean enable) { + graph.setEnabled(enable); + labelMin.setEnabled(enable); + labelMax.setEnabled(enable); } }// LegendPanel - - -class LegendGraphic extends JComponent{ - - protected LegendModel model; - - /** - * Constructeur - */ - public LegendGraphic(LegendModel m){ - super(); - setModel(m); - } - - public void setModel(LegendModel m){ - this.model = m; - repaint(); - } - - /** - * Dessine sur le graphique la legende courante - */ - protected void redraw( Graphics g ){ - //double coef = (double)getSize().width / (double)(model.getMax()-model.getMin()); - float coef = (float)getSize().width / 255f; - - int width = getSize().width; - int height = getSize().height; - - Image ImageBuffer = createImage(width, height); - Graphics tmpg = ImageBuffer.getGraphics(); - - int rgb; - for (int i=0;i<=255;i++){ - rgb = 255-i; - tmpg.setColor(new Color(rgb,rgb,rgb)); - // tmpg.setColor(model.getLegendColor()); - tmpg.fillRect(Math.round((float)(i*coef)) , 0, - Math.round(coef) , height); - tmpg.drawRect(Math.round((float)(i*coef)) , 0, - Math.round(coef) , height); - } - - g.drawImage(ImageBuffer, 0, 0, getSize().width, getSize().height, - new ImageObserver(){ - public boolean imageUpdate( Image img, int infoflags, - int x, int y, - int width, int height ){ - return true; - } - }); - } - - /** - */ - public void paint( Graphics g ){ - redraw(g); - } - -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,52 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<Table> + <import> + static org.nuiton.i18n.I18n._ + </import> + <row> + <cell fill="horizontal"> + <com.bbn.openmap.gui.ToolPanel id="toolPanel" /> + </cell> + </row> + <row> + <cell fill="both" weightx="1" weighty="1"> + <fr.ifremer.isisfish.map.IsisMapBean id="isisMapBean" + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.NO_SELECTION}"/> + </cell> + </row> + <!-- <row> + <cell fill="horizontal"> + <com.bbn.openmap.InformationDelegator id="informationDelegator" + label='{_("isisfish.simpleResult.more.information")}' + map="{getIsisMapBean()}" showLights="false" /> + </cell> + </row> --> + <row> + <cell fill="horizontal"> + <LegendPanel id="legendPanel" /> + </cell> + </row> +</Table> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,123 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.MatrixException; -import fr.ifremer.isisfish.types.Date; -import javax.swing.table.AbstractTableModel; - -/** - * MatrixInfoTableModel. - * - * Created: Fri May 31 18:31:20 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class MatrixInfoTableModel extends AbstractTableModel { - - /** serialVersionUID */ - private static final long serialVersionUID = 2632133167225155487L; - - protected MatrixND matrix; - - public MatrixInfoTableModel (MatrixND mat){ - if (mat.getNbDim() > 2){ - throw new MatrixException("matrice with more than 2 dimension not supported."); - } - this.matrix = mat; - } - - /** - * @return Le nombre de lignes de la table. - */ - public int getRowCount() { - if (matrix == null || matrix.getNbDim() < 1){ - return 0; - }else{ - return matrix.getDim(0); - } - } - - /** - * @return Le nombre de colonnes de la table. - */ - public int getColumnCount() { - if (matrix == null || matrix.getNbDim() < 1){ - return 0; - }else{ - return matrix.getDim(1) + 1; - } - } - - /** - * @param row La ligne - * @param column La colonnes - * @return L'Object correspondant dans la matrice. - */ - public Object getValueAt(int row, int column) { - if (column == 0){ - Object obj = matrix.getSemantics(0).get(row); - if (obj instanceof Date){ - return ((Date)obj).getMonth().toString()+" "+((Date)obj).getYear(); - }else{ - return obj.toString(); - } - } - else { - if (matrix.getNbDim() == 1){ - return ""+matrix.getValue(column-1); - }else{ // mat.getNbDim() == 2 - return ""+matrix.getValue(row, column-1); - } - } - } - -// /** -// * @param obj L'objet a inserer dans la matrice. -// * @param row La ligne -// * @param column La colonnes -// */ -// public void setValueAt(Object obj, int row, int column) { -// } -// -// /** -// * Le modele est rendu editable. -// */ -// public boolean isCellEditable(int row, int column) { -// return false; -// } - - public String getColumnName(int column){ - if (column == 0){ - return matrix.getDimensionName(0)+"\\"+matrix.getDimensionName(1); - } - else{ - return ""+matrix.getSemantics(1).get(column-1); - } - } - -}// MatrixInfoTableModel Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,106 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.awt.Component; + +import javax.swing.Icon; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixRenderer; + +import com.bbn.openmap.gui.OMToolSet; +import com.bbn.openmap.gui.Tool; + +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.map.ResultatLayer; + +/** + * Result matrix viewer map renderer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MatrixMapRenderer implements MatrixRenderer { + + protected MapRendererUI mapRendererUI; + + public MatrixMapRenderer(FisheryRegion fisheryRegion) { + mapRendererUI = new MapRendererUI(); + + // Create the directional and zoom control tool + OMToolSet resultatMapOMTS = new OMToolSet(); + // Associate the tool with the map + resultatMapOMTS.setupListeners(mapRendererUI.getIsisMapBean()); + // Add the tool to the map toolbar + mapRendererUI.getToolPanel().add((Tool)resultatMapOMTS); + + //mapRendererUI.getInformationDelegator().setMap(getIsisMapBean()); + //mapRendererUI.getInformationDelegator().setShowLights(false); + //mapRendererUI.getInformationDelegator().setLabel(_("isisfish.simpleResult.more.information")); + + // set fishery region + mapRendererUI.getIsisMapBean().setFisheryRegion(fisheryRegion); + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getComponent(org.nuiton.math.matrix.MatrixND) + */ + @Override + public Component getComponent(MatrixND matrix) { + + ResultatLayer layer = new ResultatLayer(); + layer.setMatriceInfo(matrix); + mapRendererUI.getIsisMapBean().removeAllResultatLayer(); + + mapRendererUI.getIsisMapBean().addResultatLayer(matrix.getName(), layer); + mapRendererUI.getLegendPanel().setModel(new LegendModel(0,Math.round(layer.getDataMapList().getMaxDataMapValue()))); + // poussin 20060822 FIXME: migration vers v3, je ne sais pas comment ca merchait avant, la methode n'existe pas :( + // getInformationDelegator().addLayer(layer); + + return mapRendererUI; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getIcon() + */ + @Override + public Icon getIcon() { + return null; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getName() + */ + @Override + public String getName() { + return _("isisfish.result.map"); + } + +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,153 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +import java.awt.Component; +import java.util.Iterator; + +import javax.swing.Icon; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixRenderer; +import org.nuiton.topia.TopiaContext; + +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.simulator.SimulationParameter; +import fr.ifremer.isisfish.types.Date; + +/** + * Simulation summary renderer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MatrixSummaryRenderer implements MatrixRenderer { + + protected static final String ABONDANCE_STRING = n_("matrixAbundance"); + protected static final String CAPTUREPARMETIER_STRING = _("matrixCatchPerStrategyMetPerZoneMet"); + protected static final String REJETPARMETIER_STRING = _("matrixDiscardsPerStrMetPerZonePop"); + + protected SimulationStorage simulationStorage; + + protected ResultStorage resultStorage; + + protected TopiaContext topiaContext; + + protected Component cachedComponent; + + public MatrixSummaryRenderer(SimulationStorage simulationStorage, ResultStorage resultStorage, TopiaContext topiaContext) { + this.resultStorage = resultStorage; + this.simulationStorage = simulationStorage; + this.topiaContext = topiaContext; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getComponent(org.nuiton.math.matrix.MatrixND) + */ + @Override + public Component getComponent(MatrixND matrix) { + if (cachedComponent == null) { + + SimulationParameter sp = simulationStorage.getParameter(); + StringBuffer resume = new StringBuffer(sp.toString()); + resume.append("\n"); + + for(Iterator<String> i = resultStorage.getResultName().iterator(); i.hasNext();) { + String name = (String)i.next(); + try { + + // TODO EC20090717 ca marche plus ca + if (name.startsWith(ABONDANCE_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(new Date(0), name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.reduce(); + resume.append(_("isisfish.result.begin.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + + mat1 = resultStorage.getMatrix(resultStorage.getLastDate(), name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.reduce(); + resume.append(_("isisfish.result.end.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + } + /* + un peu long + else if(name.startsWith(REJETPARMETIER_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.sumOverDim(2); + mat1 = mat1.sumOverDim(3); + + mat1 = mat1.reduce(); + resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + } + else if (!name.startsWith(CAPTUREPARMETIER_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.sumOverDim(2); + + mat1 = mat1.reduce(); + resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + }*/ + } catch (Exception eee) { + resume.append(_("isisfish.error.no.matrix", name)); + } + } + + resume.append("\n\n"); + resume.append(simulationStorage.getInformation().toString()); + + cachedComponent = new JScrollPane(new JTextArea(resume.toString())); + } + + return cachedComponent; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getIcon() + */ + @Override + public Icon getIcon() { + return null; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getName() + */ + @Override + public String getName() { + return _("isisfish.result.summary"); + } +} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,71 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2005 - 2010 Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ - -/* * - * IsisFish.java - * - * Created: 1 aout 2005 18:37:25 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ - -package fr.ifremer.isisfish.ui.result; - -import fr.ifremer.isisfish.datastore.SimulationStorage; - -public class ResultAction { - SimulationStorage simulation; - public ResultAction(){ - - } - public void open(String name){ - simulation = SimulationStorage.getSimulation(name); - } - public SimulationStorage getSimulationStorage(){ - return simulation; - } -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,623 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/** -* ResultatEdit2.java -* -* Created: Wed Oct 23 2002 -* -* @author <poussin at codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import javax.swing.ButtonGroup; -import javax.swing.JList; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.topia.TopiaContext; -import org.nuiton.util.FileUtil; -import org.nuiton.util.Resource; - -import fr.ifremer.isisfish.datastore.ExportStorage; -import fr.ifremer.isisfish.datastore.ResultStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.export.Export; -import fr.ifremer.isisfish.map.ResultatLayer; -import fr.ifremer.isisfish.simulator.SimulationParameter; -import fr.ifremer.isisfish.types.Date; - -public class ResultEdit extends ResultEditUI { // ResultatEdit2 - - /** to use log facility, just put in your code: log.info("..."); */ - static private Log log = LogFactory.getLog(ResultEdit.class); - - static final String ABONDANCE_STRING = _("isisfish.result.abundance"); - static final String CAPTUREPARMETIER_STRING = _("isisfish.result.capture.metier"); - static final String REJETPARMETIER_STRING = _("isisfish.result.reject.metier"); - static final String DEBARQUEMENTPARMETIER_STRING = _("isisfish.result.unload.metier"); - static final String EFFORTPARMETIER_STRING = _("isisfish.result.stress.metier"); - static final String CAPTURE_STRING = _("isisfish.result.capture"); - - /** la simulation visualise */ - SimulationStorage simulation = null; - /** le ResultatManager de la simulation */ - ResultStorage resultManager = null; - - // Les diffrentes vu des resultats - DataResult dataBean; - SimpleResultatMapBean mapBean; - GraphBean graphBean; - ResumePanel resumeBean; - TopiaContext tx; - - /** les differents panel pour afficher les informations sur les - * dimensions des matrices des resultats */ - InfoPanelable[] infoItemTab = null; - - public ResultEdit(SimulationStorage simulation) { - setStatusOK(false); - init(); - initObjet(); - setSimulation(simulation); - setStatusOK(true); - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - if (this.tx != null) { - this.tx.closeContext(); - } - } - - private void initObjet(){ - getResultat().setEditable(false); - - mapBean = new SimpleResultatMapBean(); - graphBean = new GraphBean(); - graphBean.setModel(new GraphBeanModel()); - dataBean = new DataResult(); - resumeBean = new ResumePanel(); - - ButtonGroup group = new ButtonGroup(); - group.add(getMapRadioButton()); - group.add(getGraphRadioButton()); - group.add(getDonneeRadioButton()); - group.add(getResumeRadioButton()); - // getResumeRadioButton().setSelected(true); - - getAjoutRendu().setText(null); - getAjoutRendu().setIcon(Resource.getIcon("images/Right.gif")); - getAjoutRendu().setMargin(new Insets(0,0,0,0)); - getStatusImage().setMargin(new Insets(0,0,0,0)); - - getViewPanel().setLayout(new GridBagLayout()); - } - - void setStatusOK(boolean state) { - if (state){ - getStatusImage().setIcon(Resource.getIcon("images/BulbG.gif")); - }else{ - getStatusImage().setIcon(Resource.getIcon("images/BulbR.gif")); - } - getStatusImage().paintImmediately(0,0,25,25); - } - - /** - * Method updateInfoPanel permet de mettre a jour le - * infoItemTab. Le 0 contient les dates. - * - * @param group le group utilise pour mettre a jour le infoItemTab - * @return todo - */ - protected InfoPanelable [] createInfoPanel(MatrixND group) { - if (group == null){ - return new InfoPanelable[0]; - } - - InfoPanelable [] result = new InfoPanelable[group.getNbDim()]; - - // les dates sont toujours dans la dimension 0 - InfoItemDate infoItemDate = new InfoItemDate(); - infoItemDate.getList().setListData(group.getSemantics(0).toArray()); - result[0] = infoItemDate; - - for (int i=1; i < group.getNbDim(); i++) { - InfoItem item = new InfoItem(); - - // on affecte le nom - if (group.getDimensionName(i).equals("")){ - item.getLabel().setText(_("isisfish.result.dimension") + " " + i); - }else{ - item.getLabel().setText(_(group.getDimensionName(i))); - } - - List elems = group.getSemantics(i); - item.getList().setListData(elems.toArray()); - //?? item.setPosition(i); - result[i] = item; - } - - return result; - } - - void redrawInfoPanel(InfoPanelable[] infoItems){ - // Affichage dans le panel - getInfoPanel().removeAll(); - getInfoPanel().setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - for(int i=0; i<infoItems.length; i++){ - c.gridy = i; - getInfoPanel().add((Component)infoItems[i], c); - } - - - getScroll().invalidate(); - getScroll().validate(); - repaint(); - } - - /** - * Get the value of simulation. - * @return value of simulation. - */ - public SimulationStorage getSimulation() { - return simulation; - } - - /** - * Set the value of simulation. - * @param simulation Value to assign to simulation. - */ - public void setSimulation(SimulationStorage simulation) { - try { - this.simulation = simulation; - if (this.tx != null) { - this.tx.closeContext(); - } - this.tx = simulation.getStorage().beginTransaction(); - FisheryRegion region = SimulationStorage.getFisheryRegion(this.tx); - //FisheryRegion region = simulation.getFisheryRegion(); - - mapBean.setRegion(region); - - resultManager = simulation.getResultStorage(); - getResultat().removeAllItems(); - for(String item : resultManager.getResultName()){ - getResultat().addItem(item); - } - loadResume(simulation, resultManager); - } catch (Exception eee) { - log.warn("Can't change simulation storage", eee); - } - } - -// protected MatriceND reduire2D(MatriceND matrice){ -// int aGarder = 2; -// for (int j=0; j<matrice.getNbDim(); j++){ -// if (matrice.getDim(j) > 1 ) -// aGarder--; -// } -// -// int [] dimValid = new int[matrice.getNbDim()]; -// for (int j=0; j<matrice.getNbDim(); j++){ -// if (matrice.getDim(j) > 1 || aGarder > 0){ -// dimValid[j] = -1; -// if (matrice.getDim(j) <= 1) -// aGarder --; -// } -// else -// dimValid[j] = 0; -// } -// -//// reduction de la matrice -// return matrice.get(dimValid); -// } - - public void loadResume(SimulationStorage simulation, ResultStorage resultManager){ - SimulationParameter sp = simulation.getParameter(); - StringBuffer resume = new StringBuffer(sp.toString()); - resume.append("\n"); - - // TODO EC20090717 ca marche plus ca - // les results name ne commence plus par ABONDANCE_STRING... - for(Iterator i=resultManager.getResultName().iterator(); i.hasNext();){ - String name = (String)i.next(); - try { - - if (name.startsWith(ABONDANCE_STRING)){ - MatrixND mat1 = resultManager.getMatrix(new Date(0), name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.reduce(); - resume.append(_("isisfish.result.begin.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - - mat1 = resultManager.getMatrix(resultManager.getLastDate(), name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.reduce(); - resume.append(_("isisfish.result.end.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - else if(name.startsWith(REJETPARMETIER_STRING)){ - MatrixND mat1 = resultManager.getMatrix(name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.sumOverDim(2); - mat1 = mat1.sumOverDim(3); - - mat1 = mat1.reduce(); - resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - else if (!name.startsWith(CAPTUREPARMETIER_STRING) && name.startsWith(CAPTURE_STRING)){ - MatrixND mat1 = resultManager.getMatrix(name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.sumOverDim(2); - - mat1 = mat1.reduce(); - resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - } catch (Exception eee) { - resume.append(_("isisfish.error.no.matrix", name)); - } - } - - resume.append("\n\n"); - resume.append(simulation.getInformation().toString()); - - resumeBean.setResume(resume.toString()); - getResumeRadioButton().setSelected(true); - } - -// /** -// * Method groupResult permet de grouper les resultats par nom. -// * -// * @param simulation la simulation dont il faut grouper les resultats -// * @return une hash de ResultatGroup -// */ -// HashMap groupResult(Simulation simulation){ -// HashMap result = new HashMap(); -// -// LinkedList resultats = Resultat.xmlToVector(simulation.getResultat()); -// for (Iterator it = resultats.iterator(); it.hasNext();) { -// Resultat resultat = (Resultat)it.next(); -// String name = resultat.getName(); -// -//// stockage des resultats par type -// ResultatGroup group = (ResultatGroup)result.get(name); -// if (group == null) { -//// group = new ResultatGroup(dbSimulation); -// group = new ResultatGroup(dbManager); -// result.put(name, group); -// } -// group.add(resultat); -// } -// -// return result; -// } - - /** - * Method reduction permet de reduire la matrice en fonction des - * selections de l'utilisateur dans l'interface. - * - * @param matrix todo - * - * @param infoItems todo - * @return todo - */ - protected MatrixND createAndReduce(MatrixND matrix, InfoPanelable [] infoItems){ - - // Reduit la matrice en fonction des choix de l utilisateur - // dans les autres InfoItem recuperation des autres elements - // selectionnees. - for (int i = 0; i < infoItems.length; i++) { - InfoPanelable item = infoItems[i]; - JList list = item.getList(); - int [] indList = list.getSelectedIndices(); - - if (indList.length == 0){ - // si rien n'est selectionné on selection tout - list.setSelectionInterval(0, - list.getModel().getSize()-1); - indList = list.getSelectedIndices(); - } - - log.debug("matrice avant submatrice de la dim "+i+" :"+matrix); - - if (0 < indList.length && indList.length < matrix.getDim(i)){ - matrix = matrix.getSubMatrix(i, indList); - } - - log.debug("matrice apres submatrice de la dim "+i+" :"+matrix); - - if (item.getSumStep() != 1) { - // on somme - matrix = matrix.sumOverDim(i, item.getSumStep()); - if(matrix.getDim(i) == 1){ - // c une somme global sur tous les elements - matrix.setDimensionName(i, _("isisfish.common.sum")); - }else{ - // c une somme partielle - String name = matrix.getDimensionName(i)+" "+ - _("isisfish.common.sum"); - - //si c une somme pour les annees, on change l'intitule - if (item instanceof InfoItemDate){ - name = _("isisfish.common.year"); - } - - matrix.setDimensionName(i, name); - } - - // #1905 : modifie les semantiques de type Date pour que lorsque - // c'est par exemple une somme par année - // les semantique se nomment - // janvier 0, janvier 1... - // plutot que - // janvier 0, fevrier 0... - Object sem = matrix.getSemantics(i); - if (sem instanceof List) { - List<Object> semList = (List<Object>)sem; - List<Object> newList = new ArrayList<Object>(); - for (int index = 0 ; index < semList.size(); ++index) { - Object semObject = semList.get(index); - if (semObject instanceof Date) { - Date semDate = (Date)semObject; - Date newDate = new Date(semDate.getDate() * item.getSumStep()); - newList.add(newDate); - } - else { - newList.add(semObject); - } - } - matrix.setSemantics(i, newList); - } - // end semantics modification - } - log.debug("matrice apres sum de la dim "+i+" :"+matrix); - } - - log.debug("Matrice avant le reduce: " + matrix); - - // arrive ici on a une matrice qui a des tailles de dimension 1 - // et un tableau des legende pour chaque dimension - - // il faut que la matrice est 2 dimensions - // reduction de la matrice - MatrixND result = matrix.reduce(2); - - return result; - } - - public void addRendu(MatrixND matrix, InfoPanelable [] infoItems){ - setStatusOK(false); - - log.debug("La matrice avant réduction est: " + matrix); - - // recuperation de la matriceInfo - MatrixND matInfo = createAndReduce(matrix, infoItems); - - log.debug("La matrice après réduction est: " + matInfo); - - if (matInfo.getNbDim() > 2) { - // matrice superieur a 2 dimensions non geree!! - JOptionPane.showMessageDialog(null, _("isisfish.error.matrix.more.2d"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - return; - } - - // ajout a la carte - // On ajoute a la carte que si on le peut - if (matInfo.getNbDim() == 2){ - try{ - ResultatLayer layer = new ResultatLayer(); - layer.setMatriceInfo(matInfo); - mapBean.removeAllResultatLayer(); - mapBean.addResultatLayer(matInfo.getName(), layer); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat à la carte. ", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.card"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - } - - // ajout au graph - try{ - graphBean.getModel().setMatrix(matInfo); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat au graph.", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.result.graph"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - - // ajout au data - try{ - dataBean.setMatrix(matInfo); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat au data.", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.result.data"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - - setStatusOK(true); - } - - public void on_ajoutRendu_clicked(){ - String resultName = (String)getResultat().getSelectedItem(); - if (resultName != null) { - // si on etait sur le resume on se met automatiquement sur le graph - if (getViewPanel().getComponentCount() == 1 && - getViewPanel().getComponent(0) == resumeBean){ - graphBean.getGraphSplitPane().setDividerLocation(1.0); - getGraphRadioButton().setSelected(true); - } - // on ajoute de rendu - addRendu(resultManager.getMatrix(resultName, tx), infoItemTab); - } - } - - public void on_resultat_selection_notify_event(ItemEvent e){ - if(e.getStateChange() == ItemEvent.SELECTED){ - String resultName = (String)e.getItem(); - MatrixND matrix = resultManager.getMatrix(resultName, tx); - infoItemTab = createInfoPanel(matrix); - redrawInfoPanel(infoItemTab); - } - } - - public void on_graphRadioButton_toggled(ChangeEvent e){ - if (getGraphRadioButton().isSelected()){ - graphBean.getGraphSplitPane().setDividerLocation(1.0); - setViewBean(graphBean); - } - } - - public void on_mapRadioButton_toggled(ChangeEvent e){ - if (getMapRadioButton().isSelected()) - setViewBean(mapBean); - } - - public void on_donneeRadioButton_toggled(ChangeEvent e){ - if (getDonneeRadioButton().isSelected()) - setViewBean(dataBean); - } - - public void on_resumeRadioButton_toggled(ChangeEvent e){ - if (getResumeRadioButton().isSelected()) - setViewBean(resumeBean); - } - - /** - * Method setViewBean modifie le bean visible. - * - * @param bean le bean qui doit devenir visible - */ - public void setViewBean(JPanel bean){ - setStatusOK(false); - - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - - getViewPanel().removeAll(); - getViewPanel().add(bean,c); - getViewPanel().invalidate(); - getViewPanel().validate(); - getViewPanel().repaint(); - graphBean.getGraphSplitPane().setDividerLocation(1.0); - setStatusOK(true); - } - - ////////////////////////////////////////////////////////////////////// - /// Menu Export /// - ////////////////////////////////////////////////////////////////////// - - - /** - * Surcharge de la method getMenuExport_menuChilds pour ajouter - * les methods que l'on trouve dans les scripts de l'objet Export. - */ - public Vector getMenuExport_menuChilds(){ - Vector<JMenuItem> result = new Vector<JMenuItem>(); - for (String name : ExportStorage.getExportNames()) { - JMenuItem item = getExportMenu(name); - result.add(item); - } - return result; - } - - /** - * Retourne l'item de menu qui permet l'appelle de la method du code - * ECMAScript d'export. - * @param methodName todo - * @return todo - */ - protected JMenuItem getExportMenu(String methodName){ - JMenuItem result = new JMenuItem(_(methodName)); - result.addActionListener(new ExportActionListener(methodName)); - return result; - } - - - protected class ExportActionListener implements ActionListener{ - private String name; - public ExportActionListener(String name){ - this.name = name; - } - public void actionPerformed(ActionEvent e){ - try{ - File file = FileUtil.getFile(".+.txt", _("isisfish.result.export.file")); - if(file != null){ - Writer out = new BufferedWriter(new FileWriter(file)); - ExportStorage storage = ExportStorage.getExport(name); - Export export = storage.getNewExportInstance(); - export.export(simulation, out); - out.close(); - } - }catch(Exception eee){ - log.warn("Erreur lors de l'export ", eee); - } - } - } - -} // ResultatEdit2 Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,696 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JInternalFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSplitPane; -import javax.swing.JViewport; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -public abstract class ResultEditUI extends JInternalFrame implements ResultEditUICallback{ - - public ResultEditUI(){ - super(_("isisfish.result.title")); - } - - protected void init(){ - ResultEditUI result = this; - this.getContentPane().setLayout(new BorderLayout()); - Vector childs = getResultatEditChilds(); - if(childs.size() >= 1) - result.getContentPane().add((Component)childs.get(0), - BorderLayout.CENTER); - - this.setJMenuBar(getMenubar2()); - this.pack(); - - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getResultatEditChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getVbox2()); - return result; - } - - private Box __vbox2__ = null; - public Box getVbox2(){ - if(__vbox2__ == null){ - Vector childs = getVbox2Childs(); - Box result = Box.createVerticalBox(); - for (Object child : childs) result.add((Component) child); - - __vbox2__ = result; - } - return __vbox2__; - } - - public Vector getVbox2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable23()); - return result; - } - - private JMenuBar __menubar2__ = null; - public JMenuBar getMenubar2(){ - if(__menubar2__ == null){ - Vector childs = getMenubar2Childs(); - JMenuBar result = new JMenuBar(); - for (Object child : childs) result.add((JMenuItem) child); - - __menubar2__ = result; - } - return __menubar2__; - } - - public Vector getMenubar2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMenuExport()); - return result; - } - - private JMenu __menuExport__ = null; - public JMenu getMenuExport(){ - if(__menuExport__ == null){ - Vector childs = getMenuExport_menuChilds(); - JMenu result = new JMenu(_("isisfish.result.export")); - for (Object child : childs) result.add((Component) child); - - __menuExport__ = result; - } - return __menuExport__; - } - - public Vector getMenuExport_menuChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMenuitem6()); - return result; - } - - private JSeparator __menuitem6__ = null; - public JSeparator getMenuitem6(){ - if(__menuitem6__ == null){ - JSeparator result = new JSeparator(); - - __menuitem6__ = result; - } - return __menuitem6__; - } - - private JPanel __table23__ = null; - public JPanel getTable23(){ - if(__table23__ == null){ - Vector childs = getTable23Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table23__ = result; - } - return __table23__; - } - - public Vector getTable23Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable22()); - result.add(getHpaned2()); - return result; - } - - private JPanel __table22__ = null; - public JPanel getTable22(){ - if(__table22__ == null){ - Vector childs = getTable22Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table22__ = result; - } - return __table22__; - } - - public Vector getTable22Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getStatusImage()); - result.add(getStatusbar1()); - return result; - } - - private JButton __statusImage__ = null; - public JButton getStatusImage(){ - if(__statusImage__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.blank"), icon); - - __statusImage__ = result; - } - return __statusImage__; - } - - private JLabel __statusbar1__ = null; - public JLabel getStatusbar1(){ - if(__statusbar1__ == null){ - JLabel result = new JLabel(_("isisfish.result.statusBar")); - - __statusbar1__ = result; - } - return __statusbar1__; - } - - private JSplitPane __hpaned2__ = null; - public JSplitPane getHpaned2(){ - if(__hpaned2__ == null){ - Vector childs = getHpaned2Childs(); - Component child1 = null; - Component child2 = null; - if(childs.size() >= 1) - child1 = (Component)childs.get(0); - if(childs.size() >= 2) - child2 = (Component)childs.get(1); - - JSplitPane result = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - child1, child2); - result.setOneTouchExpandable(true); - result.setDividerSize(10); - - __hpaned2__ = result; - } - return __hpaned2__; - } - - public Vector getHpaned2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable1()); - result.add(getTable25()); - return result; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable7()); - result.add(getResultat()); - return result; - } - - private JPanel __table7__ = null; - public JPanel getTable7(){ - if(__table7__ == null){ - Vector childs = getTable7Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table7__ = result; - } - return __table7__; - } - - public Vector getTable7Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable8()); - result.add(getScroll()); - return result; - } - - private JPanel __table8__ = null; - public JPanel getTable8(){ - if(__table8__ == null){ - Vector childs = getTable8Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table8__ = result; - } - return __table8__; - } - - public Vector getTable8Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getAjoutRendu()); - return result; - } - - private JButton __ajoutRendu__ = null; - public JButton getAjoutRendu(){ - if(__ajoutRendu__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.add.short"), icon); - result.setToolTipText(_("isisfish.result.add")); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_ajoutRendu_clicked(); - } - }); - - __ajoutRendu__ = result; - } - return __ajoutRendu__; - } - - private JScrollPane __scroll__ = null; - public JScrollPane getScroll(){ - if(__scroll__ == null){ - Vector childs = getScrollChilds(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scroll__ = result; - } - return __scroll__; - } - - public Vector getScrollChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getInfoPanel()); - return result; - } - - private JPanel __infoPanel__ = null; - public JPanel getInfoPanel(){ - if(__infoPanel__ == null){ - Vector childs = getInfoPanelChilds(); - GridBagConstraints [] cs; - cs = new GridBagConstraints[childs.size()]; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __infoPanel__ = result; - } - return __infoPanel__; - } - - public Vector getInfoPanelChilds(){ - Vector<Object> result; - result = new Vector<Object>(); - return result; - } - - private JComboBox __resultat__ = null; - public JComboBox getResultat(){ - if(__resultat__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_resultat_selection_notify_event(e); - } - }); - - __resultat__ = result; - } - return __resultat__; - } - - private JPanel __table25__ = null; - public JPanel getTable25(){ - if(__table25__ == null){ - Vector childs = getTable25Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table25__ = result; - } - return __table25__; - } - - public Vector getTable25Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getViewPanel()); - result.add(getTable26()); - return result; - } - - private javax.swing.JPanel __viewPanel__ = null; - public javax.swing.JPanel getViewPanel(){ - if(__viewPanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __viewPanel__ = result; - } - return __viewPanel__; - } - - private JPanel __table26__ = null; - public JPanel getTable26(){ - if(__table26__ == null){ - Vector childs = getTable26Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 3; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[3] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table26__ = result; - } - return __table26__; - } - - public Vector getTable26Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphRadioButton()); - result.add(getMapRadioButton()); - result.add(getDonneeRadioButton()); - result.add(getResumeRadioButton()); - return result; - } - - private JRadioButton __graphRadioButton__ = null; - public JRadioButton getGraphRadioButton(){ - if(__graphRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.graph"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_graphRadioButton_toggled(e); - } - }); - - __graphRadioButton__ = result; - } - return __graphRadioButton__; - } - - private JRadioButton __mapRadioButton__ = null; - public JRadioButton getMapRadioButton(){ - if(__mapRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.map"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_mapRadioButton_toggled(e); - } - }); - - __mapRadioButton__ = result; - } - return __mapRadioButton__; - } - - private JRadioButton __donneeRadioButton__ = null; - public JRadioButton getDonneeRadioButton(){ - if(__donneeRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.datas"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_donneeRadioButton_toggled(e); - } - }); - - __donneeRadioButton__ = result; - } - return __donneeRadioButton__; - } - - private JRadioButton __resumeRadioButton__ = null; - public JRadioButton getResumeRadioButton(){ - if(__resumeRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.summary"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_resumeRadioButton_toggled(e); - } - }); - - __resumeRadioButton__ = result; - } - return __resumeRadioButton__; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,48 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/** - * ResultEditUICallback - * - * Generated: Thu Jul 27 22:04:42 CEST 2006 - * By GGen Copyright Code Lutin - * http://www.codelutin.com - * - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -import javax.swing.event.ChangeEvent; - -public interface ResultEditUICallback{ - - public void on_ajoutRendu_clicked(); - public void on_resultat_selection_notify_event(ItemEvent e); - public void on_graphRadioButton_toggled(ChangeEvent e); - public void on_mapRadioButton_toggled(ChangeEvent e); - public void on_donneeRadioButton_toggled(ChangeEvent e); - public void on_resumeRadioButton_toggled(ChangeEvent e); -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,267 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.beans.PropertyVetoException; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.Writer; + +import javax.swing.JMenuItem; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixViewerPanel; +import org.nuiton.math.matrix.viewer.renderer.MatrixChartRenderer; +import org.nuiton.math.matrix.viewer.renderer.MatrixPanelRenderer; +import org.nuiton.topia.TopiaException; +import org.nuiton.util.FileUtil; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.datastore.ExportStorage; +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageException; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.logging.SimulationLoggerUtil; +import fr.ifremer.isisfish.simulator.launcher.SimulationJob; +import fr.ifremer.isisfish.simulator.launcher.SimulationService; +import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; +import fr.ifremer.isisfish.ui.CommonHandler; +import fr.ifremer.isisfish.ui.models.common.StringComboModel; +import fr.ifremer.isisfish.ui.models.common.StringListModel; + +/** + * Handler for result UIs. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ResultHandler extends CommonHandler { + + private static Log log = LogFactory.getLog(ResultHandler.class); + + protected SimulationServiceListener listener = null; + + /** + * Initialise la vue avec les liste des simulations disponible. + * + * @param resultUI + */ + public void init(final ResultUI resultUI) { + initSimulationList(resultUI); + + // reference must stay allocated + listener = new SimulationServiceListener() { + @Override + public void simulationStart(SimulationService simService, SimulationJob job) { + } + @Override + public void simulationStop(SimulationService simService, SimulationJob job) { + initSimulationList(resultUI); + } + @Override + public void clearJobDone(SimulationService simService) { + } + }; + SimulationService.getService().addSimulationServiceListener(listener); + } + + /** + * Reload simulation combo box model. + * + * @param resultUI resultUI + */ + protected void initSimulationList(ResultUI resultUI) { + java.util.List<String> value = SimulationStorage.getSimulationNames(); + + resultUI.getSimulationComboBox().setEditable(false); + StringComboModel model = new StringComboModel(value); + resultUI.getSimulationComboBox().setModel(model); + resultUI.getSimulationComboBox().setSelectedItem(null); + } + + /** + * Open selected simulation item in new internal frame. + * + * @param resultUI resultUI + */ + public void openNewSimulation(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + SimulationStorage simulation = SimulationStorage.getSimulation(selected); + + ResultSimulationFrame internalFrame = new ResultSimulationFrame(resultUI); + internalFrame.setTitle(simulation.getName()); + internalFrame.setSimulationStorage(simulation); + init(internalFrame); + internalFrame.setSize(800, 600); + resultUI.getSimulationDesktopPane().add(internalFrame); + try { + internalFrame.setSelected(true); + } catch (PropertyVetoException ex) { + if (log.isWarnEnabled()) { + log.warn("Can't auto selected internal frame", ex); + } + } + } + + /** + * Delete selected simulation. + * + * @param resultUI resultUI + */ + public void deleteSimulation(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + SimulationStorage simulation = SimulationStorage.getSimulation(selected); + try { + simulation.delete(false); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't delete simulation", ex); + } + initSimulationList(resultUI); + } + + /** + * Display simulation log. + * + * @param resultUI resultUI + */ + public void showLog(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + try { + SimulationLoggerUtil.showSimulationLogConsole(selected); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display simulation log", ex); + } + } + + /** + * Init ResultSimulationFrame. + * + * @param resultSimulationFrame resultSimulationFrame + */ + public void init(final ResultSimulationFrame resultSimulationFrame) { + SimulationStorage simulation = resultSimulationFrame.getSimulationStorage(); + try { + // init menu + for (String exportName : ExportStorage.getExportNames()) { + JMenuItem item = new JMenuItem(_(exportName)); + item.addActionListener(new ExportActionListener(simulation, exportName)); + resultSimulationFrame.getExportMenu().add(item); + } + + resultSimulationFrame.topiaContext = simulation.getStorage().beginTransaction(); + final ResultStorage resultStorage = simulation.getResultStorage(); + FisheryRegion fisheryRegion = SimulationStorage.getFisheryRegion(resultSimulationFrame.topiaContext); + + // init viewer panel + final MatrixViewerPanel matrixViewerPanel = new MatrixViewerPanel(); + matrixViewerPanel.addMatrixDimentionAction(new YearSumDimensionAction()); + matrixViewerPanel.addMatrixRenderer(new MatrixSummaryRenderer(simulation, resultStorage, resultSimulationFrame.topiaContext), true); + matrixViewerPanel.addMatrixRenderer(new MatrixChartRenderer()); + matrixViewerPanel.addMatrixRenderer(new MatrixMapRenderer(fisheryRegion)); + matrixViewerPanel.addMatrixRenderer(new MatrixPanelRenderer()); + matrixViewerPanel.addMatrixFilter(new ResultMatrixFilter(resultStorage)); + + // init available results list + StringComboModel model = new StringComboModel(resultStorage.getResultName()); + resultSimulationFrame.getResultsComboBox().setModel(model); + resultSimulationFrame.getResultsComboBox().addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + String selectedMatrixName = (String)e.getItem(); + MatrixND matrix = resultStorage.getMatrix(selectedMatrixName, resultSimulationFrame.topiaContext); + matrixViewerPanel.setMatrix(matrix); + System.out.println("adding matrix"); + } + } + }); + + // force summary display + matrixViewerPanel.updateSelectedRenderingComponent(); + resultSimulationFrame.getMatrixViewerContainer().add(matrixViewerPanel, BorderLayout.CENTER); + + if (model.getSize() > 0) { + model.setSelectedItem(model.getElementAt(0)); + } + } catch (TopiaException ex) { + throw new IsisFishRuntimeException("Can't open simulation", ex); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't open simulation", ex); + } + } + + protected class ExportActionListener implements ActionListener { + + protected SimulationStorage simulationStorage; + + protected String exportName; + + public ExportActionListener(SimulationStorage simulationStorage, String exportName) { + this.simulationStorage = simulationStorage; + this.exportName = exportName; + } + + public void actionPerformed(ActionEvent e) { + try { + File file = FileUtil.getFile(".+\\.csv", _("isisfish.result.export.file")); + // add csv extension if not set + if (!file.getName().endsWith(".csv")) { + file = new File(file.getAbsolutePath() + ".csv"); + } + if (file != null) { + Writer out = null; + try { + out = new BufferedWriter(new FileWriter(file)); + ExportStorage storage = ExportStorage.getExport(exportName); + Export export = storage.getNewExportInstance(); + export.export(simulationStorage, out); + } + finally { + IOUtils.closeQuietly(out); + } + } + } catch(Exception eee) { + if (log.isWarnEnabled()) { + log.warn("Erreur lors de l'export ", eee); + } + } + } + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,100 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.util.ArrayList; +import java.util.List; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixFilter; + +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.types.Date; + +/** + * Filtre qui ajoute les trou dans les données (valeur intermédiares absentes) + * et qui supprime les bornes sans valeures ensuite. + * + * Modifie egalement le titre de la matrice. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ResultMatrixFilter implements MatrixFilter { + + protected ResultStorage resultStorage; + + public ResultMatrixFilter(ResultStorage resultStorage) { + this.resultStorage = resultStorage; + } + + @Override + public MatrixND filter(MatrixND matrix) { + return matrix; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixFilter#filterDimension(org.nuiton.math.matrix.MatrixND, int, int) + */ + @Override + public MatrixND filterDimension(MatrixND matrix, int dim, int sumStep) { + + if (dim == 0 && sumStep == 12) { + // si c une somme pour les annees, on change l'intitule + matrix.setDimensionName(0, _("isisfish.common.year")); + } + + // #1905 : modifie les semantiques de type Date pour que lorsque + // c'est par exemple une somme par année + // les semantique se nomment + // janvier 0, janvier 1... + // plutot que + // janvier 0, fevrier 0... + if (dim == 0) { + List sem = matrix.getSemantic(dim); + List<Object> semList = (List<Object>)sem; + List<Object> newList = new ArrayList<Object>(); + for (int index = 0 ; index < semList.size(); ++index) { + Object semObject = semList.get(index); + if (semObject instanceof Date) { + Date semDate = (Date)semObject; + Date newDate = new Date(semDate.getDate() * sumStep); + newList.add(newDate); + } + else { + newList.add(semObject); + } + } + matrix.setSemantic(dim, newList); + } + // end semantics modification */ + + return matrix; + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,58 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JInternalFrame resizable="true" iconifiable="true" maximizable="true" closable="true"> + + <script><![CDATA[ + @Override + protected void finalize() throws Throwable { + super.finalize(); + if (topiaContext != null) { + topiaContext.closeContext(); + } + } + ]]></script> + + <ResultHandler id="handler"/> + + <fr.ifremer.isisfish.datastore.SimulationStorage id="simulationStorage" javaBean="null"/> + <fr.ifremer.isisfish.entities.FisheryRegion id="fisheryRegion" javaBean="null"/> + <org.nuiton.topia.TopiaContext id="topiaContext" javaBean="null"/> + + <JMenuBar> + <JMenu id="exportMenu" text="isisfish.result.export" /> + </JMenuBar> + + <Table> + <row> + <cell><JLabel text="isisfish.result.selectResult" /></cell> + <cell fill="horizontal" weightx="1"><JComboBox id="resultsComboBox" /></cell> + </row> + <row> + <cell fill="both" weightx="1" weighty="1" columns="2"> + <JPanel id="matrixViewerContainer" layout="{new BorderLayout()}"/> + </cell> + </row> + </Table> +</JInternalFrame> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,62 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JPanel layout='{new BorderLayout()}'> + + <ResultHandler id="handler" /> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + getHandler().init(this); + } + ]]></script> + <Table constraints="BorderLayout.NORTH"> + <row> + <cell> + <JLabel text="isisfish.result.choose.simulation"/> + </cell> + <cell fill="horizontal" weightx="1"> + <JComboBox id="simulationComboBox"/> + </cell> + <cell> + <JButton text="isisfish.result.new.window" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().openNewSimulation(this)"/> + </cell> + <cell> + <JButton text="isisfish.result.remove.simulation" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().deleteSimulation(this)"/> + </cell> + <cell> + <JButton text="isisfish.result.show.simulation.log" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().showLog(this)"/> + </cell> + </row> + </Table> + + <JDesktopPane id="simulationDesktopPane" constraints="BorderLayout.CENTER" /> + +</JPanel> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,222 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -/** -* ResultView.java -* -* -* Created: Thu May 30 15:48:00 2002 -* -* @author <a href="mailto:seb.regnier at free.fr"></a> -* @version -*/ - -import static org.nuiton.i18n.I18n._; - -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.logging.SimulationLoggerUtil; -import fr.ifremer.isisfish.simulator.SimulationProperties; -import fr.ifremer.isisfish.simulator.launcher.SimulationJob; -import fr.ifremer.isisfish.simulator.launcher.SimulationService; -import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; -import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; -import fr.ifremer.isisfish.ui.util.ErrorHelper; -import fr.ifremer.isisfish.ui.widget.filter.FilterModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ItemEvent; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.text.ParseException; -import java.util.List; - -public class ResultView extends ResultViewUI { - - /** to use log facility, just put in your code: log.info("..."); */ - static private Log log = LogFactory.getLog(ResultView.class); - private FilterModel<SimulationProperties, String> filterModel; - private DefaultComboBoxModel model; - - /* - * FIXME this code reload ALL simulation (too long) - */ - SimulationServiceListener listener = new SimulationServiceListener() { - - @Override - public void simulationStart(SimulationService simService, SimulationJob job) { - } - - @Override - public void simulationStop(SimulationService simService, SimulationJob job) { - try { - initSimulation(); - } catch (IOException ex) { - log.error(ex); - } catch (ParseException ex) { - log.error(ex); - } - } - - @Override - public void clearJobDone(SimulationService simService) { - } - }; - - public ResultView (){ - super(); - SimulationService.getService().addSimulationServiceListener(listener); - init(); - try { - initSimulation(); - } catch (Exception e) { - if (log.isWarnEnabled()) { - log.warn(_("could not create simulation filter model for reason %1$s", e.getMessage()),e); - } - ErrorHelper.showErrorDialog(_("could not create simulation filter model for reason %1$s", e.getMessage()), e); - } - } - - private void initSimulation() throws IOException, ParseException { - // keep in context list of old simulation names (for filter process) - java.util.List<String> value = SimulationStorage.getSimulationNames(); - - // TODO filering disabled since it's read all simulation - // TODO can take more than 20m with a lot of simulations... - - // create filter model - //filterModel = SimulationFilterUtil.createFilterModel(value); - // to used directly model.getFilteredResult() in xml - // we must fill filterModel result with original items - //filterModel.selectAll(); - - getSimulation().setEditable(false); - model = new DefaultComboBoxModel(value.toArray()); - getSimulation().setModel(model); - getSimulation().setSelectedItem(null); - } - - public void on_Resultat_destroy_event(){ -// dispose(); - } - - public void on_simulation_selection_notify_event(ItemEvent e){ - // setSelectedSimulation((Simulation)getSimulation().getSelectedItem()); - } - - /* - * Get the value of selectedSimulation. - * @return value of selectedSimulation. - * - public Simulation getSelectedSimulation() { - return selectedSimulation; - }*/ - - /* - * Set the value of selectedSimulation. - * @param v Value to assign to selectedSimulation. - * - public void setSelectedSimulation(Simulation v) { - this.selectedSimulation = v; - }*/ - - public void on_supprimerSimulationButton_clicked(){ - String name = (String)getSimulation().getSelectedItem(); - if (name != null){ - SimulationStorage storage = SimulationStorage.getSimulation(name); - try { - storage.delete(false); - initSimulation(); - } catch (Exception eee) { - if (log.isWarnEnabled()) { - log.warn("Can't delete simulation", eee); - } - ErrorHelper.showErrorDialog(_("Can't delete simulation"), eee); - } - } - } - - public void on_openWindowButton_clicked(){ - String name = (String)getSimulation().getSelectedItem(); - if (name != null){ - SimulationStorage simulation = SimulationStorage.getSimulation(name); - - ResultEdit resEdit = new ResultEdit(simulation); - JInternalFrame intFrame = - new JInternalFrame(simulation.getName(), - true, //resizable - true, //closable - true, //maximizable - true);//iconifiable - intFrame.setContentPane(resEdit.getRootPane()); - intFrame.setVisible(true); - // intFrame.pack(); - intFrame.setSize(new Dimension(800,700)); - getDesktopPane().add(intFrame); - try { - intFrame.setSelected(true); - } catch (PropertyVetoException eee) { - if (log.isWarnEnabled()) { - log.warn("Error dans l internalFrame ", eee); - } - ErrorHelper.showErrorDialog(_("Can't open simulation internal frame"), eee); - } - } - } - - public void on_voirSimulationLogButton_clicked() { - String name = (String)getSimulation().getSelectedItem(); - - try { - SimulationLoggerUtil.showSimulationLogConsole(name); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error(_("Can't display simulation log"), e); - } - ErrorHelper.showErrorDialog(_("Can't display simulation log"), e); - } - } - public void on_filterSimulationLogButton_clicked() { - - try { - List<String> result = SimulationFilterUtil.filterSimulation(filterModel); - - model.removeAllElements(); - for (String s : result) { - model.addElement(s); - } - } catch (Exception e) { - if (log.isWarnEnabled()) { - log.warn(_("could not filter on simulations"), e); - } - ErrorHelper.showErrorDialog(_("could not filter on simulations"), e); - } - } - -}// ResultView Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,391 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -public abstract class ResultViewUI extends JPanel implements ResultViewUICallback{ - - public ResultViewUI(){ -// super(_("isisfish.result.title")); - } - - protected void init(){ - ResultViewUI result = this; -// this.getContentPane().setLayout(new BorderLayout()); - this.setLayout(new BorderLayout()); - Vector childs = getResultatViewChilds(); - if(childs.size() >= 1) -// result.getContentPane().add((Component)childs.get(0), BorderLayout.CENTER); - result.add((Component)childs.get(0), BorderLayout.CENTER); - -// TODO : MENUS - -// this.add(getMenubar1()); -// result.addWindowListener(new WindowAdapter(){ -// public void windowClosing(WindowEvent e){ -// on_Resultat_destroy_event(); -// } -// }); - - result.setBounds(10,10,640,480); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b todo - * @param groupName todo - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector<JComponent> getResultatViewChilds(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getVbox1()); - return result; - } - - private Box __vbox1__ = null; - public Box getVbox1(){ - if(__vbox1__ == null){ - Vector childs = getVbox1Childs(); - Box result = Box.createVerticalBox(); - for (Object child : childs) { - result.add((Component) child); - } - - __vbox1__ = result; - } - return __vbox1__; - } - - public Vector<JComponent> getVbox1Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getTable33()); - return result; - } - - private JMenuBar __menubar1__ = null; - public JMenuBar getMenubar1(){ - if(__menubar1__ == null){ - Vector childs = getMenubar1Childs(); - JMenuBar result = new JMenuBar(); - for (Object child : childs) { - result.add((JMenuItem) child); - } - - __menubar1__ = result; - } - return __menubar1__; - } - - public Vector<JComponent> getMenubar1Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getMenuitem1()); - return result; - } - - private JMenu __menuitem1__ = null; - public JMenu getMenuitem1(){ - if(__menuitem1__ == null){ - Vector childs = getMenuitem1_menuChilds(); - JMenu result = new JMenu(_("isisfish.result.file")); - for (Object child : childs) { - result.add((Component) child); - } - - __menuitem1__ = result; - } - return __menuitem1__; - } - - public Vector<JComponent> getMenuitem1_menuChilds(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getMenuitem2()); - return result; - } - - private JMenuItem __menuitem2__ = null; - public JMenuItem getMenuitem2(){ - if(__menuitem2__ == null){ - ImageIcon icon = null; - - JMenuItem result = new JMenuItem(_("isisfish.result.quit"), icon); - - result.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e){ - on_Resultat_destroy_event(); - } - }); - - __menuitem2__ = result; - } - return __menuitem2__; - } - - private JPanel __table33__ = null; - public JPanel getTable33(){ - if(__table33__ == null){ - Vector<JComponent> childs = getTable33Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 10; - c.gridwidth = 6; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[3] = c; - - c = new GridBagConstraints(); - c.gridx = 3; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[4] = c; - - c = new GridBagConstraints(); - c.gridx = 4; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[5] = c; - - c = new GridBagConstraints(); - c.gridx = 5; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[6] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) { - result.add(childs.get(i), cs[i]); - } - - __table33__ = result; - } - return __table33__; - } - - public Vector<JComponent> getTable33Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getLabel9()); - result.add(getDesktopPane()); - result.add(getSimulation()); - result.add(getFilterSimulationButton()); - result.add(getOpenWindowButton()); - result.add(getSupprimerSimulationButton()); - result.add(getVoirSimulationLogButton()); - return result; - } - - private JLabel __label9__ = null; - public JLabel getLabel9(){ - if(__label9__ == null){ - JLabel result = new JLabel(_("isisfish.result.choose.simulation")); - - __label9__ = result; - } - return __label9__; - } - - private javax.swing.JDesktopPane - __desktopPane__ = null; - public javax.swing.JDesktopPane - getDesktopPane(){ - if(__desktopPane__ == null){ - javax.swing.JDesktopPane - result = new javax.swing.JDesktopPane -(); - - __desktopPane__ = result; - } - return __desktopPane__; - } - - private JComboBox __simulation__ = null; - public JComboBox getSimulation(){ - if(__simulation__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_simulation_selection_notify_event(e); - } - }); - - __simulation__ = result; - } - return __simulation__; - } - - private JButton __openWindowButton__ = null; - public JButton getOpenWindowButton(){ - if(__openWindowButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.new.window"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_openWindowButton_clicked(); - } - }); - - __openWindowButton__ = result; - } - return __openWindowButton__; - } - - private JButton __supprimerSimulationButton__ = null; - public JButton getSupprimerSimulationButton(){ - if(__supprimerSimulationButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.remove.simulation"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_supprimerSimulationButton_clicked(); - } - }); - - __supprimerSimulationButton__ = result; - } - return __supprimerSimulationButton__; - } - - private JButton __voirSimulationLogButton__ = null; - - public JButton getVoirSimulationLogButton(){ - if(__voirSimulationLogButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.show.simulation.log"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_voirSimulationLogButton_clicked(); - } - }); - - __voirSimulationLogButton__ = result; - } - return __voirSimulationLogButton__; - } - - private JButton __filterSimulationButton__ = null; - - public JButton getFilterSimulationButton(){ - if(__filterSimulationButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.filter"), icon); - - // TODO disabled, filtering is too long - result.setEnabled(false); - - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_filterSimulationLogButton_clicked(); - } - }); - - __filterSimulationButton__ = result; - } - return __filterSimulationButton__; - } - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,38 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -public interface ResultViewUICallback{ - - void on_Resultat_destroy_event(); - void on_simulation_selection_notify_event(ItemEvent e); - void on_openWindowButton_clicked(); - void on_supprimerSimulationButton_clicked(); - void on_voirSimulationLogButton_clicked(); - void on_filterSimulationLogButton_clicked(); -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,102 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -/** - * ResumePanel. - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ -*/ -public class ResumePanel extends ResumePanelUI { - - /** serialVersionUID */ - private static final long serialVersionUID = 5424709605082901110L; - - protected String resume; -// protected Vector vmatInfo; - - public ResumePanel (){ - super(); - init(); - resume = ""; - getResumeTextArea().setText(this.resume); - } - - /** - * Get the value of resume. - * @return value of resume. - */ - public String getResume() { - return resume; - } - - /** - * Set the value of resume. - * @param v Value to assign to resume. - */ - public void setResume(String v) { - this.resume = v; - getResumeTextArea().setText(this.resume); - } - -// /** -// * Get the value of vmatInfo. -// * @return value of vmatInfo. -// */ -// public Vector getVmatInfo() { -// return vmatInfo; -// } - -// /** -// * Set the value of vmatInfo. -// * @param v Value to assign to vmatInfo. -// */ -// public void setVmatInfo(Vector v) { -// this.vmatInfo = v; -// getMatriceInfoGrid().removeAll(); -// GridBagConstraints [] cs = new GridBagConstraints[vmatInfo.size()]; -// GridBagConstraints c = null; -// for(int i=0; i<vmatInfo.size(); i++){ -// c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = i; -// c.weightx = 1; -// c.weighty = 1; -// c.gridwidth = 1; -// c.gridheight = 1; -// c.fill = GridBagConstraints.BOTH; -// cs[i] = c; -// } -// -// getMatriceInfoGrid().setLayout(new GridBagLayout()); -// for(int i=0; i<vmatInfo.size(); i++){ -// DataResult dataResult = new DataResult(); -// dataResult.setMatrix((MatriceInfo)vmatInfo.get(i)); -// getMatriceInfoGrid().add(dataResult, cs[i]); -// } -// } - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,196 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JViewport; - -public abstract class ResumePanelUI extends JPanel implements ResumePanelUICallback{ - - protected void init(){ - ResumePanelUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getResumePanelChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = (ButtonGroup)hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getResumePanelChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable1()); - return result; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 2; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getScrolledwindow2()); - result.add(getMatriceInfoGrid()); - return result; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getResumeTextArea()); - return result; - } - - private JTextArea __resumeTextArea__ = null; - public JTextArea getResumeTextArea(){ - if(__resumeTextArea__ == null){ - JTextArea result = new JTextArea(_("isisfish.common.blank")); - result.setEditable(false); - - __resumeTextArea__ = result; - } - return __resumeTextArea__; - } - - private JPanel __matriceInfoGrid__ = null; - public JPanel getMatriceInfoGrid(){ - if(__matriceInfoGrid__ == null){ - Vector childs = getMatriceInfoGridChilds(); - GridBagConstraints [] cs; - cs = new GridBagConstraints[childs.size()]; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __matriceInfoGrid__ = result; - } - return __matriceInfoGrid__; - } - - public Vector getMatriceInfoGridChilds(){ - Vector result; - result = new Vector(); - return result; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface ResumePanelUICallback{ - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,81 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import com.bbn.openmap.gui.OMToolSet; -import com.bbn.openmap.gui.Tool; - -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.map.ResultatLayer; - -/** - * SimpleResultatMapBean.java - * - * - * Created: Fri Jun 7 13:02:18 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version - */ -public class SimpleResultatMapBean extends SimpleResultatMapBeanUI { - public SimpleResultatMapBean (){ - super(); - init(); - initBean(); - } - - protected void initBean(){ - // Create the directional and zoom control tool - OMToolSet resultatMapOMTS = new OMToolSet(); - - // Associate the tool with the map - resultatMapOMTS.setupListeners(getIsisMapBean()); - - // Add the tool to the map toolbar - getIsisMapBeanToolBar().add((Tool)resultatMapOMTS); - - getInformationDelegator().setMap(getIsisMapBean()); - getInformationDelegator().setShowLights(false); - getInformationDelegator().setLabel(_("isisfish.simpleResult.more.information")); - } - - public void addResultatLayer(String id, ResultatLayer layer) { - getIsisMapBean().addResultatLayer(id, layer); - getLegendPanel().setModel(new LegendModel(0,Math.round(layer.getDataMapList().getMaxDataMapValue()))); - // poussin 20060822 FIXME: migration vers v3, je ne sais pas comment ca merchait avant, la methode n'existe pas :( -// getInformationDelegator().addLayer(layer); - } - - public void removeAllResultatLayer() { - getIsisMapBean().removeAllResultatLayer(); - } - - public void setRegion(FisheryRegion region) { - getIsisMapBean().setFisheryRegion(region); - } - -}// SimpleResultatMapBean Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,204 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; - -import fr.ifremer.isisfish.map.CellSelectionLayer; - -public abstract class SimpleResultatMapBeanUI extends JPanel implements SimpleResultatMapBeanUICallback{ - - protected void init(){ - SimpleResultatMapBeanUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getSimpleResultatMapBeanChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getSimpleResultatMapBeanChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable12()); - return result; - } - - private JPanel __table12__ = null; - public JPanel getTable12(){ - if(__table12__ == null){ - Vector childs = getTable12Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 2; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 3; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[3] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table12__ = result; - } - return __table12__; - } - - public Vector getTable12Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getIsisMapBean()); - result.add(getInformationDelegator()); - result.add(getIsisMapBeanToolBar()); - result.add(getLegendPanel()); - return result; - } - - private fr.ifremer.isisfish.map.IsisMapBean __resultatMap__ = null; - public fr.ifremer.isisfish.map.IsisMapBean getIsisMapBean(){ - if(__resultatMap__ == null){ - fr.ifremer.isisfish.map.IsisMapBean result = new fr.ifremer.isisfish.map.IsisMapBean(); - - // EC-20090706 : fix bug 1777 : no selection on result map - result.setSelectionMode(CellSelectionLayer.NO_SELECTION); - - __resultatMap__ = result; - } - return __resultatMap__; - } - - private com.bbn.openmap.InformationDelegator __informationDelegator__ = null; - public com.bbn.openmap.InformationDelegator getInformationDelegator(){ - if(__informationDelegator__ == null){ - com.bbn.openmap.InformationDelegator result; - result = new com.bbn.openmap.InformationDelegator(); - __informationDelegator__ = result; - } - return __informationDelegator__; - } - - private com.bbn.openmap.gui.ToolPanel - __resultatMapToolBar__ = null; - public com.bbn.openmap.gui.ToolPanel - getIsisMapBeanToolBar(){ - if(__resultatMapToolBar__ == null){ - com.bbn.openmap.gui.ToolPanel - result = new com.bbn.openmap.gui.ToolPanel -(); - - __resultatMapToolBar__ = result; - } - return __resultatMapToolBar__; - } - - private LegendPanel __legendPanel__ = null; - public LegendPanel getLegendPanel(){ - if(__legendPanel__ == null){ - LegendPanel result = new LegendPanel(); - - __legendPanel__ = result; - } - return __legendPanel__; - } - - - -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface SimpleResultatMapBeanUICallback{ - -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,69 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import javax.swing.Icon; + +import org.nuiton.math.matrix.viewer.MatrixDimensionAction; +import org.nuiton.util.Resource; + +import fr.ifremer.isisfish.types.Date; + +/** + * Action de somme des elements par 12 (année) pour la dimension des pas de temps. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class YearSumDimensionAction implements MatrixDimensionAction { + + @Override + public Icon getIcon() { + return Resource.getIcon("/images/sigma_an-barre.gif"); + } + + @Override + public Icon getSelectedIcon() { + return Resource.getIcon("/images/sigma_an.gif"); + } + + @Override + public int getDimensionIndex() { + return 0; + } + + @Override + public Class<?> getDimensionType() { + return Date.class; + } + + @Override + public int getSumStep() { + return 12; + } + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ImportDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,6 +23,10 @@ #L% --> <JDialog modal="true" resizable='false' title='isisfish.script.import'> + <import> + java.io.File + java.awt.Color + </import> <style source="ImportDialogUI.css" /> <FileSelectionTableModel id='newFilesTableModel' javaBean='null' /> @@ -56,12 +60,12 @@ } protected void performImport() { - File archiveFile = new File(archivePath.getText()); - getContextValue(ScriptAction.class).performImportScript(archiveFile, newFilesTableModel, conflictFilesTableModel); + File archiveFile = new File(archivePath.getText()); + getContextValue(ScriptAction.class).performImportScript(archiveFile, newFilesTableModel, conflictFilesTableModel); } protected void cancel() { - hide(); + dispose(); } ]]></script> <Table> @@ -115,7 +119,7 @@ <JButton id='okButton' text='isisfish.script.import.import' enabled='{isOkEnabled()}'/> <JButton id='cancelButton' text='isisfish.script.import.cancel' - onActionPerformed="cancel()" /> + onActionPerformed="cancel()" /> </JPanel> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -40,6 +40,7 @@ import java.lang.reflect.Method; import java.net.URI; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -54,6 +55,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -75,28 +77,18 @@ import fr.ifremer.isisfish.datastore.SimulatorStorage; import fr.ifremer.isisfish.equation.Language; import fr.ifremer.isisfish.ui.WelcomePanelUI; +import fr.ifremer.isisfish.ui.script.model.ScriptTree; import fr.ifremer.isisfish.ui.script.model.ScriptTreeModel; import fr.ifremer.isisfish.ui.util.ErrorHelper; import fr.ifremer.isisfish.ui.vcs.UpdateDialogUI; import fr.ifremer.isisfish.util.ClasspathTemplateLoader; +import fr.ifremer.isisfish.util.CompileHelper; import fr.ifremer.isisfish.util.JavadocHelper; import fr.ifremer.isisfish.vcs.VCSException; import freemarker.cache.TemplateLoader; import freemarker.template.Configuration; import freemarker.template.Template; -class ScriptFileFilter implements FileFilter { - protected FileFilter filter; - - public ScriptFileFilter(FileFilter filter) { - this.filter = filter; - } - - public boolean accept(File dir) { - return !filter.accept(dir) || dir.getName().equals("data"); - } -} - /** * ScriptAction. * @@ -153,10 +145,15 @@ * Post init, must be called after ui building. */ public void postInit() { - + + ScriptTree scriptTree = this.scriptUI.getScriptTree(); + // add listeners - this.scriptUI.getTree().addTreeSelectionListener(this); + scriptTree.addTreeSelectionListener(this); this.scriptUI.getEditor().addCaretListener(this); + + // expand official VCS tree node + scriptTree.expandRow(0); } /** @@ -164,7 +161,7 @@ */ protected void setButton() { - File selectedFile = (File)scriptUI.getTree().getLastSelectedPathComponent(); + File selectedFile = (File)scriptUI.getScriptTree().getLastSelectedPathComponent(); if (selectedFile != null) { scriptUI.setSingleFileSelected(selectedFile.isFile()); @@ -174,25 +171,6 @@ scriptUI.setSingleFileSelected(false); scriptUI.setJavaFileSelected(false); } - - /*buttonScriptExport.setEnabled(tree.getSelectionValue() != null); - miExport.setEnabled(tree.getSelectionValue() != null); - buttonScriptCommit.setEnabled(fileSelected); - miCommitVCS.setEnabled(fileSelected); - miDiffVCS.setEnabled(fileSelected); - //buttonScriptUpdate.setEnabled(fileSelected); - buttonScriptSave.setEnabled(fileSelected); - miSave.setEnabled(fileSelected); - buttonScriptCut.setEnabled(fileSelected); - miCut.setEnabled(fileSelected); - buttonScriptCopy.setEnabled(fileSelected); - miCopy.setEnabled(fileSelected); - buttonScriptPaste.setEnabled(fileSelected); - miPaste.setEnabled(fileSelected); - buttonScriptCheck.setEnabled(isJavaScript); - miCheckSyntax.setEnabled(isJavaScript); - buttonScriptEval.setEnabled(isJavaScript); - miEvaluate.setEnabled(isJavaScript);*/ } protected void setStatusMessage(String msg) { @@ -242,10 +220,10 @@ File scriptFile = newScript(equationModelTypePath + fileName, scriptType); // creation successful if (scriptFile != null) { - ScriptTreeModel model = (ScriptTreeModel) scriptUI.getTree().getModel(); + ScriptTreeModel model = scriptUI.getScriptTreeModel(); model.fileAdded(scriptFile); TreePath treePath = model.getTreePathFor(scriptFile); - scriptUI.getTree().setSelectionPath(treePath); + scriptUI.getScriptTree().setSelectionPath(treePath); } } } @@ -408,8 +386,9 @@ @Override public void valueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { - File selectedFile = (File)e.getNewLeadSelectionPath().getLastPathComponent(); - if (selectedFile.isFile()) { + Object selectedNode = e.getNewLeadSelectionPath().getLastPathComponent(); + if (selectedNode instanceof File && ((File)selectedNode).isFile()) { + File selectedFile = (File)selectedNode; // load file into current action codeStorage loadScript(selectedFile); scriptUI.getEditor().open(selectedFile); @@ -471,8 +450,7 @@ script = SensitivityStorage.getSensitivity(file.getName()); break; case SensitivityExport: - script = SensitivityExportStorage.getSensitivityExport(file - .getName()); + script = SensitivityExportStorage.getSensitivityExport(file.getName()); break; default: log.fatal("ScriptType unknown: " + file.getName()); @@ -512,7 +490,7 @@ scriptUI.getEditor().save(); // notify tree to refresh - ScriptTreeModel model = (ScriptTreeModel) scriptUI.getTree().getModel(); + ScriptTreeModel model = scriptUI.getScriptTreeModel(); model.fileModified(codeStorage.getFile()); } catch (Exception eee) { returnError(_("isisfish.error.script.save", codeStorage.getFile(), @@ -558,7 +536,7 @@ */ public void exportScript() { - TreePath[] selectedFilesPath = scriptUI.getTree().getSelectionPaths(); + TreePath[] selectedFilesPath = scriptUI.getScriptTree().getSelectionPaths(); // first step : acquire list of files required int prefixLength = IsisFish.config.getDatabaseDirectory() @@ -723,7 +701,56 @@ setStatusMessage(_("isisfish.message.check.finished")); return check; } + + /** + * Check all scripts. + */ + public void checkAllScripts() { + setStatusMessage(_("isisfish.message.check.inprogress"), true); + + boolean allSuccess = true; + + // reste previous state + scriptUI.getActionLogArea().setBackground(null); + scriptUI.getActionLogArea().setText(""); + + for (ScriptMapping scriptMapping : ScriptMapping.values()) { + // normalement ne match pas les formules + // le cas est différent pour les formules + // le fichier java ne sont pas compilable sans la formule associée + List<File> javaFiles = FileUtil.find(scriptMapping.getModule(), ".+\\.java$", false); + for (File javaFile : javaFiles) { + scriptUI.getActionLogArea().append(_("isisfish.script.compilingfile", javaFile)); + + StringWriter result = new StringWriter(); + PrintWriter out = new PrintWriter(result); + int compileResult = CompileHelper.compile(IsisFish.config.getDatabaseDirectory(), javaFile, IsisFish.config.getCompileDirectory(), out); + out.flush(); + + if (compileResult == 0) { + scriptUI.getActionLogArea().append(_("isisfish.common.ok") + "\n"); + } + else { + scriptUI.getActionLogArea().append(_("isisfish.common.error") + ":\n"); + scriptUI.getActionLogArea().append(result.toString() + "\n"); + scriptUI.getActionLogArea().setBackground(COLOR_FAILURE); + allSuccess = false; + } + + // scroll down + scriptUI.getActionLogArea().setCaretPosition(scriptUI.getActionLogArea().getText().length()); + } + } + + // set final color + if (allSuccess) { + scriptUI.getActionLogArea().setBackground(COLOR_SUCCESS); + } + + setStatusMessage(_("isisfish.message.check.finished")); + } + /** * Call main method in current cod storage code. * Check script before call. @@ -923,8 +950,8 @@ FileUtil.copy(sourceFile, dst); } } - } catch (Exception ee) { - throw new IsisFishRuntimeException(ee); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't backup scripts", ex); } } @@ -977,9 +1004,8 @@ } String name = codeStorage.getName(); - int resp = JOptionPane.showConfirmDialog(scriptUI, _( - "isisfish.message.confirm.remove.script", name), null, - JOptionPane.YES_NO_OPTION); + int resp = JOptionPane.showConfirmDialog(scriptUI, _("isisfish.message.confirm.remove.script", name), + null, JOptionPane.YES_NO_OPTION); if (resp == JOptionPane.YES_OPTION) { // stay in UI even if deleted scriptUI.getEditor().close(); @@ -987,8 +1013,7 @@ try { // TODO change this, need to be called before // effective deletion - ((ScriptTreeModel) scriptUI.getTree().getModel()) - .fileDeleted(codeStorage.getFile()); + scriptUI.getScriptTreeModel().fileDeleted(codeStorage.getFile()); //TODO desactive editor //TODO Review this because after delete fi file saw previously @@ -996,8 +1021,7 @@ //TODO again the file in panel but not in tree panel ? codeStorage.delete(deleteRemote); if (codeStorage.getFile().exists()) { - ErrorHelper.showErrorDialog(_( - "isisfish.error.script.delete", codeStorage + ErrorHelper.showErrorDialog(_("isisfish.error.script.delete", codeStorage .getFile())); } } catch (Exception eee) { @@ -1039,30 +1063,34 @@ /** enum to encapsulate a script module */ protected enum ScriptMapping { - Script( - ScriptStorage.getScriptDirectory(), - ScriptStorage.SCRIPT_TEMPLATE), - Simulator( - SimulatorStorage.getSimulatorDirectory(), - SimulatorStorage.SIMULATOR_TEMPLATE), + AnalysePlan( + AnalysePlanStorage.getAnalysePlanDirectory(), + AnalysePlanStorage.ANALYSE_PLAN_TEMPLATE), Export( ExportStorage.getExportDirectory(), ExportStorage.EXPORT_TEMPLATE), Rule( RuleStorage.getRuleDirectory(), RuleStorage.RULE_TEMPLATE), - AnalysePlan( - AnalysePlanStorage.getAnalysePlanDirectory(), - AnalysePlanStorage.ANALYSE_PLAN_TEMPLATE), + Script( + ScriptStorage.getScriptDirectory(), + ScriptStorage.SCRIPT_TEMPLATE), Sensitivity( SensitivityStorage.getSensitivityDirectory(), SensitivityStorage.SENSIVITY_TEMPLATE), SensitivityExport( SensitivityExportStorage.getSensitivityExportDirectory(), SensitivityExportStorage.SENSITIVITY_EXPORT_TEMPLATE), + Simulator( + SimulatorStorage.getSimulatorDirectory(), + SimulatorStorage.SIMULATOR_TEMPLATE), EquationModel( FormuleStorage.getFormuleDirectory(), - FormuleStorage.FORMULE_TEMPLATE); + FormuleStorage.FORMULE_TEMPLATE)/*, + + CommunitySimulator( + SimulatorStorage.getCommunitySimulatorDirectory(), + SimulatorStorage.SIMULATOR_TEMPLATE)*/; protected File module; protected String templatePath; @@ -1169,4 +1197,25 @@ // selection pas vide si dot = mark scriptUI.setTextSelected(e.getDot() != e.getMark()); } + + /** + * Move files. + * (called by drag and drop handler). + * + * @param directory directory to moves files to + * @param filesToMove files to move to directory + */ + public void moveFiles(File directory, Collection<File> filesToMove) { + + ScriptTreeModel model = scriptUI.getScriptTreeModel(); + for (File fileToMove : filesToMove) { + model.fileDeleted(fileToMove); + try { + FileUtils.moveFileToDirectory(fileToMove, directory, false); + } catch (IOException ex) { + throw new IsisFishRuntimeException("Can't move file", ex); + } + model.fileAdded(fileToMove); + } + } } Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptFileFilter.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptFileFilter.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptFileFilter.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptFileFilter.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,41 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Tony Chemit + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.script; + +import java.io.File; +import java.io.FileFilter; + +public class ScriptFileFilter implements FileFilter { + protected FileFilter filter; + + public ScriptFileFilter(FileFilter filter) { + this.filter = filter; + } + + public boolean accept(File dir) { + return !filter.accept(dir) || dir.getName().equals("data"); + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -26,8 +26,14 @@ <ScriptAction id="scriptAction" javaBean="new ScriptAction(this)" /> + <import> + javax.swing.SwingWorker + java.awt.Font + </import> <script><![CDATA[ - getScriptAction().postInit(); + protected void $afterCompleteSetup() { + getScriptAction().postInit(); + } ]]></script> <Boolean id="fileSelected" javaBean="false" /> @@ -48,7 +54,7 @@ <JMenuItem id="miNewSensitivity" text="isisfish.script.menu.txtNewSensitivity" onActionPerformed='getScriptAction().newScript(ScriptAction.ScriptMapping.Sensitivity)' icon="script.png" /> <JMenuItem id="miNewSensitivityExport" text="isisfish.script.menu.txtNewSensitivityExport" onActionPerformed='getScriptAction().newScript(ScriptAction.ScriptMapping.SensitivityExport)' icon="script.png" /> <JMenuItem id="miNewEquationModel" text="isisfish.script.menu.txtNewEquationModel" onActionPerformed='getScriptAction().newScript(ScriptAction.ScriptMapping.EquationModel)' icon="script.png" /> - </JMenu> + </JMenu> <JMenuItem id="miSave" text="isisfish.script.menu.save" onActionPerformed="getScriptAction().saveScript()" icon="script_save.png" enabled='{isSingleFileSelected()}' /> <JSeparator/> <JMenuItem id="miImport" text="isisfish.script.menu.txtImport" enabled="false" onActionPerformed="getScriptAction().importScript()" icon="page_white_compressed.png" /> @@ -70,6 +76,7 @@ </JMenu> <JMenu id="scriptTxtCode" text="isisfish.script.menu.code"> <JMenuItem id="miCheckSyntax" text="isisfish.script.menu.checkSyntax" icon="script_code_red.png" onActionPerformed="getScriptAction().checkScript()" enabled='{isJavaFileSelected()}' /> + <JMenuItem id="miCheckAllSyntax" text="isisfish.script.menu.checkAllSyntax" icon="script_code_red.png" onActionPerformed="new SwingWorker<Void, Void>(){public Void doInBackground(){getScriptAction().checkAllScripts();return null;}}.execute()" /> <JMenuItem id="miEvaluate" text="isisfish.script.menu.evaluate" icon="script_gear.png" onActionPerformed="getScriptAction().evaluateScript()" enabled='{isJavaFileSelected()}' /> <JSeparator/> <JMenuItem id="miGenerateJavadoc" text="isisfish.script.menu.javadocgenerate" onActionPerformed="getScriptAction().generateScriptJavadoc()"/> @@ -77,7 +84,7 @@ </JMenu> </JMenuBar> - <!-- Toolbar --> + <!-- Toolbar --> <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'> <JPanel id="buttonBar" layout='{new GridLayout()}' constraints='BorderLayout.NORTH'> <JComboBox id="scriptTypeChoice" model='{new ScriptTypesComboModel()}'/> @@ -93,8 +100,9 @@ </JPanel> <JSplitPane oneTouchExpandable="true" dividerLocation="250" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> <JScrollPane> - <JTree id="tree" name="tree" rootVisible="false" - model='{new fr.ifremer.isisfish.ui.script.model.ScriptTreeModel()}' + <fr.ifremer.isisfish.ui.script.model.ScriptTreeModel id="scriptTreeModel" /> + <fr.ifremer.isisfish.ui.script.model.ScriptTree id="scriptTree" constructorParams='this' + rootVisible="false" model='{scriptTreeModel}' cellRenderer='{new fr.ifremer.isisfish.ui.script.model.ScriptTreeCellRenderer()}' /> </JScrollPane> <JSplitPane oneTouchExpandable="true" resizeWeight="0.75" orientation="VERTICAL"> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -97,8 +97,8 @@ for (String path : paths) { backup(new File(src, path), path, suffix); } - } catch (Exception ee) { - throw new IsisFishRuntimeException(ee); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't backup scripts", ex); } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ExportAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ExportAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ExportAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -153,8 +153,8 @@ + " files] (size " + dst.length() + ")"); } - } catch (IOException e1) { - throw new IsisFishRuntimeException(e1); + } catch (IOException ex) { + throw new IsisFishRuntimeException("Can't export script", ex); } } } \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTranferable.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTranferable.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTranferable.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTranferable.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,118 @@ +/* + * #%L + * Isis-Fish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.script.model; + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.File; +import java.io.IOException; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Represent transfered data. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ By : $Author$ + */ +public class ScriptTranferable implements Transferable { + + /** log */ + private static Log log = LogFactory.getLog(ScriptTranferable.class); + + /** Data transfer mime type */ + protected static final String MIMETYPE = DataFlavor.javaJVMLocalObjectMimeType + + ";class=" + File.class.getName(); + + /** Data instance */ + protected static DataFlavor myData; + + /** Files to transfer. Chosen implementation must be serializable. */ + protected List<File> filesToTransfer; + + /** + * Constructor. + * + * @param filesToTransfer files to transfer + */ + public ScriptTranferable(List<File> filesToTransfer) { + + // save task + this.filesToTransfer = filesToTransfer; + + // build new DataFlavor + try { + myData = new DataFlavor(MIMETYPE); + } catch (ClassNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Class not found", e); + } + } + } + + /* + * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor) + */ + @Override + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + + List<File> filesToTransfer = null; + + if (flavor == null) { + throw new IOException("flavor is null"); + } + + if (flavor.equals(myData)) { + filesToTransfer = this.filesToTransfer; + } else { + throw new UnsupportedFlavorException(flavor); + } + + return filesToTransfer; + } + + /* + * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() + */ + @Override + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { myData }; + } + + /* + * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor) + */ + @Override + public boolean isDataFlavorSupported(DataFlavor flavor) { + return flavor.equals(myData); + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTransferHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTransferHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTransferHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTransferHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,172 @@ +/* + * #%L + * jTimer + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.script.model; + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.File; +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.TransferHandler; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.ui.script.ScriptUI; + +/** + * Transfer handler used to transfer tasks in table. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ By : $Author$ + */ +public class ScriptTransferHandler extends TransferHandler { + + /** serialVersionUID. */ + private static final long serialVersionUID = 5433321973795969278L; + + /** log. */ + private static Log log = LogFactory.getLog(ScriptTransferHandler.class); + + protected ScriptUI scriptUI; + + /** + * Constructor. + * + * @param scriptUI scriptUI + */ + public ScriptTransferHandler(ScriptUI scriptUI) { + this.scriptUI = scriptUI; + } + + @Override + public boolean canImport(JComponent cp, DataFlavor[] df) { + + for (DataFlavor dataFlavor : df) { + if (dataFlavor.equals(ScriptTranferable.myData)) { + return true; + } + } + + return false; + } + + @Override + public boolean importData(JComponent component, Transferable transferable) { + + boolean confirmImport = false; + + /*if (transferable.isDataFlavorSupported(FactorTranferable.myData)) { + try { + + FactorTree factorTree = (FactorTree) component; + FactorGroup selectedFactorGroup = factorTree.getSelectedFactorGroup(); + + if (selectedFactorGroup != null) { + Object myObject = transferable.getTransferData(FactorTranferable.myData); + List<Factor> movedFactors = (List<Factor>) myObject; + } + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Exception while transfering task", e); + } + } catch (UnsupportedFlavorException e) { + if (log.isErrorEnabled()) { + log.error("Exception while transfering task", e); + } + } + }*/ + + confirmImport = true; + + return confirmImport; + + } + + /** + * Get selected task in tree, and build Transferable object for it. + * + * @param cp component + * @return transferable instance for selected task + */ + @Override + protected Transferable createTransferable(JComponent cp) { + + Transferable transferable = null; + + ScriptTree scriptTree = (ScriptTree) cp; + // only task can be moved ! + List<File> selectedFiles = scriptTree.getSelectedFiles(); + if (CollectionUtils.isNotEmpty(selectedFiles)) { + List<File> files = new LinkedList<File>(selectedFiles); + transferable = new ScriptTranferable(files); + } + + return transferable; + } + + @Override + protected void exportDone(JComponent cp, Transferable transferable, int type) { + if (log.isDebugEnabled()) { + log.debug("Transfert done"); + } + + if (type == TransferHandler.MOVE) { + + try { + ScriptTree factorTree = (ScriptTree) cp; + // elements here, task can be move to directory only + File directory = factorTree.getSelectedDirectory(); + + if (directory != null) { + Object myObject = transferable.getTransferData(ScriptTranferable.myData); + List<File> movedFiles = (List<File>) myObject; + scriptUI.getScriptAction().moveFiles(directory, movedFiles); + } + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Exception while transfering task", e); + } + } catch (UnsupportedFlavorException e) { + if (log.isErrorEnabled()) { + log.error("Exception while transfering task", e); + } + } + } + } + + @Override + public int getSourceActions(JComponent component) { + return MOVE; + } +} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTree.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTree.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTree.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTree.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,114 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.script.model; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTree; +import javax.swing.tree.TreePath; + +import fr.ifremer.isisfish.ui.script.ScriptUI; + +/** + * Factor tree. + * + * Add drag and drop support. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ScriptTree extends JTree { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1999481128072081972L; + + /** + * Constructor (add drag and drop). + * + * @param scriptUI script ui + */ + public ScriptTree(ScriptUI scriptUI) { + // enable drag n drop + setDragEnabled(true); + setTransferHandler(new ScriptTransferHandler(scriptUI)); + } + + /** + * Return selected files (only files not directories). + * + * @return selected files + */ + public List<File> getSelectedFiles() { + + List<File> selectedFiles = new ArrayList<File>(); + + TreePath[] selectedPaths = getSelectionModel().getSelectionPaths(); + if (selectedPaths != null) { + for (TreePath selectedPath : selectedPaths) { + if (selectedPath != null) { + Object[] pathWay = selectedPath.getPath(); + + File selectedFile = (File)pathWay[pathWay.length - 1]; + if (selectedFile.isFile()) { + selectedFiles.add(selectedFile); + } + } + } + } + + return selectedFiles; + } + + /** + * Return selected directory. + * + * @return selected directory + */ + public File getSelectedDirectory() { + + File selectedDirectory = null; + + TreePath[] selectedPaths = getSelectionModel().getSelectionPaths(); + if (selectedPaths != null) { + for (TreePath selectedPath : selectedPaths) { + if (selectedPath != null) { + Object[] pathWay = selectedPath.getPath(); + + File selectedFile = (File)pathWay[pathWay.length - 1]; + if (selectedFile.isDirectory()) { + selectedDirectory = selectedFile; + break; + } + } + } + } + + return selectedDirectory; + } +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeCellRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,6 +25,8 @@ package fr.ifremer.isisfish.ui.script.model; +import static org.nuiton.i18n.I18n._; + import java.awt.Color; import java.awt.Component; import java.io.File; @@ -58,7 +60,7 @@ /** Class logger. */ private static Log log = LogFactory.getLog(ScriptTreeCellRenderer.class); - + /* * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) */ @@ -68,10 +70,14 @@ boolean hasFocus) { JLabel c = (JLabel)super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - - if (value instanceof File) { + + if (value == IsisFish.vcs) { + c.setText(_("isisfish.ui.script.officialvcs")); + } else if (value == IsisFish.communityVcs) { + c.setText(_("isisfish.ui.script.communityvcs")); + } else if (value instanceof File) { File file = (File)value; - + try { if (file.isFile()) { if (IsisFish.vcs.getLocalStatus(file) == Status.STATUS_MODIFIED) { @@ -96,7 +102,12 @@ log.error("Can't get file status", e); } } - c.setText(file.getName()); + + String prefix = ""; + if (file.isDirectory() && file.getParentFile().equals(IsisFish.communityVcs.getLocalRepository())) { + prefix = "Community "; + } + c.setText(prefix + file.getName()); } return c; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -28,7 +28,9 @@ import java.io.File; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; @@ -47,10 +49,19 @@ import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.datastore.SensitivityStorage; import fr.ifremer.isisfish.datastore.SimulatorStorage; +import fr.ifremer.isisfish.vcs.VCS; /** * Tree model for scripts edition. * + * Tree model is structured as this : + * <pre> + * - root + * - vcs + * - categories + * - files + * </pre> + * * @author chatellier * @version $Revision$ * @@ -61,11 +72,15 @@ /** Class logger. */ private static Log log = LogFactory.getLog(ScriptTreeModel.class); - + protected TreeModelSupport modelSupport; - public List<File> rootFiles; + /** VCS list. */ + protected List<VCS> vcsList = new ArrayList<VCS>(); + /** Categories files for VCS. */ + protected Map<VCS, List<File>> rootFiles; + /** Add node operation */ public static final int OPERATION_ADD = 0; /** Modify node operation */ @@ -76,15 +91,25 @@ public ScriptTreeModel() { modelSupport = new TreeModelSupport(this); - rootFiles = new ArrayList<File>(); - rootFiles.add(AnalysePlanStorage.getAnalysePlanDirectory()); - rootFiles.add(ExportStorage.getExportDirectory()); - rootFiles.add(FormuleStorage.getFormuleDirectory()); - rootFiles.add(RuleStorage.getRuleDirectory()); - rootFiles.add(ScriptStorage.getScriptDirectory()); - rootFiles.add(SensitivityExportStorage.getSensitivityExportDirectory()); - rootFiles.add(SensitivityStorage.getSensitivityDirectory()); - rootFiles.add(SimulatorStorage.getSimulatorDirectory()); + rootFiles = new HashMap<VCS, List<File>>(); + List<File> offFiles = new ArrayList<File>(); + offFiles.add(AnalysePlanStorage.getAnalysePlanDirectory()); + offFiles.add(ExportStorage.getExportDirectory()); + offFiles.add(FormuleStorage.getFormuleDirectory()); + offFiles.add(RuleStorage.getRuleDirectory()); + offFiles.add(ScriptStorage.getScriptDirectory()); + offFiles.add(SensitivityExportStorage.getSensitivityExportDirectory()); + offFiles.add(SensitivityStorage.getSensitivityDirectory()); + offFiles.add(SimulatorStorage.getSimulatorDirectory()); + + List<File> comFiles = new ArrayList<File>(); + //comFiles.add(SimulatorStorage.getCommunitySimulatorDirectory()); + + rootFiles.put(IsisFish.vcs, offFiles); + rootFiles.put(IsisFish.communityVcs, comFiles); + + vcsList.add(IsisFish.vcs); + vcsList.add(IsisFish.communityVcs); } /* @@ -103,10 +128,11 @@ Object result = null; - if (parent == rootFiles) { - result = rootFiles.get(index); - } - else { + if (parent == vcsList) { + result = vcsList.get(index); + } else if (parent instanceof VCS) { + result = rootFiles.get(parent).get(index); + } else { File parentFile = (File)parent; File[] filesArray = parentFile.listFiles(); List<File> files = getVersionnableSortedFiles(filesArray); @@ -121,12 +147,13 @@ */ @Override public int getChildCount(Object parent) { - + int count = 0; - if (parent == rootFiles) { - count = rootFiles.size(); - } - else { + if (parent == vcsList) { + count = vcsList.size(); + } else if (parent instanceof VCS) { + count = rootFiles.get(parent).size(); + } else { File parentFile = (File)parent; File[] filesArray = parentFile.listFiles(); if ( filesArray != null) { @@ -143,10 +170,11 @@ @Override public int getIndexOfChild(Object parent, Object child) { int index = 0; - if (parent == rootFiles) { - index = rootFiles.indexOf(child); - } - else { + if (parent == vcsList) { + index = vcsList.indexOf(child); + } else if (parent instanceof VCS) { + index = rootFiles.get(parent).indexOf(child); + } else { File parentFile = (File)parent; File[] filesArray = parentFile.listFiles(); List<File> files = getVersionnableSortedFiles(filesArray); @@ -160,7 +188,7 @@ */ @Override public Object getRoot() { - return rootFiles; + return vcsList; } /* @@ -168,7 +196,13 @@ */ @Override public boolean isLeaf(Object node) { - return getChildCount(node) == 0; + boolean result = false; + + if (node instanceof File) { + result = ((File)node).isFile(); + } + + return result; } /* @@ -198,6 +232,8 @@ for (File fileArray : filesArray) { if (IsisFish.vcs.isVersionnableFile(fileArray)) { files.add(fileArray); + } else if (IsisFish.communityVcs.isVersionnableFile(fileArray)) { + files.add(fileArray); } } Collections.sort(files); @@ -305,7 +341,7 @@ * @return tree path */ public TreePath getTreePathFor(File file) { - TreePath path = new TreePath(rootFiles); + TreePath path = new TreePath(vcsList); path = getRecursiveTreePath(file, path); return path; } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,12 +22,20 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'> +<JPanel layout='{new BorderLayout()}' abstract="true"> <Boolean id='continuePossible' javaBean='true'/> <Boolean id='continueSelected' javaBean='false'/> - <JPanel id='content' constraints='BorderLayout.CENTER'/> - + <script><![CDATA[ +/** + * Return true only if UI component are all filled and value are correct + * to define new factor. + */ +public abstract boolean isFactorValid(); + ]]></script> + + <JPanel id='content' layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'/> + </JPanel> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,62 +23,124 @@ #L% --> <ContinuousPanelContainerUI> - <script><![CDATA[ -protected JTextField continueMax = null; -protected JTextField continueMin = null; + <Boolean id="percentageTypeFactor" javaBean="true" /> -addPropertyChangeListener("continuePossible", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - continueMax.setVisible((Boolean)evt.getNewValue()); - continueMin.setVisible((Boolean)evt.getNewValue()); - } -}); + <import> + org.apache.commons.lang.StringUtils + </import> -addPropertyChangeListener("continueSelected", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - continueMax.setEnabled((Boolean)evt.getNewValue()); - continueMin.setEnabled((Boolean)evt.getNewValue()); - } -}); - -public void init(JTextField cMin, JTextField cMax) { - continueMax = cMax; - continueMin = cMin; - continueMax.setEnabled(isContinueSelected()); - continueMin.setEnabled(isContinueSelected()); - continueMax.setVisible(isContinuePossible()); - continueMin.setVisible(isContinuePossible()); - - continueMaxPanel.add(continueMax, BorderLayout.CENTER); - continueMinPanel.add(continueMin, BorderLayout.CENTER); + <script><![CDATA[ +public void init(String min, String max, String referenceValue, String coefficient) { + continueMin.setText(min); + continueMax.setText(max); + referenceValueField.setText(referenceValue); + coefficientField.setText(coefficient); } -public String getMin() { - return continueMin.getText(); +public void initExisting(String min, String max, String referenceValue, String coefficient) { + init(min, max, referenceValue, coefficient); + setPercentageTypeFactor(StringUtils.isNotBlank(coefficient)); } -public String getMax() { - return continueMax.getText(); + at Override +public boolean isFactorValid() { + boolean valid = false; + + try { + if (continueSelected) { + if (percentageTypeFactor) { + Double coefficient = Double.parseDouble(coefficientField.getText().trim()); + Double referenceValue = Double.parseDouble(referenceValueField.getText().trim()); + valid = coefficient != null && referenceValue != null; + } + else { + Double minValue = Double.parseDouble(continueMin.getText().trim()); + Double maxValue = Double.parseDouble(continueMax.getText().trim()); + valid = minValue != null && maxValue != null; + } + } + else { + valid = true; + } + } + catch (NumberFormatException eee) { + if (log.isWarnEnabled()) { + log.warn("Double parse error", eee); + } + } + + return valid; } - ]]> - </script> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.firstValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JPanel id='continueMinPanel' layout='{new BorderLayout()}'/> - </cell> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.lastValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JPanel id='continueMaxPanel' layout='{new BorderLayout()}'/> - </cell> - </row> - </Table> + ]]></script> + <JPanel id="content"> + <Table constraints='BorderLayout.CENTER'> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JPanel layout="{new BorderLayout()}"> + <JRadioButton text="isisfish.sensitivity.continuouspercentagetype" + onActionPerformed="setPercentageTypeFactor(true)" + selected="{isPercentageTypeFactor()}" + constraints='BorderLayout.NORTH' + enabled='{isContinueSelected()}'/> + <Table constraints='BorderLayout.CENTER' border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.referencevalue' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='referenceValueField' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.coefficient' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='coefficientField' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JPanel layout="{new BorderLayout()}"> + <JRadioButton text="isisfish.sensitivity.continuousminmaxtype" + onActionPerformed="setPercentageTypeFactor(false)" + selected="{!isPercentageTypeFactor()}" + constraints='BorderLayout.NORTH' + enabled='{isContinueSelected()}'/> + <Table constraints='BorderLayout.CENTER' border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.firstValue' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='continueMin' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.lastValue' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='continueMax' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + </Table> + </JPanel> </ContinuousPanelContainerUI> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,898 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JRadioButton; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.text.JTextComponent; - -import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.swing.editor.NumberEditor; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.gui.MatrixEditor; -import org.nuiton.math.matrix.gui.MatrixPanelEditor; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.persistence.TopiaEntity; - -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.entities.Formule; -import fr.ifremer.isisfish.entities.Selectivity; -import fr.ifremer.isisfish.entities.TargetSpecies; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; -import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; -import fr.ifremer.isisfish.types.Month; -import fr.ifremer.isisfish.types.RangeOfValues; -import fr.ifremer.isisfish.ui.input.InputAction; -import fr.ifremer.isisfish.ui.input.InputOneEquationUI; -import fr.ifremer.isisfish.ui.input.InputSaveVerifier; -import fr.ifremer.isisfish.ui.input.MetierSeasonInfoSpeciesEditorUI; -import fr.ifremer.isisfish.ui.input.PopulationMigrationEmigrationUI; -import fr.ifremer.isisfish.ui.input.PopulationMigrationImmigrationUI; -import fr.ifremer.isisfish.ui.input.PopulationMigrationMigrationUI; -import fr.ifremer.isisfish.ui.input.PopulationZonesEditorUI; -import fr.ifremer.isisfish.ui.input.RangeOfValuesUI; -import fr.ifremer.isisfish.ui.input.SelectivityEditorUI; -import fr.ifremer.isisfish.ui.input.SpeciesStructuredUI; -import fr.ifremer.isisfish.ui.widget.IntervalPanel; - -/** - * Helper for sensitivity Swing component manipulation. - * - * @author letellier - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class EditorHelper { - - /** Class logger. */ - private static Log log = LogFactory.getLog(EditorHelper.class); - - /** - * Get "method" property value for wing component. - * - * @param component component - * @return property value - */ - public static String getMethod(JComponent component) { - String method = (String)component.getClientProperty("method"); - return method; - } - - /** - * Get copy of component with original entity value as default value. - * - * @param component component - * @param entity entity - * @return component copy - */ - public static JComponent getEditor(JComponent component, TopiaEntity entity) { - JComponent result = null; - try { - String fieldName = getMethod(component); - result = component.getClass().newInstance(); - - if (result instanceof JTextField) { - ((JTextComponent) result).setText(String.valueOf(getMethodValue(entity, fieldName))); - - } else if (result instanceof NumberEditor) { - NumberEditor ui = (NumberEditor) component; - JTextField numEditor = new JTextField(); - numEditor.setText(String.valueOf(ui.getModel())); - result = numEditor; - - } else if (result instanceof MatrixEditor) { - MatrixEditor ui = (MatrixEditor) component; - MatrixND m = (MatrixND) getMethodValue(entity, fieldName); - MatrixPanelEditor matrix = new MatrixPanelEditor(false); - if (m != null) { - matrix.setMatrix(m.clone()); - } - matrix.setLinearModel(ui.isLinearModel()); - matrix.setLinearModelShowDefault(ui.isLinearModelShowDefault()); - result = matrix; - - } else if (result instanceof JTable) { - ((JTable) result).setModel(((JTable) component).getModel()); - - } else if (result instanceof JComboBox) { - JComboBox combo = (JComboBox) component; - JComboBox comboResult = new JComboBox(); - comboResult.setModel(combo.getModel()); - comboResult.setSelectedIndex(combo.getSelectedIndex()); - result = comboResult; - - } else if (result instanceof JList) { - JList list = (JList) component; - JList listResult = new JList(); - listResult.setModel(list.getModel()); - listResult.setSelectedIndices(list.getSelectedIndices()); - result = listResult; - } else if (result instanceof JCheckBox) { - ((JCheckBox) result).setSelected((Boolean) getMethodValue(entity, - fieldName)); - JCheckBox cOrigin = (JCheckBox) component; - ((JCheckBox) result).setText(cOrigin.getText()); - } else if (result instanceof JRadioButton) { - ((JRadioButton) result).setSelected((Boolean) getMethodValue(entity, - fieldName)); - JRadioButton cOrigin = (JRadioButton) component; - ((JRadioButton) result).setText(cOrigin.getText()); - } else if (result instanceof SpeciesStructuredUI) { - SpeciesStructuredUI ui = new SpeciesStructuredUI(); - ui.setActif(true); - result = ui; - } else if (result instanceof InputOneEquationUI) { - InputOneEquationUI origine = (InputOneEquationUI) component; - InputOneEquationUI ui = new InputOneEquationUI( - new JAXXInitialContext().add(new InputAction())); - ui.setSelectedEquation(origine.getSelectedEquation()); - ui.setText(origine.getText()); - ui.setFormuleCategory(origine.getFormuleCategory()); - ui.setClazz(origine.getClazz()); - //ui.setMethodGet(origine.getMethodGet()); - //ui.setMethodSet(origine.getMethodSet()); - ui.setBeanProperty(origine.getBeanProperty()); - ui.setBean(entity); - ui.setActif(true); - ui.refresh(); - result = ui; - } else if (result instanceof IntervalPanel) { - IntervalPanel ipResult = new IntervalPanel(); - IntervalPanel ip = (IntervalPanel) component; - ipResult.setLabelRenderer(Month.MONTH); - ipResult.setModel(ip.getModel().clone()); - result = ipResult; - } else if (result instanceof RangeOfValuesUI) { - result = new JTextField(""); - } else if (result instanceof SelectivityEditorUI) { - SelectivityEditorUI origine = (SelectivityEditorUI) component; - SelectivityEditorUI ui = new SelectivityEditorUI( - new JAXXInitialContext().add(new InputAction()).add( - origine.getRegion()).add( - new InputSaveVerifier())); - ui.setBean(origine.getBean()); - ui.setActif(true); - ui.refresh(); - ui.setActif(true); - result = ui; - } else if (result instanceof MetierSeasonInfoSpeciesEditorUI) { - MetierSeasonInfoSpeciesEditorUI origine = (MetierSeasonInfoSpeciesEditorUI) component; - MetierSeasonInfoSpeciesEditorUI ui = new MetierSeasonInfoSpeciesEditorUI( - new JAXXInitialContext().add(new InputAction()).add( - origine.getRegion()).add( - new InputSaveVerifier())); - ui.setBean(origine.getBean()); - if (origine.getMetierSeasonInfo() != null) { - ui.setMetierSeasonInfo(origine.getMetierSeasonInfo()); - ui.setMetierSeasonSelected(true); - ui.setActif(true); - } - ui.refresh(); - result = ui; - } else if (result instanceof PopulationZonesEditorUI) { - PopulationZonesEditorUI origine = (PopulationZonesEditorUI) component; - PopulationZonesEditorUI ui = new PopulationZonesEditorUI(new JAXXInitialContext().add(new InputAction()).add(origine.getRegion())); - ui.setBean(origine.getBean()); - ui.setActif(true); - ui.refresh(); - result = ui; - } else if (result instanceof PopulationMigrationMigrationUI) { - PopulationMigrationMigrationUI origine = (PopulationMigrationMigrationUI) component; - PopulationMigrationMigrationUI ui = new PopulationMigrationMigrationUI( - new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } else if (result instanceof PopulationMigrationEmigrationUI) { - PopulationMigrationEmigrationUI origine = (PopulationMigrationEmigrationUI) component; - PopulationMigrationEmigrationUI ui = new PopulationMigrationEmigrationUI(new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } else if (result instanceof PopulationMigrationImmigrationUI) { - PopulationMigrationImmigrationUI origine = (PopulationMigrationImmigrationUI) component; - PopulationMigrationImmigrationUI ui = new PopulationMigrationImmigrationUI(new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } - } catch (IllegalAccessException ex) { - if (log.isErrorEnabled()) { - log.error("Can't make new instance of " + component, ex); - } - } catch (InstantiationException ex) { - if (log.isErrorEnabled()) { - log.error("Can't make new instance of " + component, ex); - } - } - return result; - } - - /** - * Get copy of component with original entity value as default value. - * - * @param component component - * @param entity entity - * @return component copy - */ - public static ContinuousPanelContainerUI getContinuousPanel(JComponent component, TopiaEntity entity) { - ContinuousPanelContainerUI result = null; - String fieldName = getMethod(component); - DefaultContinuousPanelUI continuousPanel = null; - if (component instanceof InputOneEquationUI) { - InputOneEquationUI origine = (InputOneEquationUI) component; - EquationContinuousPanelUI ui = new EquationContinuousPanelUI( - new JAXXInitialContext().add(new InputAction())); - ui.setSelectedEquation(origine.getSelectedEquation()); - ui.setText(origine.getText()); - ui.setFormuleCategory(origine.getFormuleCategory()); - ui.setClazz(origine.getClazz()); - //ui.setMethodGet(origine.getMethodGet()); - //ui.setMethodSet(origine.getMethodSet()); - ui.setBeanProperty(origine.getBeanProperty()); - ui.setBean(entity); - result = ui; - } else if (component instanceof MatrixEditor) { - MatrixContinuousPanelUI matrixPanel = new MatrixContinuousPanelUI(); - MatrixND m = (MatrixND) getMethodValue(entity, fieldName); - if (m != null) { - matrixPanel.setMatrix(m.clone()); - } - result = matrixPanel; - } else { - continuousPanel = new DefaultContinuousPanelUI(); - result = continuousPanel; - } - if (continuousPanel != null) { - continuousPanel.init(getNewBoundEditor(component, entity), getNewBoundEditor(component, entity)); - } - return result; - } - - /** - * Get new text component with current entity default value. - * - * @param component component - * @param entity entity - * @return bound editor - */ - protected static JTextField getNewBoundEditor(JComponent component, TopiaEntity entity) { - String fieldName = getMethod(component); - Object value = getMethodValue(entity, fieldName); - if (component instanceof JTextComponent) { - return new JTextField(String.valueOf(value)); - } - return new JTextField(); - } - - /** - * Get continuous editor for component with given value. - * - * @param component component - * @param domain domain - * @param factor factor - * @return component copy - */ - public static ContinuousPanelContainerUI getContinuousPanelWithValue( - JComponent component, ContinuousDomain<?, ?> domain, Factor<?, ?> factor) { - ContinuousPanelContainerUI result = null; - - DefaultContinuousPanelUI continuousPanel = null; - if (component instanceof InputOneEquationUI) { - InputOneEquationUI origine = (InputOneEquationUI) component; - EquationContinuousPanelUI ui = new EquationContinuousPanelUI( - new JAXXInitialContext().add(new InputAction())); - ui.setText(origine.getText()); - ui.setFormuleCategory(origine.getFormuleCategory()); - ui.getEditor().getEditor().setText((String) factor.getValue()); - ui.setClazz(origine.getClazz()); - //ui.setMethodGet(origine.getMethodGet()); - //ui.setMethodSet(origine.getMethodSet()); - ui.setBeanProperty(origine.getBeanProperty()); - ui.setBean(origine.getBean()); - - EquationContinuousDomain equationDomain = (EquationContinuousDomain) domain; - ui.addDomain(equationDomain); - ui.setTable(); - - result = ui; - } else if (component instanceof MatrixEditor) { - MatrixContinuousPanelUI panel = new MatrixContinuousPanelUI(); - MatrixContinuousDomain matrixDomain = (MatrixContinuousDomain) domain; - MatrixND m = matrixDomain.getMatrix(); - if (m != null) { - panel.setMatrix(m.clone()); - } - panel.getOperator().setSelectedItem(matrixDomain.getOperator()); - panel.getCoef().setText( - String.valueOf(matrixDomain.getCoefficient() * 100)); - result = panel; - } else { - continuousPanel = new DefaultContinuousPanelUI(); - result = continuousPanel; - } - if (continuousPanel != null) { - continuousPanel.init(new JTextField(String.valueOf(domain - .getMinBound())), new JTextField(String.valueOf(domain - .getMaxBound()))); - } - - return result; - } - - /** - * Get new instance of component filled with original swing component value. - * - * @param component component - * @return new component instance - */ - public static JComponent getEditorWithValue(JComponent component) { - Object value = getValue(component); - return getEditorWithValue(component, value); - } - - /** - * Get new instance of component filled with specified value depending - * of component type. - * - * @param component component - * @param value value - * @return new component instance - */ - public static JComponent getEditorWithValue(JComponent component, Object value) { - JComponent result = null; - - if (log.isDebugEnabled()) { - log.debug("Get editor for " + component + " with value = " + value); - } - - try { - result = component.getClass().newInstance(); - - if (result instanceof JTextComponent) { - ((JTextComponent) result).setText(String.valueOf(value)); - } else if (result instanceof NumberEditor) { - JTextField numEditor = new JTextField(); - numEditor.setText(String.valueOf(value)); - result = numEditor; - } else if (result instanceof RangeOfValuesUI) { - result = new JTextField(value.toString()); - } else if (result instanceof MatrixEditor) { - MatrixEditor ui = (MatrixEditor) component; - MatrixND m = (MatrixND) value; - MatrixPanelEditor matrix = new MatrixPanelEditor(false); - if (m != null) { - matrix.setMatrix(m.clone()); - } - matrix.setLinearModel(ui.isLinearModel()); - matrix.setLinearModelShowDefault(ui.isLinearModelShowDefault()); - result = matrix; - } else if (result instanceof JComboBox) { - JComboBox combo = (JComboBox) component; - JComboBox comboResult = new JComboBox(); - comboResult.setModel(combo.getModel()); - comboResult.setSelectedItem(value); - result = comboResult; - } else if (result instanceof JList) { - JList list = (JList) component; - JList listResult = new JList(); - listResult.setModel(list.getModel()); - //listResult.setSelectedValues((Object[]) value); - listResult.setSelectedIndices(list.getSelectedIndices()); - result = listResult; - } else if (result instanceof JCheckBox) { - ((JCheckBox) result).setSelected((Boolean) value); - JCheckBox ch = (JCheckBox) component; - ((JCheckBox) result).setText(ch.getText()); - - } else if (result instanceof JRadioButton) { - ((JRadioButton) result).setSelected((Boolean) value); - JRadioButton cOrigin = (JRadioButton) component; - ((JRadioButton) result).setText(cOrigin.getText()); - } else if (result instanceof SpeciesStructuredUI) { - //SpeciesStructuredUI origine = (SpeciesStructuredUI) component; - SpeciesStructuredUI ui = new SpeciesStructuredUI(); - ui.getFieldSpeciesDynamicAge().setSelected((Boolean) value); - ui.setActif(true); - result = ui; - } else if (result instanceof InputOneEquationUI) { - InputOneEquationUI origine = (InputOneEquationUI) component; - InputOneEquationUI ui = new InputOneEquationUI(new JAXXInitialContext().add(new InputAction())); - ui.getEditor().setText((String) value); - ui.setText(origine.getText()); - ui.setFormuleCategory(origine.getFormuleCategory()); - ui.setClazz(origine.getClazz()); - /// ??? was not set before - ui.setBeanProperty(origine.getBeanProperty()); - ui.setFormule((Formule) value); - ui.setActif(true); - ui.refresh(); - result = ui; - } else if (result instanceof IntervalPanel) { - IntervalPanel ipResult = new IntervalPanel(); - IntervalPanel ip = (IntervalPanel) component; - ipResult.setLabelRenderer(Month.MONTH); - ipResult.setModel(ip.getModel().clone()); - result = ipResult; - } else if (result instanceof SelectivityEditorUI) { - SelectivityEditorUI origine = (SelectivityEditorUI) component; - SelectivityEditorUI ui = new SelectivityEditorUI( - new JAXXInitialContext().add(new InputAction()).add( - origine.getRegion()).add(new InputSaveVerifier())); - ui.setBean(origine.getBean()); - ui.getBean().setPopulationSelectivity((Collection<Selectivity>) value); - ui.setActif(true); - ui.refresh(); - ui.setActif(true); - result = ui; - } else if (result instanceof MetierSeasonInfoSpeciesEditorUI) { - MetierSeasonInfoSpeciesEditorUI origine = (MetierSeasonInfoSpeciesEditorUI) component; - MetierSeasonInfoSpeciesEditorUI ui = new MetierSeasonInfoSpeciesEditorUI( - new JAXXInitialContext().add(new InputAction()).add( - origine.getRegion()).add( - new InputSaveVerifier())); - ui.setBean(origine.getBean()); - if (origine.getMetierSeasonInfo() != null) { - ui.setMetierSeasonInfo(origine.getMetierSeasonInfo()); - ui.getMetierSeasonInfo().setSpeciesTargetSpecies((Collection<TargetSpecies>) value); - ui.setMetierSeasonSelected(true); - ui.setActif(true); - } - ui.refresh(); - result = ui; - } else if (result instanceof PopulationZonesEditorUI) { - PopulationZonesEditorUI origine = (PopulationZonesEditorUI) component; - PopulationZonesEditorUI ui = new PopulationZonesEditorUI( - new JAXXInitialContext().add(new InputAction()).add(origine.getRegion())); - ui.setBean(origine.getBean()); - MatrixND m = (MatrixND) value; - ui.getFieldPopulationMappingZoneReproZoneRecru().setMatrix(m == null ? null : m.clone()); - ui.setActif(true); - ui.refresh(); - result = ui; - } else if (result instanceof PopulationMigrationMigrationUI) { - PopulationMigrationMigrationUI origine = (PopulationMigrationMigrationUI) component; - PopulationMigrationMigrationUI ui = new PopulationMigrationMigrationUI( - new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - MatrixND m = (MatrixND) value; - ui.getPopInfo().setMigrationMatrix(m == null ? null : m.clone()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } else if (result instanceof PopulationMigrationEmigrationUI) { - PopulationMigrationEmigrationUI origine = (PopulationMigrationEmigrationUI) component; - PopulationMigrationEmigrationUI ui = new PopulationMigrationEmigrationUI( - new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - MatrixND m = (MatrixND) value; - ui.getPopInfo().setEmigrationMatrix(m == null ? null : m.clone()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } else if (result instanceof PopulationMigrationImmigrationUI) { - PopulationMigrationImmigrationUI origine = (PopulationMigrationImmigrationUI) component; - PopulationMigrationImmigrationUI ui = new PopulationMigrationImmigrationUI( - new JAXXInitialContext().add(new InputAction())); - ui.setBean(origine.getBean()); - ui.setPopInfo(origine.getPopInfo()); - MatrixND m = (MatrixND) value; - ui.getPopInfo().setImmigrationMatrix(m == null ? null : m.clone()); - ui.setActif(true); - ui.refreshPanel(); - result = ui; - } - } catch (IllegalAccessException ex) { - if (log.isErrorEnabled()) { - log.error("Can't make new instance of " + component, ex); - } - } catch (InstantiationException ex) { - if (log.isErrorEnabled()) { - log.error("Can't make new instance of " + component, ex); - } - } - return result; - } - - /** - * Return value in swing component that could be next used into factor. - * - * @param component component - * @return factor value - */ - public static Object getValue(JComponent component) { - Object result = null; - if (component instanceof JTextComponent) { - result = ((JTextComponent) component).getText(); - } else if (component instanceof NumberEditor) { - result = ((NumberEditor) component).getModel(); - } else if (component instanceof PopulationZonesEditorUI) { - result = ((PopulationZonesEditorUI) component) - .getFieldPopulationMappingZoneReproZoneRecru().getMatrix(); - } else if (component instanceof MatrixPanelEditor) { - result = ((MatrixPanelEditor) component).getMatrix(); - - } else if (component instanceof JComboBox) { - result = ((JComboBox) component).getSelectedItem(); - - } else if (component instanceof JList) { - result = ((JList) component).getSelectedValues(); - - } else if (component instanceof JCheckBox) { - result = ((JCheckBox) component).isSelected(); - - } else if (component instanceof JRadioButton) { - result = ((JRadioButton) component).isSelected(); - - } else if (component instanceof InputOneEquationUI) { - result = ((InputOneEquationUI) component).getEditor().getText(); - - } else if (component instanceof SpeciesStructuredUI) { - result = ((SpeciesStructuredUI) component) - .getFieldSpeciesDynamicAge().isSelected(); - - } else if (component instanceof SelectivityEditorUI) { - result = ((SelectivityEditorUI) component).getBean() - .getPopulationSelectivity(); - - } else if (component instanceof MetierSeasonInfoSpeciesEditorUI) { - result = ((MetierSeasonInfoSpeciesEditorUI) component) - .getMetierSeasonInfo().getSpeciesTargetSpecies(); - - } else if (component instanceof PopulationZonesEditorUI) { - result = ((PopulationZonesEditorUI) component) - .getFieldPopulationMappingZoneReproZoneRecru().getMatrix(); - - } /*else if (component instanceof RangeOfValuesUI) { - - } */else if (component instanceof PopulationMigrationMigrationUI) { - result = ((PopulationMigrationMigrationUI) component).getPopInfo() - .getMigrationMatrix(); - - } else if (component instanceof PopulationMigrationEmigrationUI) { - result = ((PopulationMigrationEmigrationUI) component).getPopInfo() - .getEmigrationMatrix(); - - } else if (component instanceof PopulationMigrationImmigrationUI) { - result = ((PopulationMigrationImmigrationUI) component) - .getPopInfo().getImmigrationMatrix(); - } - return result; - } - - /** - * Return if component is instanceof {@link RangeOfValuesUI}. - * @param component component - * @return {@code true} if component is intance of {@link RangeOfValuesUI} - */ - public static boolean isRangeOfValue(JComponent component) { - if (component instanceof RangeOfValuesUI) { - return true; - } - return false; - } - - /** - * Return if component is is continue factor enable. - * - * @param component component - * @return {@code true} if component is is continue factor enable - */ - public static boolean isContinue(JComponent component) { - if (component instanceof RangeOfValuesUI) { - RangeOfValuesUI ui = (RangeOfValuesUI) component; - if (ui.getFieldGearParamType().getSelectedItem().equals("Float")) { - String value = ui.getFieldGearParamPossibleValue().getText(); - if (value.matches("^\\ *[0-9]*\\ *\\-\\ *[0-9]*\\ *$")) { - return true; - } - } - } - return false; - } - - /** - * Return true if component or entity can be defined in continuous factor. - * - * @param component component - * @param entity entity - * @return continuous enabled - */ - public static boolean canBeContinue(JComponent component, - TopiaEntity entity) { - String fieldName = (String) component.getClientProperty("method"); - if (component instanceof JTextComponent) { - Object o = getMethodValue(entity, fieldName); - return canBeContinue(component, o); - } else if (component instanceof NumberEditor) { - return true; - } else if (component instanceof InputOneEquationUI) { - return true; - } else if (component instanceof MatrixEditor) { - return true; - } else if (component instanceof RangeOfValuesUI) { - RangeOfValuesUI ui = (RangeOfValuesUI) component; - if (ui.getFieldGearParamType().getSelectedItem().equals("Float")) { - return true; - } - } - return false; - } - - /** - * Return true if component or value can be defined in continuous factor. - * - * @param component component - * @param value value - * @return continuous enabled - */ - public static boolean canBeContinue(JComponent component, Object value) { - boolean result = false; - - if (component instanceof JTextComponent) { - if (value instanceof Double) { - result = true; - } else if (value instanceof Long) { - result = true; - } - } - else if (component instanceof InputOneEquationUI) { - result = true; - } - else if (component instanceof MatrixPanelEditor) { - result = true; - } - // Metier.gearPossibleValue case - else if (value instanceof RangeOfValues) { - RangeOfValues rangeOfValues = (RangeOfValues)value; - if (rangeOfValues.getType().equals("Float")) { - result = true; - } - } - - if (log.isDebugEnabled()) { - log.debug("Component " + component.getClass().getSimpleName() + - " with value " + value + "(" + value.getClass().getSimpleName() + ") can be continuous : " + result); - } - return result; - } - - /** - * Get value for fieldName in entity. - * - * @param entity - * @param fieldName - * @return method return value - */ - protected static Object getMethodValue(Object entity, String fieldName) { - Object result = null; - try { - // fieldName maybe be sometime lower case - String getMethod = "get" + StringUtils.capitalize(fieldName); - - Method m = entity.getClass().getMethod(getMethod); - result = m.invoke(entity); - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't get entity value", ex); - } - } - return result; - } - - // RangeOfValue - public static ContinuousPanelContainerUI getContinuousRangeOfValuePanel( - JComponent cOrigine, TopiaEntity bean) { - DefaultContinuousPanelUI continuousPanel = new DefaultContinuousPanelUI(); - RangeOfValuesUI ui = (RangeOfValuesUI) cOrigine; - String value = ui.getFieldGearParamPossibleValue().getText(); - String min = "0"; - String max = "0"; - if (value.matches("^\\ *[0-9]*\\ *\\-\\ *[0-9]*\\ *$")) { - int first = 0; - if (value.startsWith("-")) { - first = 1; - } - first = value.indexOf("-"); - if (first != -1) { - min = value.substring(0, first); - max = value.substring(first + 1); - } - } - continuousPanel.init(new JTextField(min), new JTextField(max)); - return continuousPanel; - } - - public static List<String> getDiscretRangeOfValueValues( - JComponent cOrigine, TopiaEntity bean) { - List<String> result = new ArrayList<String>(); - RangeOfValuesUI ui = (RangeOfValuesUI) cOrigine; - String value = ui.getFieldGearParamPossibleValue().getText(); - if (value.matches("^\\ *[0-9]*\\ *\\-\\ *[0-9]*\\ *$")) { - int first = 0; - if (value.startsWith("-")) { - first = 1; - } - first = value.indexOf("-"); - int min = 0; - int max = 0; - if (first != -1) { - min = Integer.valueOf(value.substring(0, first).trim()); - max = Integer.valueOf(value.substring(first + 1).trim()); - } - for (int i = min; i <= max; i++) { - result.add(i + ""); - } - } else { - if (value.indexOf(";") != -1) { - for (String s : value.split("\\;")) { - result.add(s); - } - } else { - result.add(value); - } - } - return result; - } - - /** - * Return the component to edit factor depending on factor path. - * (inspect the return type of entity denoted by path) - * - * Used to edit reloader factor from old simulation. - * - * @param factor factor - * @param context context - * @return component - */ - public static JComponent getEditorForFactor(Factor<?, ?> factor, TopiaContext context) { - JComponent result = null; - - // we can't do it only with path maybe ? - // need to check property type with introspection - String path = factor.getPath(); - - if (log.isDebugEnabled()) { - log.debug("Try to find component for path " + path); - } - - String topiaId = path.substring(0, path.lastIndexOf('#')); - String property = path.substring(path.lastIndexOf('#') + 1); - - Class<?> typeClazz = null; - try { - TopiaEntity entity = context.findByTopiaId(topiaId); - - if (log.isDebugEnabled()) { - log.debug("Factor " + factor.getName() + " denoted entity " + entity); - } - - String getter = "get" + StringUtils.capitalize(property); - Method method = entity.getClass().getMethod(getter); - typeClazz = method.getReturnType(); - - if (log.isDebugEnabled()) { - log.debug("Property " + property + " denoted type " + typeClazz.getSimpleName()); - } - - result = getEditorForType(typeClazz); - - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't find entity for " + topiaId, ex); - } - } catch (SecurityException ex) { - if (log.isErrorEnabled()) { - log.error("Can't get type info for " + topiaId, ex); - } - } catch (NoSuchMethodException ex) { - if (log.isErrorEnabled()) { - log.error("Can't get type info for " + topiaId, ex); - } - } - - return result; - } - - /** - * Get editor for type. - * - * @param typeClazz type to get editor - * @return component - */ - public static JComponent getEditorForType(Class<?> typeClazz) { - - JComponent result = null; - - if (Double.class.isAssignableFrom(typeClazz)) { - result = new JTextField(); - } - else if (double.class.isAssignableFrom(typeClazz)) { - result = new JTextField(); - } - else if (MatrixND.class.isAssignableFrom(typeClazz)) { - result = new MatrixPanelEditor(); - } - else if (Equation.class.isAssignableFrom(typeClazz)) { - result = new InputOneEquationUI(); - } - - return result; - } - - /** - * Get editor for editing value. - * - * @param bean bean - * @param beanProperty bean property - * @return component - */ - public static JComponent getEditorForValue(Object bean, String beanProperty) { - Object basicType = getMethodValue(bean, beanProperty); - - JComponent component = null; - - if (basicType instanceof Equation) { - Equation basicEquation = (Equation)basicType; - InputOneEquationUI equationComponent = new InputOneEquationUI( - new JAXXInitialContext().add(new InputAction())); - equationComponent.setFormuleCategory(basicEquation.getCategory()); - equationComponent.setBean((TopiaEntity)bean); - equationComponent.setBeanProperty(beanProperty); - equationComponent.putClientProperty("method", beanProperty); - component = equationComponent; - } - - return component; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -24,8 +24,27 @@ --> <ContinuousPanelContainerUI> + <import> + java.awt.Component + java.awt.Dimension + java.util.ArrayList + java.util.EventObject + java.util.List + java.util.regex.Matcher + java.util.regex.Pattern + javax.swing.table.AbstractTableModel + javax.swing.table.DefaultTableModel + javax.swing.table.TableCellEditor + javax.swing.table.TableModel + javax.swing.JComboBox + javax.swing.DefaultCellEditor + javax.swing.event.CellEditorListener + fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain + org.apache.commons.lang.StringUtils + </import> + <String id='text' javaBean='null'/> - <org.nuiton.topia.persistence.TopiaEntity id='bean' javaBean='null'/> + <org.nuiton.topia.persistence.TopiaEntityContextable id='bean' javaBean='null'/> <String id='beanProperty' javaBean='null'/> <!-- For editor doc purpose --> <Class id='clazz' javaBean='null'/> @@ -34,139 +53,47 @@ <!-- bean property --> <fr.ifremer.isisfish.entities.Formule id='formule' javaBean='null'/> + <Boolean id="selectedDomain" javaBean="false" /> + <Boolean id="percentageTypeDomain" javaBean="false" /> + <script><![CDATA[ -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableModel; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableModel; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; -protected String[] columnNames = { - _("isisfish.sensitivity.equation.variable.name"), - _("isisfish.sensitivity.equation.variable.value"), - _("isisfish.sensitivity.equation.variable.coefficient"), - _("isisfish.sensitivity.equation.variable.operator"), - _("isisfish.sensitivity.equation.variable.action")}; -protected java.util.List<EquationContinuousDomain> datas = new ArrayList<EquationContinuousDomain>(); -protected java.util.List<JComboBox> operateurs = new ArrayList<JComboBox>(); -protected java.util.List<JButton> actions = new ArrayList<JButton>(); +protected List<EquationContinuousDomain> domains = new ArrayList<EquationContinuousDomain>(); -public java.util.List<EquationContinuousDomain> getDomains(){ - return datas; +public List<EquationContinuousDomain> getDomains() { + return domains; } -public void setDomains(java.util.List<EquationContinuousDomain> domains){ - datas.clear(); - for (EquationContinuousDomain d : domains){ - addDomain(d); - } +protected void addDomain(EquationContinuousDomain domain) { + domains.add(domain); + // fire data change + variablesListModel.setDomains(domains); } -public void addDomain(EquationContinuousDomain domain){ - newButton(); - datas.add(domain); -} - -protected AbstractTableModel getTableModel() { - AbstractTableModel model = new AbstractTableModel() { - @Override - public int getRowCount() { - return datas.size(); - } - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return true; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - if (columnIndex == 0) { - return datas.get(rowIndex).getVariableName(); - } else if (columnIndex == 1) { - return datas.get(rowIndex).getReferenceValue(); - } else if (columnIndex == 2) { - Double result = datas.get(rowIndex).getCoefficient() * 100; - return result; - } else if (columnIndex == 3) { - return datas.get(rowIndex).getOperator(); - } else if (columnIndex == 4) { - return _("isisfish.sensitivity.validDiscretNumber"); - } - return null; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - if (String.class.isInstance(aValue)) { - if (!((String)aValue).equals("")) { - if (columnIndex == 0){ - datas.get(rowIndex).setVariableName((String)aValue); - } else if (columnIndex == 1) { - datas.get(rowIndex).setReferenceValue(Double.parseDouble((String)aValue)); - } else if (columnIndex == 2) { - datas.get(rowIndex).setCoefficient(Double.parseDouble((String)aValue) / 100); - } else if (columnIndex == 3) { - datas.get(rowIndex).setOperator((String)aValue); - } - } - } - } - - @Override - public String getColumnName(int col) { - return columnNames[col].toString(); - } - - }; - return model; -} -protected JComboBox getOperateur(){ - JComboBox result = new JComboBox(); - result.addItem("+"); - result.addItem("-"); - result.addItem("*"); - result.addItem("/"); - operateurs.add(result); - result.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JComboBox source = (JComboBox)e.getSource(); - int i = operateurs.indexOf(source); - if (datas.size() <= i){ - datas.get(i).setOperator((String)source.getSelectedItem()); - } - } - }); - return result; -} -protected void newButton(){ - JButton result = new JButton(); - result.setText(_("isisfish.sensitivity.validDiscretNumber")); - actions.add(result); - result.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - JButton source = (JButton)e.getSource(); - int i = actions.indexOf(source); - valid(i); - } - }); -} -protected JButton getActionButton(int i){ - return actions.get(i); -} -protected void valid(int i) { - String variableName = datas.get(i).getVariableName(); +/** + * Valid selected domain. + */ +protected void validSelectedDomain() { + // fill selected + EquationContinuousDomain selectedDomain = (EquationContinuousDomain)variablesList.getSelectedValue(); + selectedDomain.setVariableName(variableNameField.getText().trim()); + if (isPercentageTypeDomain()) { + selectedDomain.setPercentageType(true); + selectedDomain.setReferenceValue(Double.parseDouble(referenceValueField.getText())); + selectedDomain.setCoefficient(Double.parseDouble(coefficientField.getText()) / 100); + } else { + selectedDomain.setPercentageType(false); + selectedDomain.setMinBound(Double.parseDouble(minBoundField.getText())); + selectedDomain.setMaxBound(Double.parseDouble(maxBoundField.getText())); + } + + + // parse equation content to replace + // double xxx = 4.0; + // by + // double xxx = context.getValueAndCompute("myfactorname.xxx", 4.0) + // if xxx is the variable name to replace + String variableName = selectedDomain.getVariableName(); String[] lines = editor.getEditor().getText().split("\n"); String result = ""; for (String line : lines) { @@ -179,94 +106,204 @@ result += line + "\n"; } editor.getEditor().setText(result); + + // fire data change + variablesListModel.setDomains(domains); } -protected void setTable(){ - params.setModel(getTableModel()); - // poussin 20090512, marche pas, impossible d'affiche la combo dans l'interface: - // chatellier , si mais seulement en edition - params.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(getOperateur())); - params.getColumnModel().getColumn(4).setCellEditor(new TableCellEditor() { - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - return getActionButton(row); - } +protected void addNewVariable() { + EquationContinuousDomain domain = new EquationContinuousDomain(); + domain.setVariableName("X"); + addDomain(domain); + + // auto select + variablesList.setSelectedValue(domain, true); +} - @Override - public Object getCellEditorValue() { - return null; +protected void displaySelectedDomain() { + EquationContinuousDomain selectedDomain = (EquationContinuousDomain)variablesList.getSelectedValue(); + if (selectedDomain != null) { + setSelectedDomain(true); + variableNameField.setText(selectedDomain.getVariableName()); + setPercentageTypeDomain(selectedDomain.getCoefficient() != null); + if (selectedDomain.getCoefficient() != null) { + coefficientField.setText(String.valueOf(selectedDomain.getCoefficient() * 100)); + } else { + coefficientField.setText(""); } - - @Override - public boolean isCellEditable(EventObject anEvent) { - return true; + if (selectedDomain.getReferenceValue() != null) { + referenceValueField.setText(selectedDomain.getReferenceValue().toString()); + } else { + referenceValueField.setText(""); } - - @Override - public boolean shouldSelectCell(EventObject anEvent) { - return true; + if (selectedDomain.getMinBound() != null) { + minBoundField.setText(selectedDomain.getMinBound().toString()); + } else { + minBoundField.setText(""); } - - @Override - public boolean stopCellEditing() { - return true; + if (selectedDomain.getMaxBound() != null) { + maxBoundField.setText(selectedDomain.getMaxBound().toString()); + } else { + maxBoundField.setText(""); } + } else { + setSelectedDomain(false); + } +} - @Override - public void cancelCellEditing() { - } +protected void removeSelectedVariable() { + int selectedIndex = variablesList.getSelectedIndex(); + domains.remove(selectedIndex); + + // fire data change + variablesListModel.setDomains(domains); +} - @Override - public void addCellEditorListener(CellEditorListener l) { - } + at Override +public boolean isFactorValid() { + boolean valid = true; - @Override - public void removeCellEditorListener(CellEditorListener l) { + try { + for (EquationContinuousDomain domain : domains) { + if (StringUtils.isBlank(domain.getVariableName())) { + valid = false; + } + else if (domain.getCoefficient() == null) { + valid = domain.getMinBound() != null && domain.getMaxBound() != null; + } + else { + valid = domain.getReferenceValue() != null; + } } - }); -} -protected void add() { - EquationContinuousDomain domain = new EquationContinuousDomain(); - // fixe NPE in table model renderer - domain.setCoefficient(1.0); - datas.add(domain); - newButton(); - setTable(); -} -protected void remove() { - int i = params.getSelectedRow(); - if (i != -1){ - datas.remove(i); - operateurs.remove(i); - actions.remove(i); - setTable(); + } catch (NumberFormatException ex) { + valid = false; } + + return valid; } ]]></script> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='both' columns='2' weightx='1' weighty='0.5'> - <JScrollPane preferredSize="{new Dimension(200, 150)}"> - <JTable id='params' visible='{isContinuePossible()}' model='{getTableModel()}' - enabled='{isContinueSelected()}' /> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='add' text='isisfish.common.add' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='add()'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' text='isisfish.common.remove' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='remove()'/> - </cell> - </row> - <row> - <cell fill='both' columns='2' weightx='1' weighty='0.5'> - <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='editor' formule='{getFormule()}' text='{getText()}' - constructorParams='this' bean='{getBean()}' clazz='{getClazz()}' beanProperty='{getBeanProperty()}' actif='{isContinueSelected()}' - formuleCategory='{getFormuleCategory()}' selectedEquation='{getSelectedEquation()}' - visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - </row> - </Table> -</ContinuousPanelContainerUI> \ No newline at end of file + <JPanel id='content'> + <JScrollPane constraints='BorderLayout.CENTER'> + <Table> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JScrollPane preferredSize="{new Dimension(200, 150)}"> + <fr.ifremer.isisfish.ui.sensitivity.equation.EquationDomainListModel + id="variablesListModel" constructorParams="domains" /> + <JList id="variablesList" model="{variablesListModel}" + cellRenderer="{new fr.ifremer.isisfish.ui.sensitivity.equation.EquationDomainRenderer()}"/> + <ListSelectionModel initializer="variablesList.getSelectionModel()" + onValueChanged="displaySelectedDomain();setSelectedDomain(variablesList.getSelectedIndex() != -1)" /> + </JScrollPane> + </cell> + <cell fill='both' weightx='1' weighty='1'> + <Table> + <row> + <cell> + <JLabel text="isisfish.sensitivity.equation.variablename" enabled='{isSelectedDomain()}' /> + </cell> + <cell fill="horizontal"> + <JTextField id="variableNameField" enabled='{isSelectedDomain()}'/> + </cell> + </row> + <row> + <cell fill="horizontal" columns="2"> + <JRadioButton id="percentageTypeButton" text="isisfish.sensitivity.continuouspercentagetype" + onActionPerformed="setPercentageTypeDomain(percentageTypeButton.isSelected())" + selected="{isPercentageTypeDomain()}" + enabled='{isSelectedDomain()}'/> + </cell> + </row> + <row> + <cell fill="both" weightx='1' weighty='1' columns="2"> + <Table border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.referencevalue' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && isPercentageTypeDomain()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='referenceValueField' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && isPercentageTypeDomain()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.coefficient' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && isPercentageTypeDomain()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='coefficientField' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && isPercentageTypeDomain()}'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill="horizontal" columns="2"> + <JRadioButton id="minMaxButton" text="isisfish.sensitivity.continuousminmaxtype" + onActionPerformed="setPercentageTypeDomain(!minMaxButton.isSelected())" + selected="{!isPercentageTypeDomain()}" + enabled='{isSelectedDomain() && isContinueSelected()}'/> + </cell> + </row> + <row> + <cell fill="both" weightx='1' weighty='1' columns="2"> + <Table border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.firstValue' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && !isPercentageTypeDomain()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='minBoundField' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && !isPercentageTypeDomain()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.lastValue' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && !isPercentageTypeDomain()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='maxBoundField' visible='{isContinuePossible()}' + enabled='{isSelectedDomain() && !isPercentageTypeDomain()}'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill="horizontal" columns="2"> + <JButton text="isisfish.sensitivity.equation.valid" + enabled='{isSelectedDomain()}' + onActionPerformed='validSelectedDomain()' /> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JButton id='add' text='isisfish.common.add' visible='{isContinuePossible()}' + enabled='{isContinueSelected()}' onActionPerformed='addNewVariable()'/> + </cell> + <cell fill='horizontal'> + <JButton id='remove' text='isisfish.common.remove' visible='{isContinuePossible()}' + enabled='{isSelectedDomain()}' onActionPerformed='removeSelectedVariable()'/> + </cell> + </row> + <row> + <cell fill='both' columns='2' weightx='1' weighty='1'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='editor' constructorParams='this' + autoSaveModification="false" formule='{getFormule()}' text='{getText()}' + bean='{getBean()}' clazz='{getClazz()}' beanProperty='{getBeanProperty()}' active='{isContinueSelected()}' + formuleCategory='{getFormuleCategory()}' selectedEquation='{getSelectedEquation()}' + visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + </row> + </Table> + </JScrollPane> + </JPanel> +</ContinuousPanelContainerUI> Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,73 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; -import java.util.List; - -import javax.swing.JLabel; -import javax.swing.JTree; -import javax.swing.tree.DefaultTreeCellRenderer; - -import fr.ifremer.isisfish.simulator.sensitivity.Factor; - -/** - * Factor tree cell renderer. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class FactorTreeCellRenderer extends DefaultTreeCellRenderer { - - /** serialVersionUID. */ - private static final long serialVersionUID = 1686424876690392268L; - - /* - * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) - */ - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean selected, boolean expanded, boolean leaf, int row, - boolean hasFocus) { - - JLabel c = (JLabel)super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - - if (value instanceof List<?>) { - c.setText(_("isisfish.sensitivity.factors") + " : "); - } - else if (value instanceof Factor<?, ?>) { - Factor<? ,?> factor = (Factor<?, ?>)value; - c.setText(factor.getName()); - } - - return c; - } -} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,156 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -import fr.ifremer.isisfish.simulator.sensitivity.Factor; - -/** - * Cette classe gere l'affichage d'une liste de facteurs dans l'arbre. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date: 2008-06-13 11:05:57 +0200 (ven., 13 juin 2008) - * $ By : $Author$ - */ -public class FactorTreeModel implements TreeModel { - - /** serialVersionUID. */ - private static final long serialVersionUID = 593284613450915826L; - - /** Tree model root. */ - protected List<Factor<?,?>> factorsList; - - /** Tree model listeners. */ - protected Collection<TreeModelListener> modelListeners; - - /** - * Constructor. - * - * @param factorsList factors list - */ - public FactorTreeModel(List<Factor<?,?>> factorsList) { - this.factorsList = factorsList; - modelListeners = new ArrayList<TreeModelListener>(); - } - - /* - * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int) - */ - @Override - public Object getChild(Object parent, int index) { - - Object value = null; - - if (parent instanceof List) { - List<Factor<?,?>> factors = (List<Factor<?,?>>)parent; - value = factors.get(index); - } - - return value; - } - - /* - * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object) - */ - @Override - public int getChildCount(Object parent) { - - int childCount = 0; - - if (parent instanceof List) { - List<Factor<?,?>> factors = (List<Factor<?,?>>)parent; - childCount = factors.size(); - } - - return childCount; - } - - /* - * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object) - */ - @Override - public int getIndexOfChild(Object parent, Object child) { - - int childIndex = -1; - - if (parent instanceof List) { - List<Factor<?,?>> factors = (List<Factor<?,?>>)parent; - childIndex = factors.indexOf(child); - } - - return childIndex; - } - - /* - * @see javax.swing.tree.DefaultTreeModel#isLeaf(java.lang.Object) - */ - @Override - public boolean isLeaf(Object node) { - return getChildCount(node) == 0; - } - - /* - * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener) - */ - @Override - public void addTreeModelListener(TreeModelListener l) { - modelListeners.add(l); - } - - /* - * @see javax.swing.tree.TreeModel#getRoot() - */ - @Override - public Object getRoot() { - return factorsList; - } - - /* - * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener) - */ - @Override - public void removeTreeModelListener(TreeModelListener l) { - modelListeners.remove(l); - } - - /* - * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object) - */ - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - throw new RuntimeException("Not implemented"); - } - -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -24,262 +24,134 @@ --> <JDialog title='isisfish.sensitivity.title' modal='{true}' layout='{new BorderLayout()}'> - <Boolean id='continuePossible' javaBean='true'/> + <import> + org.apache.commons.lang.StringUtils; + org.nuiton.topia.persistence.TopiaEntityContextable; + fr.ifremer.isisfish.ui.SimulationUI; + fr.ifremer.isisfish.ui.simulator.SimulAction; + fr.ifremer.isisfish.ui.input.InputSaveVerifier; + fr.ifremer.isisfish.simulator.sensitivity.Factor; + fr.ifremer.isisfish.simulator.sensitivity.Domain; + fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; + fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; + fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; + java.util.SortedMap + javax.swing.JComponent + </import> - <Boolean id='continueSelected' javaBean='false'/> + <SensitivityInputHandler id="handler" /> - <Boolean id='saveEnabled' javaBean='false'/> + <Boolean id='continuePossible' javaBean='false'/> + <Boolean id='continueSelected' javaBean='false'/> + <Boolean id='existingValue' javaBean='false'/> + <String id="factorPath" javaBean="null"/> + <script><![CDATA[ -import org.apache.commons.lang.StringUtils; -import org.nuiton.topia.persistence.TopiaEntity; -import fr.ifremer.isisfish.ui.simulator.SimulAction; -import fr.ifremer.isisfish.ui.input.InputSaveVerifier; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; -import fr.ifremer.isisfish.simulator.sensitivity.Domain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; -protected JComponent cOrigine = null; -protected TopiaEntity bean = null; protected java.util.List<JComponent> discretComponents = new ArrayList<JComponent>(); -protected String path = null; protected ContinuousPanelContainerUI continuousPanel = null; -protected Factor factor = null; -addPropertyChangeListener("continuePossible", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (continuousPanel != null) { - continuousPanel.setContinuePossible((Boolean)evt.getNewValue()); - } - } -}); - -addPropertyChangeListener("continueSelected", new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (continuousPanel != null) { - continuousPanel.setContinueSelected((Boolean)evt.getNewValue()); - } - } -}); - -public void initNew(JComponent c, TopiaEntity be, Boolean b) { - this.bean = be; - this.cOrigine = c; - - // path is topiaId#property - // ex : fwn#fsd#0.3425345#name - // for JAXX : cOrigine start with upper case - // for commons beanutils : must be lower case - String methodName = StringUtils.uncapitalize(EditorHelper.getMethod(cOrigine)); - this.path = bean.getTopiaId() + "#" + methodName; - - factorName.setText(bean.toString() + "." + methodName); - setContinuePossible(b); - boolean selected = EditorHelper.isContinue(cOrigine); - setContinueSelected(selected); - continueRadio.setSelected(selected); - if (isContinuePossible()){ - if (EditorHelper.isRangeOfValue(cOrigine)) { - continuousPanel = EditorHelper.getContinuousRangeOfValuePanel(cOrigine, bean); - } - else { - continuousPanel = EditorHelper.getContinuousPanel(cOrigine, bean); - } - init(); - } - if (!isContinueSelected() && EditorHelper.isRangeOfValue(cOrigine)) { - int i = 0; - for (String s : EditorHelper.getDiscretRangeOfValueValues(cOrigine, bean)) { - JTextField text = new JTextField(s); - discretComponents.add(text); - tabPane.add(text, "Factor " + (i+1)); - i++; - } - } - if (continuousPanel != null) { - continuousPanel.setContinueSelected(selected); - } - setContinueSelected(EditorHelper.isContinue(cOrigine)); - setSaveEnabled(!factorName.getText().equals("")); -} - -public void initExisting(JComponent cOrigine, Factor f) { - setExistingValue(true); - this.cOrigine = cOrigine; - this.path = f.getPath(); - comment.setText(f.getComment()); - Domain domain = f.getDomain(); - this.factor = f; - - if (domain instanceof ContinuousDomain) { - if (domain instanceof EquationContinuousDomain) { - EquationContinuousDomain equationDomain = (EquationContinuousDomain)domain; - String factorName2 = f.getName(); - String suffix = "." + equationDomain.getVariableName(); - if (factorName2.endsWith(suffix)) { - factorName2 = factorName2.substring(0, factorName2.length()-suffix.length()); +protected void $afterCompleteSetup() { + addPropertyChangeListener(PROPERTY_CONTINUE_POSSIBLE, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (continuousPanel != null) { + continuousPanel.setContinuePossible((Boolean)evt.getNewValue()); } - factorName.setText(factorName2); } - else { - // for other ContinuousDomain name is the same - factorName.setText(f.getName()); - } - ContinuousDomain cDomain = (ContinuousDomain) domain; - - continuousPanel = EditorHelper.getContinuousPanelWithValue(cOrigine, cDomain, f); - init(); - - continueRadio.setSelected(true); - setContinueSelected(true); - setContinuePossible(true); - } else { - - // discret fator, name is the same - factorName.setText(f.getName()); - - DiscreteDomain dDomain = (DiscreteDomain)domain; - - int nb = dDomain.getValues().size(); - discretNumber.setText(nb + ""); - - discretComponents.clear(); - tabPane.removeAll(); - - SortedMap values = dDomain.getValues(); - int i = 0; - Object cache = null; - for (Object o : values.values()) { - i++; - cache = o; - JComponent c = null; - if (o != null) { - c = EditorHelper.getEditorWithValue(cOrigine, o); + }); + + addPropertyChangeListener(PROPERTY_CONTINUE_SELECTED, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (continuousPanel != null) { + continuousPanel.setContinueSelected((Boolean)evt.getNewValue()); } - else { - c = EditorHelper.getEditorWithValue(cOrigine); - } - discretComponents.add(c); - JScrollPane js = new JScrollPane(c); - tabPane.addTab("Factor " + i, js); } - setContinuePossible(EditorHelper.canBeContinue(cOrigine, cache)); - - this.pack(); - } - setSaveEnabled(!factorName.getText().equals("")); + }); } -protected void init() { - continuousPanelContainer.add(continuousPanel, BorderLayout.CENTER); - this.pack(); -} -protected JComponent getNewComponent() { - return EditorHelper.getEditor(cOrigine, bean); -} -protected void addTabs(String sNbTab) { - int nbTab = Integer.parseInt(sNbTab); - discretComponents.clear(); - tabPane.removeAll(); - for (int i=0;i<nbTab;i++) { - JComponent c = getNewComponent(); - discretComponents.add(c); - JScrollPane js = new JScrollPane(c); - tabPane.addTab("Factor " + (i+1), js); - } - this.pack(); -} -protected SensitivityAction getSensitivityAction() { - return getContextValue(SensitivityAction.class); -} protected SimulAction getSimulAction() { return getContextValue(SimulAction.class); } -protected void save() { - if (continueRadio.isSelected()) { - getSensitivityAction().saveContinue(cOrigine, factorName.getText(), comment.getText(), path, continuousPanel, getSimulAction(), isExistingValue()); - } else { - getSensitivityAction().saveDiscret(cOrigine, factorName.getText(), comment.getText(), path, discretComponents, getSimulAction(), isExistingValue()); - } - getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); - exit(); -} -protected void remove() { - getSimulAction().removeFactor(factor); - getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); - exit(); -} -protected void exit() { - this.dispose(); -} - ]]> - </script> + ]]></script> <Table constraints='BorderLayout.CENTER'> <row> - <cell columns='1' fill='horizontal'> + <cell fill='horizontal'> <JLabel text='isisfish.sensitivity.name'/> </cell> - <cell columns='3' fill='horizontal' weightx='1'> - <JTextField id='factorName' onKeyReleased='setSaveEnabled(!factorName.getText().equals(""))'/> + <cell columns='2' fill='horizontal'> + <JTextField id='factorNameField'/> </cell> </row> <row> - <cell columns='4' fill='horizontal' weightx='1'> - <JRadioButton id='continueRadio' text='isisfish.sensitivity.continue' buttonGroup='factorType' visible='{isContinuePossible()}' selected='{false}' onActionPerformed='setContinueSelected(continueRadio.isSelected())'/> + <cell columns='3' fill='both' weightx='1' weighty='3'> + <JPanel layout="{new BorderLayout()}" visible='{isContinuePossible()}'> + <JRadioButton id='continueRadio' text='isisfish.sensitivity.continue' + buttonGroup='factorType' selected='{false}' + onActionPerformed='setContinueSelected(continueRadio.isSelected())' + constraints="BorderLayout.NORTH"/> + <JPanel id='continuousPanelContainer' layout='{new BorderLayout()}' + constraints="BorderLayout.CENTER" border='{BorderFactory.createTitledBorder("")}' /> + </JPanel> </cell> </row> <row> - <cell columns='4' fill='both' weightx='1' weighty='0.5'> - <JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'/> + <cell columns='3' fill='both' weightx='1' weighty='3'> + <JPanel layout="{new BorderLayout()}"> + <JRadioButton id='discret' text='isisfish.sensitivity.discret' + selected='{true}' buttonGroup='factorType' + onActionPerformed='setContinueSelected(continueRadio.isSelected())' + constraints="BorderLayout.NORTH"/> + <Table id='discretePanelContainer' constraints="BorderLayout.CENTER" border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.selectDiscretNumber' enabled='{!isContinueSelected()}'/> + </cell> + <cell fill='horizontal' weightx='1'> + <JTextField id='discretNumber' enabled='{!isContinueSelected()}'/> + </cell> + <cell fill='horizontal'> + <JButton text='isisfish.sensitivity.validDiscretNumber' enabled='{!isContinueSelected()}' + onActionPerformed='getHandler().addTabs(this)'/> + </cell> + </row> + <row> + <cell columns='3' fill='both' weightx='1' weighty='2' anchor="north"> + <JTabbedPane id='tabPane' enabled='{!isContinueSelected()}'/> + </cell> + </row> + </Table> + </JPanel> </cell> </row> <row> - <cell columns='4' fill='horizontal' weightx='1'> - <JRadioButton id='discret' text='isisfish.sensitivity.discret' selected='{true}' buttonGroup='factorType' onActionPerformed='setContinueSelected(continueRadio.isSelected())'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.selectDiscretNumber' enabled='{!isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id='discretNumber' enabled='{!isContinueSelected()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JButton text='isisfish.sensitivity.validDiscretNumber' enabled='{!isContinueSelected()}' onActionPerformed='addTabs(discretNumber.getText())'/> - </cell> - </row> - <row> - <cell columns='4' fill='both' weightx='1' weighty='0.3'> - <JTabbedPane id='tabPane' visible='{!isContinueSelected()}' enabled='{!isContinueSelected()}'/> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal'> + <cell columns='3' fill='horizontal'> <JLabel text='isisfish.sensitivity.comment'/> </cell> </row> <row> - <cell columns='4' fill='both' weightx='1' weighty='0.3'> + <cell columns='3' fill='both' weighty='1'> <JScrollPane> <JTextArea id='comment'/> </JScrollPane> </cell> </row> <row> - <cell fill='horizontal' weightx='0.25'> - <JButton id='cancel' text='isisfish.common.cancel' onActionPerformed='exit()'/> + <cell fill='horizontal'> + <JButton id='cancel' text='isisfish.common.cancel' onActionPerformed='dispose()'/> </cell> - <cell fill='horizontal' weightx='0.25'> - <JButton id='remove' text='isisfish.common.remove' visible='{isExistingValue()}' onActionPerformed='remove()'/> + <cell fill='horizontal'> + <JButton id='remove' text='isisfish.common.remove' visible='{isExistingValue()}' + onActionPerformed='getHandler().remove(this)'/> </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JButton id='save' text='isisfish.common.save' enabled='{isSaveEnabled()}' onActionPerformed='save()'/> + <cell fill='horizontal'> + <JButton id='save' text='isisfish.common.save' enabled='{!getFactorNameField().getText().isEmpty()}' + onActionPerformed='getHandler().save(this)'/> </cell> </row> </Table> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -24,39 +24,119 @@ --> <ContinuousPanelContainerUI> - <org.nuiton.math.matrix.MatrixND id='matrix' javaBean='null'/> + <Boolean id="percentageTypeFactor" javaBean="true" /> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.value' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='both' weightx='1' weighty='1'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id='componentPanel' dimensionEdit='{false}' - matrix='{getMatrix() == null ? null : getMatrix().clone()}' visible='{isContinuePossible()}' - enabled='{isContinueSelected()}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.coefficient' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='both' columns='2' weightx='1' weighty='1'> - <JTextField id='coef' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.sensitivity.operator' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='1' columns='3'> - <JComboBox id='operator' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'> - <item id='plus' value="+"/> - <item id='moins' value="-"/> - <item id='mult' value="*"/> - <item id='div' value="/"/> - </JComboBox> - </cell> - </row> - </Table> + <import> + org.apache.commons.lang.StringUtils + org.nuiton.math.matrix.gui.MatrixPanelEditor + org.nuiton.math.matrix.MatrixND + </import> + + <script><![CDATA[ +public void init(MatrixND min, MatrixND max, MatrixND referenceValue, String coefficient) { + minValuePanel.setMatrix(min); + maxValuePanel.setMatrix(max); + referenceValuePanel.setMatrix(referenceValue); + coefficientField.setText(coefficient); +} + +public void initExisting(MatrixND min, MatrixND max, MatrixND referenceValue, String coefficient) { + init(min, max, referenceValue, coefficient); + setPercentageTypeFactor(StringUtils.isNotBlank(coefficient)); +} + + at Override +public boolean isFactorValid() { + boolean valid = false; + + try { + if (continueSelected) { + if (percentageTypeFactor) { + Double coefficient = Double.parseDouble(coefficientField.getText().trim()); + valid = coefficient != null; + } + else { + valid = true; + } + } + else { + valid = true; + } + } + catch (NumberFormatException eee) { + if (log.isWarnEnabled()) { + log.warn("Double parse error", eee); + } + } + + return valid; +} + ]]></script> + <JPanel id="content"> + <Table constraints='BorderLayout.CENTER'> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JPanel layout="{new BorderLayout()}"> + <JRadioButton text="isisfish.sensitivity.continuouspercentagetype" + onActionPerformed="setPercentageTypeFactor(true)" + selected="{isPercentageTypeFactor()}" + constraints='BorderLayout.NORTH' + enabled='{isContinueSelected()}'/> + <Table constraints='BorderLayout.CENTER' border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='horizontal' columns="2"> + <JLabel text='isisfish.sensitivity.referencevalue' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + </row> + <row> + <cell fill='both' weighty='1' columns="2"> + <MatrixPanelEditor id='referenceValuePanel' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.sensitivity.coefficient' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + <cell fill='horizontal' weightx='1'> + <JTextField id='coefficientField' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && isPercentageTypeFactor()}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JPanel layout="{new BorderLayout()}"> + <JRadioButton text="isisfish.sensitivity.continuousminmaxtype" + onActionPerformed="setPercentageTypeFactor(false)" + selected="{!isPercentageTypeFactor()}" + constraints='BorderLayout.NORTH' + enabled='{isContinueSelected()}'/> + + <Table constraints='BorderLayout.CENTER' border='{BorderFactory.createTitledBorder("")}'> + <row> + <cell fill='both' weightx='1' weighty='1'> + <JTabbedPane visible='{isContinuePossible()}' enabled='{isContinueSelected() && !isPercentageTypeFactor()}'> + <tab title="isisfish.sensitivity.firstValue"> + <MatrixPanelEditor id='minValuePanel' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </tab> + <tab title="isisfish.sensitivity.lastValue"> + <MatrixPanelEditor id='maxValuePanel' visible='{isContinuePossible()}' + enabled='{isContinueSelected() && !isPercentageTypeFactor()}'/> + </tab> + </JTabbedPane> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + </Table> + </JPanel> </ContinuousPanelContainerUI> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,148 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import static org.nuiton.i18n.I18n._; - -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import fr.ifremer.isisfish.ui.simulator.SimulAction; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import javax.swing.JComponent; -import javax.swing.JOptionPane; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.topia.persistence.TopiaEntity; - -/** - * Action for sensitivity package. - * - * @author letellier - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class SensitivityAction { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static Log log = LogFactory.getLog(SensitivityAction.class); - - public void saveContinue(JComponent cOrigine, String name, - String comment, String path, ContinuousPanelContainerUI panel, - SimulAction action, boolean exist) { - DefaultContinuousPanelUI defaultPanel = null; - if (panel instanceof MatrixContinuousPanelUI) { - MatrixContinuousPanelUI matrixPanel = (MatrixContinuousPanelUI) panel; - Double coef = Double.valueOf(matrixPanel.getCoef().getText()) / 100; - MatrixND matrix = matrixPanel.getMatrix(); - String operateur = (String) matrixPanel.getOperator() - .getSelectedItem(); - action.addContinuousMatrixFactor(name, comment, path, coef, matrix, - operateur, cOrigine, exist); - - } else if (panel instanceof EquationContinuousPanelUI) { - try { - EquationContinuousPanelUI equationPanel = (EquationContinuousPanelUI) panel; - - TopiaEntity bean = equationPanel.getBean(); - //String methodSet = equationPanel.getMethodSet(); - String property = equationPanel.getBeanProperty(); - property = StringUtils.capitalize(property) + "Content"; - Method m = bean.getClass().getMethod("set" + property, String.class); - m.invoke(bean, equationPanel.getEditor().getEditor().getText()); - - // Save equation - bean.update(); - bean.getTopiaContext().commitTransaction(); - - List<EquationContinuousDomain> domains = equationPanel - .getDomains(); - for (EquationContinuousDomain domain : domains) { - if (domain.getReferenceValue() != null - && domain.getCoefficient() != null - && domain.getCoefficient() <= 100 - && domain.getCoefficient() > 0 - && domain.getOperator() != null - && domain.getVariableName() != null) { - action.addContinuousEquationFactor(name, comment, path, - domain, cOrigine, exist); - } else { - log.warn("domain: " + domain); - log.warn("domain invalid: " - + "domain.getReferenceValue() != null(" - + (domain.getReferenceValue()) - + ") domain.getCoefficient() != null(" - + (domain.getCoefficient()) - + ") domain.getCoefficient() <= 100 (" - + (domain.getCoefficient()) - + ") domain.getCoefficient() > 0 (" - + (domain.getCoefficient()) - + ") domain.getOperator() != null (" - + (domain.getOperator()) - + ") domain.getVariableName() != null(" - + (domain.getVariableName()) + ")"); - JOptionPane.showMessageDialog(equationPanel, - _("isisfish.error.factor.invalid") - + domain.getVariableName()); - } - } - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't call method : ", ex); - } - } - } else if (panel instanceof DefaultContinuousPanelUI) { - defaultPanel = (DefaultContinuousPanelUI) panel; - action.addContinuousFactor(name, comment, path, - getMin(defaultPanel), getMax(defaultPanel), - cOrigine, exist); - } - } - - protected Double getMin(DefaultContinuousPanelUI defaultPanel) { - return Double.parseDouble(defaultPanel.getMin()); - } - - protected Double getMax(DefaultContinuousPanelUI defaultPanel) { - return Double.parseDouble(defaultPanel.getMax()); - } - - public void saveDiscret(JComponent cOrigine, String name, - String comment, String path, List<JComponent> components, - SimulAction action, boolean exist) { - List<Serializable> values = new ArrayList<Serializable>(); - for (JComponent c : components) { - values.add((Serializable) EditorHelper.getValue(c)); - } - action.addDiscreteFactor(name, comment, path, values, cOrigine, exist); - } -} \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,32 +23,38 @@ #L% --> <Table> + <import> + java.awt.CardLayout + javax.swing.ComboBoxModel + javax.swing.table.DefaultTableModel + fr.ifremer.isisfish.datastore.RegionStorage + fr.ifremer.isisfish.export.SensitivityExport + fr.ifremer.isisfish.simulator.sensitivity.Domain + fr.ifremer.isisfish.simulator.sensitivity.Factor + fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator + fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain + fr.ifremer.isisfish.ui.models.common.StringListModel + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportListModel + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportListRenderer + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportNameListRenderer + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableCellEditor + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableCellRenderer + fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableModel + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorComboModel + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorComboRenderer + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorListModel + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorListRenderer + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableCellEditor + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableCellRenderer + fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableModel + fr.ifremer.isisfish.ui.simulator.SimulAction + + </import> <script><![CDATA[ - import javax.swing.table.DefaultTableModel; - import javax.swing.table.TableModel; - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.simulator.sensitivity.Domain; - import fr.ifremer.isisfish.simulator.sensitivity.Factor; - import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; - import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; - import fr.ifremer.isisfish.export.SensitivityExport; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportListModel; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportListRenderer; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportNameListModel; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportNameListRenderer; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableCellEditor; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableCellRenderer; - import fr.ifremer.isisfish.ui.models.sensitivityexport.SensitivityExportParametersTableModel; - - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorComboModel; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorComboRenderer; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorListModel; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorListRenderer; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableCellEditor; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableCellRenderer; - import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableModel; + import fr.ifremer.isisfish.ui.sensitivity.model.FactorCardinalityTableModel; + protected SimulAction getSimulAction() { return getContextValue(SimulAction.class); } @@ -91,8 +97,16 @@ getSimulAction().setSensitivityCalculator(sensivitityCalculator); // enable/disable table (if sensivitityCalculator can manage it) - factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality()); - validate(); + //factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality()); + //validate(); + + CardLayout factorPanelLayout = (CardLayout)factorCardinalityPanel.getLayout(); + if (sensivitityCalculator.canManageCardinality()) { + factorPanelLayout.show(factorCardinalityPanel, "factorCardinalitySupported"); + } else { + factorPanelLayout.show(factorCardinalityPanel, "factorCardinalityNotSupported"); + } + // update model //setSensitivityCalculatorParamsModel(); @@ -104,46 +118,23 @@ } public void setFactorCardinalityTableModel() { - DefaultTableModel model = new DefaultTableModel() { - @Override - public boolean isCellEditable(int row, int column) { - boolean result = false; - if (column > 0) { - result = true; - } - return result; - } - }; - java.util.List<Factor<?, ?>> factors = getSimulAction().getFactors(); - - java.util.List<Factor<?, ?>> factorsContinue = new ArrayList<Factor<?, ?>>(); - java.util.List<String> factorsContinueCardinalities = new ArrayList<String>(); - for (Factor<?, ?> f : factors) { + java.util.List<Factor> factors = getSimulAction().getFactorGroup().getFactors(); + java.util.List<Factor> factorsContinue = new ArrayList<Factor>(); + /* get sublist with only Continous factor */ + for (Factor f : factors) { Domain domain = f.getDomain(); if (ContinuousDomain.class.isInstance(domain)) { ContinuousDomain continuousDomain = (ContinuousDomain)domain; factorsContinue.add(f); - factorsContinueCardinalities.add(continuousDomain.getCardinality() + ""); } } - model.addColumn(_("isisfish.sensitivity.factor"), factorsContinue.toArray()); - model.addColumn(_("isisfish.sensitivity.increment"), factorsContinueCardinalities.toArray()); - + FactorCardinalityTableModel model = new FactorCardinalityTableModel(factorsContinue); factorCardinality.setModel(model); - factorCardinality.getModel().addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - int row = e.getFirstRow(); - TableModel model = (TableModel)e.getSource(); - Factor f = (Factor) model.getValueAt(row, 0); - ((ContinuousDomain)f.getDomain()).setCardinality(Integer.parseInt((String)model.getValueAt(row, 1))); - } - }); } - protected SensitivityExportNameListModel getAvailableExportListModel() { + protected StringListModel getAvailableExportListModel() { java.util.List<String> exportNames = getSimulAction().getSensitivityExportNames(); - SensitivityExportNameListModel model = new SensitivityExportNameListModel(exportNames); + StringListModel model = new StringListModel(exportNames); return model; } @@ -221,15 +212,14 @@ exportParamsTable.setModel(model); exportParamsTable.getColumnModel().getColumn(0).setCellRenderer(new SensitivityExportParametersTableCellRenderer(export)); SensitivityExportParametersTableCellEditor cellEditor = new SensitivityExportParametersTableCellEditor(export); - cellEditor.setRegion(simulAction.getRegionStorage()); + cellEditor.setRegionStorage(getContextValue(RegionStorage.class)); exportParamsTable.getColumnModel().getColumn(1).setCellEditor(cellEditor); } else { exportParamsTable.setModel(new DefaultTableModel()); } } - ]]> - </script> + ]]></script> <row> <cell fill="horizontal"> <JLabel text="isisfish.sensitivity.select"/> @@ -248,76 +238,21 @@ </row> <row> <cell columns="2" fill="both" weightx="1.0" weighty="1.0"> - <JScrollPane id="factorCardinalityScrollPane" visible="false"> - <JTable id="factorCardinality" rowHeight='24' /> - </JScrollPane> + <JPanel id="factorCardinalityPanel" layout="{new CardLayout()}"> + <JLabel text="isisfish.sensitivity.methodfactorsupported" horizontalAlignment="center" + border="{BorderFactory.createEtchedBorder()}" font-style="italic" constraints='"factorCardinalitySupported"'/> + <JScrollPane id="factorCardinalityScrollPane" constraints='"factorCardinalityNotSupported"'> + <JTable id="factorCardinality" model="{new FactorCardinalityTableModel()}" rowHeight='24' /> + </JScrollPane> + </JPanel> </cell> </row> - <!-- <row> - <cell fill="both" columns='2' weightx="1.0" weighty="1.0"> - <Table> - <row> - <cell fill="both" weightx="1.0" weighty="1"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text="isisfish.sensitivity.export"/> - </cell> - </row> - <row> - <cell fill="horizontal"> - <JComboBox id="exportCombo" model='{getExportTableModel()}'/> - </cell> - </row> - <row> - <cell fill="both" weightx="1.0" weighty="1.0"> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="exportList" selectionMode="0" onMouseClicked='exportListSelected()'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - <cell fill="both" weighty="1.0"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text=" " minimumSize='{new Dimension(2,15)}' preferredSize='{new Dimension(2,15)}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="addExportButton" text="isisfish.common.add" onActionPerformed='addExport()'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="removeExportButton" text="isisfish.common.remove" enabled="false" onActionPerformed='removeExport()'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="clearExportsButton" text="isisfish.common.clear" enabled="false" onActionPerformed='clearExports()'/> - </cell> - </row> - <row> - <cell fill='both' weighty="1.0"> - <JPanel/> - </cell> - </row> - </Table> - </cell> - </row> - </Table> + <cell fill="both" columns='3' weightx="1.0"> + <JLabel text="isisfish.sensitivity.export"/> </cell> - </row> --> - <row> - <cell fill="both" columns='3' weightx="1.0"> - <JLabel text="isisfish.sensitivity.export"/> - </cell> - </row> - <row> + </row> + <row> <cell columns='2' fill="both" weightx="1.0" weighty="1.0"> <Table> <row> Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,1117 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.sensitivity; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.SortedMap; + +import javax.swing.JComponent; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.text.JTextComponent; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +import jaxx.runtime.context.JAXXInitialContext; + +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.gui.MatrixPanelEditor; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityContextable; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.simulator.sensitivity.Domain; +import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; +import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; +import fr.ifremer.isisfish.types.RangeOfValues; +import fr.ifremer.isisfish.ui.SimulationUI; +import fr.ifremer.isisfish.ui.input.InputAction; +import fr.ifremer.isisfish.ui.input.InputContentUI; +import fr.ifremer.isisfish.ui.input.InputHandler; +import fr.ifremer.isisfish.ui.input.InputOneEquationUI; +import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeRenderer; +import fr.ifremer.isisfish.ui.simulator.RuleChooser; +import fr.ifremer.isisfish.ui.simulator.SimulAction; + +/** + * Handler for sensitivity tab ui (fishery region factors). + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class SensitivityInputHandler extends InputHandler { + + /** Class logger. */ + private static Log log = LogFactory.getLog(SensitivityInputHandler.class); + + /** + * + * @param sensitivityTabUI + */ + public void loadFisheryRegionTree(SensitivityTabUI sensitivityTabUI) { + FisheryRegion fisheryRegion = sensitivityTabUI.getFisheryRegion(); + + if (fisheryRegion == null) { + // show empty region ui + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"none"); + TreeModel model = new DefaultTreeModel(null); + sensitivityTabUI.getFisheryRegionTree().setModel(model); + } + else { + // init tree model loader with fishery region + FisheryTreeHelper treeHelper = new FisheryTreeHelper(); + FisheryDataProvider dataProvider = new FisheryDataProvider(fisheryRegion); + treeHelper.setDataProvider(dataProvider); + TreeModel model = treeHelper.createTreeModel(fisheryRegion); + sensitivityTabUI.getFisheryRegionTree().setModel(model); + sensitivityTabUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider)); + treeHelper.setUI(sensitivityTabUI.getFisheryRegionTree(), true, false, null); + + // global context value : fisheryRegion, regionStorage, treeHelper + sensitivityTabUI.setContextValue(fisheryRegion); + sensitivityTabUI.setContextValue(treeHelper); + sensitivityTabUI.setContextValue(model); + sensitivityTabUI.setContextValue(fisheryRegion.getTopiaContext()); + + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"normale"); + } + } + + /** + * Changement de selection dans l'arbre de la pecherie. + * + * @param sensitivityTabUI + * @param event + */ + public void nodeSelectionChanged(SensitivityTabUI sensitivityTabUI, TreeSelectionEvent event) { + + TreePath newTreePath = event.getNewLeadSelectionPath(); + + if (newTreePath != null) { + Object lastTreePath = newTreePath.getLastPathComponent(); + if (lastTreePath instanceof FisheryTreeNode) { + FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath; + + Class<?> internalClass = isisTreeNode.getInternalClass(); + + // noeud qui n'en charge pas d'autres (= un bean) + TopiaEntityContextable topiaEntity = null; + String topiaId = isisTreeNode.getId(); + + try { + if (isisTreeNode.isStaticNode()) { + FisheryRegion fisheryRegion = sensitivityTabUI.getContextValue(FisheryRegion.class); + TopiaContext topiaContext = fisheryRegion.getTopiaContext(); + topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + } + + InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, sensitivityTabUI); + + // mandatory set + inputContentUI.getSaveVerifier().reset(); // before set bean !!! + if (topiaEntity != null) { + inputContentUI.getSaveVerifier().addCurrentEntity(topiaEntity); + inputContentUI.getSaveVerifier().setInputContentUI(inputContentUI); + } + + inputContentUI.setBean((TopiaEntityContextable)topiaEntity); + inputContentUI.setActive(topiaEntity != null); + inputContentUI.setLayer(true); + + // add initialized ui to panel + sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(), "normale"); + sensitivityTabUI.getInputPane().removeAll(); + sensitivityTabUI.getInputPane().add(inputContentUI, BorderLayout.CENTER); + sensitivityTabUI.getInputPane().repaint(); + sensitivityTabUI.getInputPane().validate(); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display bean " + topiaId, ex); + } + } + } + } + + /** + * Add new factor group in factor tree. + * + * @param sensitivityTabUI + */ + public void addNewFactorGroup(SensitivityTabUI sensitivityTabUI) { + String factorName = JOptionPane.showInputDialog(sensitivityTabUI, _("isisfish.sensitivity.newfactorname"), + _("isisfish.sensitivity.title"), JOptionPane.QUESTION_MESSAGE); + + if (StringUtils.isNotBlank(factorName)) { + FactorGroup rootFactorGroup = sensitivityTabUI.getSimulAction().getFactorGroup(); + FactorGroup factorGroup = new FactorGroup(factorName); + rootFactorGroup.addFactor(factorGroup); + sensitivityTabUI.setFactorModel(); + } + } + + /** + * Move factors to another factorgroup. + * + * @param sensitivityTabUI + * @param selectedFactorGroup + * @param movedFactors + */ + public void moveFactor(SensitivityTabUI sensitivityTabUI, FactorGroup selectedFactorGroup, List<Factor> movedFactors) { + //try { + // add all factors, to do first, throw + // exception if can't be done + selectedFactorGroup.addAllFactors(movedFactors); + + // remove duplicated from factor group + FactorGroup rootFactorGroup = sensitivityTabUI.getSimulAction().getFactorGroup(); + if (!rootFactorGroup.equals(selectedFactorGroup)) { + rootFactorGroup.removeAll(movedFactors); + } + for (int index = 0 ; index < rootFactorGroup.size(); ++index) { + Factor factor = rootFactorGroup.get(index); + if (factor instanceof FactorGroup) { + FactorGroup factorGroup = (FactorGroup)factor; + if (!factorGroup.equals(selectedFactorGroup)) { + factorGroup.removeAll(movedFactors); + } + } + } + sensitivityTabUI.setFactorModel(); + /*} catch (IllegalArgumentException ex) { + JOptionPane.showMessageDialog(sensitivityTabUI, _("isisfish.sensitivity.moveillegal"), + _("isisfish.sensitivity.title"), JOptionPane.ERROR_MESSAGE); + }*/ + } + + /** + * Mouse click on factors tree. + * + * <ul> + * <li>normal click : factor edit</li> + * <li>right click : popup menu</li> + * </ul> + * + * @param sensitivityTabUI ui + * @param e mouse event + */ + public void factorsTreeMouseClicked(final SensitivityTabUI sensitivityTabUI, MouseEvent e) { + // clic droit + if (e.getButton() == MouseEvent.BUTTON3) { + JPopupMenu menu = new JPopupMenu(); + JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete")); + menuItemDelete.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + deleteSelectedFactors(sensitivityTabUI); + } + }); + menu.add(menuItemDelete); + menu.show(e.getComponent(), e.getX(), e.getY()); + } + else if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { + // autre double clic + factorSelected(sensitivityTabUI); + } + } + + /** + * Factor selection, display modification wizard. + * + * @param sensitivityTabUI + */ + protected void factorSelected(SensitivityTabUI sensitivityTabUI) { + // get selected factor + TreePath selectedPath = sensitivityTabUI.getFactorsTree().getSelectionPath(); + + // method appelee au clic, donc pas forcement de selection + if (selectedPath != null) { + Object[] pathWay = selectedPath.getPath(); + Object selectedObject = pathWay[pathWay.length - 1]; + if (selectedObject != null) { + if (!(selectedObject instanceof FactorGroup)) { + Factor selectedFactor = (Factor)selectedObject; + FactorWizardUI factorWizardUI = new FactorWizardUI(sensitivityTabUI); + SensitivityInputHandler handler = factorWizardUI.getHandler(); + handler.initExistingFactor(factorWizardUI, selectedFactor); + factorWizardUI.pack(); + factorWizardUI.setLocationRelativeTo(sensitivityTabUI); + factorWizardUI.setVisible(true); + } + } + } + } + + /** + * Delete selection factors. + */ + protected void deleteSelectedFactors(SensitivityTabUI sensitivityTabUI) { + // get selected factor + TreePath[] selectedPaths = sensitivityTabUI.getFactorsTree().getSelectionPaths(); + if (!ArrayUtils.isEmpty(selectedPaths)) { // can happen + for (TreePath selectedPath : selectedPaths) { + Object[] pathWay = selectedPath.getPath(); + // > 2 : can't delete root + if (pathWay.length >= 2) { + Object selectedObject = pathWay[pathWay.length - 1]; + if (selectedObject != null) { + if (selectedObject instanceof Factor) { + Factor selectedFactor = (Factor)selectedObject; + FactorGroup selectedFactorGroup = (FactorGroup)pathWay[pathWay.length - 2]; + if (log.isDebugEnabled()) { + log.debug("Deleting factor " + selectedFactor.getName()); + } + selectedFactorGroup.remove(selectedFactor); + sensitivityTabUI.setFactorModel(); + } + } + } + } + } + } + + /** + * Un init new se fait toujours sur une entité. + * + * On recupere des info sur le type correspondant à la proprieté a mettre + * en facteur pour savoir le composant d'edition et s'il peut etre continue + * ou pas. + * + * @param factorWizardUI factorWizardUI + * @param bean bean in current ui + * @param property bean property to edit + */ + public void initNewFactor(FactorWizardUI factorWizardUI, TopiaEntityContextable bean, String property) { + + // path is topiaId#property + // ex : fwn#fsd#0.3425345#name + // for JAXX : cOrigine start with upper case + // for commons beanutils : must be lower case + String beanProperty = StringUtils.uncapitalize(property); + String path = bean.getTopiaId() + "#" + beanProperty; + factorWizardUI.setFactorPath(path); + factorWizardUI.getFactorNameField().setText(bean.toString() + "." + beanProperty); + + // get value for pointed path + //TopiaContext topiaContext = factorWizardUI.getContextValue(TopiaContext.class); + //Class<?> classForPath = getPropertyClass(path, topiaContext); + // peut etre pas une bonne idée que ce soit basé sur les valeurs + // au lieu des types (mais pour RangeOfValues, pas evident) + Object valueForPath = getPropertyValue(bean, beanProperty); + boolean continuePossible = canBeContinue(valueForPath); + boolean continueSelected = isContinue(valueForPath); + + // init panel + if (continuePossible) { + factorWizardUI.continuousPanel = getContinuousPanel(valueForPath, bean, property); + factorWizardUI.getContinuousPanelContainer().add(factorWizardUI.continuousPanel, BorderLayout.CENTER); + } + + // after, for binding on continuePossible, continueSelected to work + factorWizardUI.setContinuePossible(continuePossible); + factorWizardUI.setContinueSelected(continueSelected); + factorWizardUI.getContinueRadio().setSelected(continueSelected); + } + + /** + * Permet d'intialiser le wizard avec une valeur independante de la + * provenance (utile pour les facteurs sur les parametres de regles). + * + * TODO chatellier : ne doit pas fonctionner pour des equations. + * + * @param factorWizardUI factorWizardUI + * @param value value + */ + public void initNewFactorWithValue(FactorWizardUI factorWizardUI, Object value) { + boolean continuePossible = canBeContinue(value); + boolean continueSelected = isContinue(value); + + // init panel + if (continuePossible) { + factorWizardUI.continuousPanel = getContinuousPanel(value, null, null); + factorWizardUI.getContinuousPanelContainer().add(factorWizardUI.continuousPanel, BorderLayout.CENTER); + } + + // after, for binding on continuePossible, continueSelected to work + factorWizardUI.setContinuePossible(continuePossible); + factorWizardUI.setContinueSelected(continueSelected); + factorWizardUI.getContinueRadio().setSelected(continueSelected); + } + + /** + * Reaffiche un facteur existant. + * + * @param factorWizardUI + * @param factor factor + */ + public void initExistingFactor(FactorWizardUI factorWizardUI, Factor factor) { + + factorWizardUI.setExistingValue(true); + String factorPath = factor.getPath(); + Domain domain = factor.getDomain(); + String factorName = factor.getName(); + factorWizardUI.setFactorPath(factorPath); + factorWizardUI.getComment().setText(factor.getComment()); + + // dans le cas d'un facteur equation + // il faut enlever la varible du nom + // sinon, à la sauvegarde elle sera reajoutée + if (domain instanceof EquationContinuousDomain) { + EquationContinuousDomain equationDomain = (EquationContinuousDomain)domain; + String suffix = "." + equationDomain.getVariableName(); + factorName = StringUtils.removeEnd(factorName, suffix); + } + + if (domain instanceof ContinuousDomain) { + + ContinuousDomain cDomain = (ContinuousDomain) domain; + + TopiaContext topiaContext = factorWizardUI.getContextValue(TopiaContext.class); + factorWizardUI.continuousPanel = getContinuousPanelWithValue(factor, cDomain, topiaContext); + factorWizardUI.getContinuousPanelContainer().add(factorWizardUI.continuousPanel, BorderLayout.CENTER); + + factorWizardUI.getContinueRadio().setSelected(true); + factorWizardUI.setContinueSelected(true); + factorWizardUI.setContinuePossible(true); + } else { + + // restaure discrete domain + DiscreteDomain dDomain = (DiscreteDomain)domain; + + int nb = dDomain.getValues().size(); + factorWizardUI.getDiscretNumber().setText(String.valueOf(nb)); + factorWizardUI.discretComponents.clear(); + factorWizardUI.getTabPane().removeAll(); + + SortedMap<Object, Object> values = dDomain.getValues(); + int i = 0; + for (Object o : values.values()) { + i++; + JComponent c = null; + if (o != null) { + c = getEditorWithValue(factorWizardUI, factor, dDomain, o); + } + else { + if (log.isWarnEnabled()) { + log.warn("Null value in factor"); + } + } + factorWizardUI.discretComponents.add(c); + JScrollPane js = new JScrollPane(c); + factorWizardUI.getTabPane().addTab("Factor " + i, js); + } + + // init non selected continous panel + if (factorPath.indexOf('#') != -1) { + try { + // get initial value in database + String topiaId = factorPath.substring(0, factorPath.lastIndexOf('#')); + String property = factorPath.substring(factorPath.lastIndexOf('#') + 1); + TopiaContext topiaContext = factorWizardUI.getContextValue(TopiaContext.class); + TopiaEntityContextable entity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + String getter = "get" + StringUtils.capitalize(property); + Method m = entity.getClass().getMethod(getter); + Object valueForPath = m.invoke(entity); + + boolean continuePossible = canBeContinue(valueForPath); + factorWizardUI.setContinuePossible(continuePossible); + if (continuePossible) { + factorWizardUI.continuousPanel = getContinuousPanel(valueForPath, entity, property); + factorWizardUI.getContinuousPanelContainer().add(factorWizardUI.continuousPanel, BorderLayout.CENTER); + } + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't get factor path database value", ex); + } + } + + } + + factorWizardUI.getFactorNameField().setText(factorName); + } + + /** + * Refresh tab for discrete factor numbers. + * + * @param factorWizardUI factorWizardUI + */ + public void addTabs(FactorWizardUI factorWizardUI) { + String discreteNumber = factorWizardUI.getDiscretNumber().getText(); + int nbTab = Integer.parseInt(discreteNumber); + factorWizardUI.discretComponents.clear(); + factorWizardUI.getTabPane().removeAll(); + for (int i = 0; i < nbTab ; i++) { + JComponent c = getNewDiscreteComponent(factorWizardUI); + factorWizardUI.discretComponents.add(c); + JScrollPane js = new JScrollPane(c); + String tabName = _("isisfish.sensitivity.discretevaluelabel", (i+1)); + factorWizardUI.getTabPane().addTab(tabName, js); + } + factorWizardUI.pack(); + } + + /** + * Retourne le type de valeur pointé par le path du facteur. + * + * Il vaut mieux recuperer le type de la propriété a mettre en facteur + * que la valeur elle meme; elle peut être null et on ne peut pas en + * deduire sont type. + * + * @param factorPath factor path + * @param context context + * @return class + */ + protected Class<?> getPropertyClass(String factorPath, TopiaContext context) { + Class<?> result = null; + if (factorPath.indexOf('#') != -1) { + String topiaId = factorPath.substring(0, factorPath.lastIndexOf('#')); + String property = factorPath.substring(factorPath.lastIndexOf('#') + 1); + + try { + TopiaEntity entity = context.findByTopiaId(topiaId); + + if (log.isDebugEnabled()) { + log.debug("Factor path " + factorPath + " denoted entity " + entity); + } + + String getter = "get" + StringUtils.capitalize(property); + Method method = entity.getClass().getMethod(getter); + result = method.getReturnType(); + + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Can't find entity for " + topiaId, ex); + } + } + } + return result; + } + + /** + * Get value for fieldName in entity. + * + * @param entity + * @param fieldName + * @return method return value + */ + protected Object getPropertyValue(Object entity, String fieldName) { + Object result = null; + try { + // fieldName maybe be sometime lower case + String getMethod = "get" + StringUtils.capitalize(fieldName); + + Method m = entity.getClass().getMethod(getMethod); + result = m.invoke(entity); + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Can't get entity value", ex); + } + } + return result; + } + + /** + * Return true if value can be defined in continuous factor. + * + * Il serait plus interessant de le faire sur les types et non sur les + * valeur mais pour {@link RangeOfValues} par exemple, seule la valeur + * a un type Float... donc pas evident. + * + * @param value value + * @return continuous enabled + */ + public boolean canBeContinue(Object value) { + boolean result = false; + + if (value instanceof Double) { + result = true; + } else if (value instanceof Long) { + result = true; + } else if (value instanceof Equation) { + result = true; + } else if (value instanceof MatrixND) { + result = true; + } else if (value instanceof RangeOfValues) { + RangeOfValues rangeOfValues = (RangeOfValues)value; + if (rangeOfValues.getType().equals("Float")) { + result = true; + } + } else if (value instanceof String) { + // todo fix string value :( + result = true; + } + + return result; + } + + /** + * Return if value is is continue factor enable. + * + * @param value value to test + * @return {@code true} if value is is continue factor enable + */ + public boolean isContinue(Object value) { + boolean result = false; + if (value instanceof RangeOfValues) { + RangeOfValues range = (RangeOfValues)value; + if (range.getType().equals(RangeOfValues.TYPE_FLOAT)) { + String textValue = range.getValues(); + // TODO need comment !!! + if (textValue.matches("^\\ *[0-9]*\\ *\\-\\ *[0-9]*\\ *$")) { + result = true; + } + } + } + return result; + } + + /** + * Get copy of component with original entity value as default value. + * + * @param value value + * @param bean bean + * @param property property + * @return component copy + */ + public ContinuousPanelContainerUI getContinuousPanel(Object value, TopiaEntityContextable bean, String property) { + ContinuousPanelContainerUI result; + + if (value instanceof RangeOfValues) { + RangeOfValues rangeOfValues = (RangeOfValues)value; + DefaultContinuousPanelUI ui = new DefaultContinuousPanelUI(); + String values = rangeOfValues.getValues(); + String min = "0"; + String max = "0"; + if (values.matches("^\\ *[0-9]*\\ *\\-\\ *[0-9]*\\ *$")) { + int first = values.indexOf("-"); + if (first != -1) { + min = values.substring(0, first); + max = values.substring(first + 1); + } + } + ui.init(min, max, min, null); + result = ui; + } + else if (value instanceof Equation) { + Equation equation = (Equation)value; + EquationContinuousPanelUI ui = new EquationContinuousPanelUI(new JAXXInitialContext().add(new InputAction())); + ui.setSelectedEquation(equation); + ui.setText(_("isisfish.common.equation")); // can't get real name + ui.setFormuleCategory(equation.getCategory()); + ui.setClazz(equation.getClass()); + ui.setBeanProperty(property); + ui.setBean(bean); + result = ui; + } else if (value instanceof MatrixND) { + MatrixND matrix = (MatrixND)value; + MatrixContinuousPanelUI matrixPanel = new MatrixContinuousPanelUI(); + matrixPanel.init(matrix.clone(), matrix.clone(), matrix.clone(), null); + result = matrixPanel; + } else { + DefaultContinuousPanelUI ui = new DefaultContinuousPanelUI(); + ui.init(String.valueOf(value), String.valueOf(value), String.valueOf(value), null); + result = ui; + } + + if (log.isDebugEnabled()) { + log.debug("Component for " + value + " (" + bean + ", " + property + ")"); + log.debug(" > " + result); + } + + return result; + } + + /** + * Get continuous editor for component with given value. + * + * @param domain domain + * @param factor factor + * @param topiaContext context used to get database value in case of equation factors + * @return component copy + */ + public ContinuousPanelContainerUI getContinuousPanelWithValue(Factor factor, ContinuousDomain domain, TopiaContext topiaContext) { + ContinuousPanelContainerUI result = null; + + if (domain instanceof EquationContinuousDomain) { + String factorPath = factor.getPath(); + if (factor.getPath().indexOf('#') != -1) { + String topiaId = factorPath.substring(0, factorPath.lastIndexOf('#')); + String property = factorPath.substring(factorPath.lastIndexOf('#') + 1); + + // get bean in database + try { + TopiaEntityContextable entity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + + String getter = "get" + StringUtils.capitalize(property); + Method m = entity.getClass().getMethod(getter); + Equation value = (Equation)m.invoke(entity); + + // fill component + EquationContinuousPanelUI ui = new EquationContinuousPanelUI( + new JAXXInitialContext().add(new InputAction())); + ui.setText(value.getContent()); + ui.setFormuleCategory(value.getCategory()); + ui.setText(_("isisfish.common.equation")); // can't get real name + ui.setClazz(value.getClass()); + ui.setBeanProperty(property); + ui.setBean(entity); + + EquationContinuousDomain equationDomain = (EquationContinuousDomain) domain; + ui.addDomain(equationDomain); + + result = ui; + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't restore initial factor database property", ex); + } + } + // TODO path with no # (normalement pas possible pour les equations) + } else if (domain instanceof MatrixContinuousDomain) { + MatrixContinuousPanelUI continuousPanel = new MatrixContinuousPanelUI(); + // factor numerique continue (percentage) + if (domain.isPercentageType()) { + MatrixND matrix = (MatrixND)domain.getReferenceValue(); + // il y a bien 3 fois domain.getReferenceValue() pas d'erreur + continuousPanel.initExisting( + matrix.clone(), + matrix.clone(), + matrix.clone(), + String.valueOf(domain.getCoefficient() * 100.0)); + } + else { + // factor numerique continue (min/max) + // pas d'erreur sur 2 fois domain.getMinBound() + MatrixND matrixMin = (MatrixND)domain.getMinBound(); + MatrixND matrixMax = (MatrixND)domain.getMaxBound(); + continuousPanel.initExisting( + matrixMin.clone(), + matrixMax.clone(), + matrixMin.clone(), + ""); + } + result = continuousPanel; + } else { + DefaultContinuousPanelUI continuousPanel = new DefaultContinuousPanelUI(); + + // factor numerique continue (percentage) + if (domain.isPercentageType()) { + // il y a bien 3 fois domain.getReferenceValue() pas d'erreur + continuousPanel.initExisting( + String.valueOf(domain.getReferenceValue()), + String.valueOf(domain.getReferenceValue()), + String.valueOf(domain.getReferenceValue()), + String.valueOf(domain.getCoefficient() * 100.0 )); + } + else { + // factor numerique continue (min/max) + // pas d'erreur sur 2 fois domain.getMinBound() + // on initialise avec minBound comme valeur de référence. + continuousPanel.initExisting( + String.valueOf(domain.getMinBound()), + String.valueOf(domain.getMaxBound()), + String.valueOf(domain.getMinBound()), + ""); + } + result = continuousPanel; + } + + return result; + } + + /** + * Get editor for value (discrete). + * + * @param factorWizardUI context for context value (RegionStorage) + * @param value type to get editor + * @param factor + * @param domain + * @return component + */ + protected JComponent getEditorWithValue(FactorWizardUI factorWizardUI, Factor factor, Domain domain, Object value) { + + JComponent result = null; + + if (Double.class.isAssignableFrom(value.getClass())) { + result = new JTextField(); + ((JTextField)result).setText(String.valueOf(value)); + } + else if (double.class.isAssignableFrom(value.getClass())) { + result = new JTextField(); + ((JTextField)result).setText(String.valueOf(value)); + } + else if (MatrixND.class.isAssignableFrom(value.getClass())) { + result = new MatrixPanelEditor(); + ((MatrixPanelEditor)result).setMatrix((MatrixND)value); + } + else if (domain instanceof RuleDiscreteDomain) { + result = new RuleChooser(factorWizardUI); + ((RuleChooser)result).setRulesList((List<Rule>)value); + } + else if (domain instanceof EquationDiscreteDomain) { + String factorPath = factor.getPath(); + if (factor.getPath().indexOf('#') != -1) { + String topiaId = factorPath.substring(0, factorPath.lastIndexOf('#')); + String property = factorPath.substring(factorPath.lastIndexOf('#') + 1); + + // get bean in database + try { + TopiaContext topiaContext = factorWizardUI.getContextValue(TopiaContext.class); + TopiaEntityContextable entity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + + String getter = "get" + StringUtils.capitalize(property); + Method m = entity.getClass().getMethod(getter); + Equation equation = (Equation)m.invoke(entity); + + // fill component + InputOneEquationUI ui = new InputOneEquationUI(factorWizardUI); + ui.setAutoSaveModification(false); + ui.setFormuleCategory(equation.getCategory()); + ui.setText(_("isisfish.common.equation")); // can't get real name + ui.setClazz(value.getClass()); + ui.setBeanProperty(property); + ui.setBean(entity); // set bean fire content modification event + ui.getEditor().setText((String)value); + ui.setActive(true); + + result = ui; + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't restore initial factor database property", ex); + } + } + // TODO path with no # (normalement pas possible pour les equations) + } + else if (value instanceof String) { + // valeur nom typées ??? + result = new JTextField(); + ((JTextField)result).setText(String.valueOf(value)); + } + + if (log.isDebugEnabled()) { + log.debug("Editor for value " + value + " is " + result); + } + + return result; + } + + /** + * Get copy of component with original entity value as default value. + * Used to add new tab to a new or existing factor. + * + * @param factorWizardUI factorWizardUI + * @return component copy + */ + public JComponent getNewDiscreteComponent(FactorWizardUI factorWizardUI) { + + JComponent result = null; + String factorPath = factorWizardUI.getFactorPath(); + + if (factorPath.indexOf('#') != -1) { + String topiaId = factorPath.substring(0, factorPath.lastIndexOf('#')); + String property = factorPath.substring(factorPath.lastIndexOf('#') + 1); + TopiaContext topiaContext = factorWizardUI.getContextValue(TopiaContext.class); + + try { + // get bean in database + TopiaEntityContextable entity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId); + String getter = "get" + StringUtils.capitalize(property); + Method m = entity.getClass().getMethod(getter); + Object value = m.invoke(entity); + + // init new jcomponent for value + if (value instanceof Number) { + result = new JTextField(String.valueOf(value)); + } else if (value instanceof MatrixND) { + result = new MatrixPanelEditor(); + MatrixND matrix = ((MatrixND)value).copy(); + ((MatrixPanelEditor)result).setMatrix(matrix); + } else if (value instanceof RangeOfValues) { + RangeOfValues rangeOfValues = (RangeOfValues)value; + result = new JTextField(rangeOfValues.getValues()); + } else if (value instanceof Equation) { + Equation equation = (Equation)value; + // fill component + InputOneEquationUI ui = new InputOneEquationUI(factorWizardUI); + ui.setAutoSaveModification(false); + ui.setText(equation.getContent()); + ui.setFormuleCategory(equation.getCategory()); + ui.setText(_("isisfish.common.equation")); // can't get real name + ui.setClazz(value.getClass()); + ui.setBeanProperty(property); + ui.setBean(entity); + ui.setActive(true); + result = ui; + } + + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't restore intial factor database property", ex); + } + } + else { + // dans ce cas c'est des regles, pop de départ ou parametres de regles + // c'est un peu galere car le code n'a rien a voir avec le reste + // donc, c'est du cas par cas + if (factorPath.equals("parameters.rules")) { + result = new RuleChooser(factorWizardUI); + } + else if (factorPath.startsWith("parameters.population.")) { + MatrixContinuousPanelUI currentPanel = (MatrixContinuousPanelUI)factorWizardUI.continuousPanel; + // on copie une des matrices du composant + MatrixND matrix = currentPanel.getReferenceValuePanel().getMatrix().copy(); + result = new MatrixPanelEditor(matrix, false); + } + else if (factorPath.startsWith("parameters.rule.")) { + result = new JTextField(""); + } + else { + if (log.isWarnEnabled()) { + log.warn("Can't find component for path " + factorPath); + } + } + } + + if (log.isDebugEnabled()) { + log.debug("Component for path " + factorPath + " is " + result); + } + + return result; + } + + /** + * Save current factor. + * + * @param factorWizardUI factorWizardUI + */ + public void save(FactorWizardUI factorWizardUI) { + + // first check is faactor is valid + boolean factorValid = false; + ContinuousPanelContainerUI continuousPanel = factorWizardUI.continuousPanel; + if (continuousPanel != null) { + factorValid = continuousPanel.isFactorValid(); + } + if (!factorValid) { + JOptionPane.showMessageDialog(factorWizardUI, _("isisfish.sensitivity.factor.notvalid"), + _("isisfish.sensitivity.title"), JOptionPane.ERROR_MESSAGE); + return; + } + + // call specific method depending on continuous/discrete + if (factorWizardUI.getContinueRadio().isSelected()) { + saveContinue(factorWizardUI.getFactorNameField().getText(), + factorWizardUI.getComment().getText(), factorWizardUI.getFactorPath(), factorWizardUI.continuousPanel, + factorWizardUI.getSimulAction(), factorWizardUI.isExistingValue()); + } else { + saveDiscret(factorWizardUI.getFactorNameField().getText(), + factorWizardUI.getComment().getText(), factorWizardUI.getFactorPath(), factorWizardUI.discretComponents, + factorWizardUI.getSimulAction(), factorWizardUI.isExistingValue()); + } + + // refresh factor list + factorWizardUI.getContextValue(SimulationUI.class, "SimulationUI").refreshFactorTree(); + + // close window + factorWizardUI.dispose(); + } + + /** + * Save a continous factor. + * + * @param name factor name + * @param comment comment + * @param path factor path + * @param panel panel + * @param action action + * @param exist exist + */ + protected void saveContinue(String name, + String comment, String path, ContinuousPanelContainerUI panel, + SimulAction action, boolean exist) { + if (panel instanceof MatrixContinuousPanelUI) { + MatrixContinuousPanelUI matrixPanel = (MatrixContinuousPanelUI) panel; + if (matrixPanel.isPercentageTypeFactor()) { + MatrixND referenceValue = matrixPanel.getReferenceValuePanel().getMatrix(); + Double coefficient = Double.valueOf(matrixPanel.getCoefficientField().getText()) / 100; + action.addContinuousMatrixFactor(name, comment, path, + referenceValue, coefficient, exist); + } + else { + MatrixND minBound = matrixPanel.getMinValuePanel().getMatrix(); + MatrixND maxBound = matrixPanel.getMaxValuePanel().getMatrix(); + action.addContinuousMatrixFactor(name, comment, path, + minBound, maxBound, exist); + } + + } else if (panel instanceof EquationContinuousPanelUI) { + try { + EquationContinuousPanelUI equationPanel = (EquationContinuousPanelUI) panel; + + TopiaEntityContextable bean = equationPanel.getBean(); + TopiaContext topiaContext = bean.getTopiaContext(); + + String property = equationPanel.getBeanProperty(); + property = StringUtils.capitalize(property) + "Content"; + Method m = bean.getClass().getMethod("set" + property, String.class); + m.invoke(bean, equationPanel.getEditor().getEditor().getText()); + + // Save equation + bean.update(); + topiaContext.commitTransaction(); + + List<EquationContinuousDomain> domains = equationPanel.getDomains(); + for (EquationContinuousDomain domain : domains) { + action.addContinuousEquationFactor(name, comment, path, domain, exist); + } + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Can't call method : ", ex); + } + } + } else if (panel instanceof DefaultContinuousPanelUI) { + DefaultContinuousPanelUI defaultPanel = (DefaultContinuousPanelUI) panel; + + if (defaultPanel.isPercentageTypeFactor()) { + Double referenceValue = Double.valueOf(defaultPanel.getReferenceValueField().getText()); + Double coefficient = Double.valueOf(defaultPanel.getCoefficientField().getText()) / 100; + action.addContinuousPercentageFactor(name, comment, path, + referenceValue, coefficient, exist); + } + else { + double minBound = Double.parseDouble(defaultPanel.getContinueMin().getText()); + double maxBound = Double.parseDouble(defaultPanel.getContinueMax().getText()); + action.addContinuousFactor(name, comment, path, + minBound, maxBound, exist); + } + } + } + + /** + * Save a discret factor. + * + * @param name + * @param comment + * @param path + * @param components + * @param action + * @param exist + */ + protected void saveDiscret(String name, + String comment, String path, List<JComponent> components, + SimulAction action, boolean exist) { + List<Object> values = new ArrayList<Object>(); + + boolean ruleFactor = false; + boolean equationFactor = false; + for (JComponent component : components) { + + // get internat component value + Object result = null; + if (component instanceof JTextComponent) { + result = ((JTextComponent) component).getText(); + } else if (component instanceof MatrixPanelEditor) { + result = ((MatrixPanelEditor) component).getMatrix(); + } else if (component instanceof InputOneEquationUI) { + result = ((InputOneEquationUI) component).getEditor().getText(); + equationFactor = true; + } else if (component instanceof RuleChooser) { + result = ((RuleChooser)component).getRulesList(); + ruleFactor = true; + } + + values.add(result); + } + + if (ruleFactor) { + action.addDiscreteRuleFactor(name, comment, path, values, exist); + } else if (equationFactor) { + action.addDiscreteEquationFactor(name, comment, path, values, exist); + } else { + action.addDiscreteFactor(name, comment, path, values, exist); + } + } + + /** + * Return value in swing component that could be next used into factor + * for discrete factor values. + * + * @param component component + * @return factor value + */ + protected Object getComponentValue(JComponent component) { + Object result = null; + if (component instanceof JTextComponent) { + result = ((JTextComponent) component).getText(); + } else if (component instanceof MatrixPanelEditor) { + result = ((MatrixPanelEditor) component).getMatrix(); + } else if (component instanceof InputOneEquationUI) { + result = ((InputOneEquationUI) component).getEditor().getText(); + } else if (component instanceof RuleChooser) { + result = ((RuleChooser)component).getRulesList(); + } + if (log.isDebugEnabled()) { + log.debug("Value for component : " + component.getClass().getSimpleName() + " is " + result); + } + + return result; + } + + /** + * Remove current factor. + * + * @param factorWizardUI factorWizardUI + */ + public void remove(FactorWizardUI factorWizardUI) { + factorWizardUI.getSimulAction().removeFactor(factorWizardUI.getFactorPath()); + factorWizardUI.getContextValue(SimulationUI.class, "SimulationUI").refreshFactorTree(); + factorWizardUI.dispose(); + } +} Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,231 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import static org.nuiton.i18n.I18n._; -import fr.ifremer.isisfish.entities.Cell; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.Gear; -import fr.ifremer.isisfish.entities.Metier; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.Port; -import fr.ifremer.isisfish.entities.SetOfVessels; -import fr.ifremer.isisfish.entities.Species; -import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.Zone; -import fr.ifremer.isisfish.ui.input.*; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder.ChildBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntity; - -import javax.swing.JPanel; -import javax.swing.event.TreeSelectionEvent; -import java.awt.Component; -import jaxx.runtime.PropertyDecorator; - -/** @author letellier */ -public class SensitivityNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(SensitivityNavigationTreeSelectionAdapter.class); - - protected NavigationTreeNode currentNode = null; - protected InputContentUI currentUI = null; - protected TopiaEntity currentEntity = null; - - public SensitivityNavigationTreeSelectionAdapter(SensitivityTabUI context) { - super(SensitivityTabUI.class, null, context, Strategy.PER_UI_TYPE); - - if (context.getNavigation() == null) { - throw new IllegalArgumentException("could not have a null 'navigation' in ui " + context); - } - - // register in tree this listener - context.getNavigation().addTreeSelectionListener(this); - } - - @Override - protected JPanel getContentContainer() { - return ((SensitivityTabUI) context).getInputPane(); - } - - @Override - protected CardLayout2 getContentLayout() { - return ((SensitivityTabUI) context).getCardlayout(); - } - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return (NavigationTreeModel) ((SensitivityTabUI) context).getNavigation().getModel(); - } - - @Override - protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) { - if (e != null) { - if (log.isErrorEnabled()) { - log.error("Go bak to previous node", e); - } - } - // go back to previous node - // returnToPreviousNode(getNavigationTree(), event); - } - - - protected JAXXTree getNavigationTree() { - return ((SensitivityTabUI) context).getNavigation(); - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - super.openUI(newUI, node); - // apply refresh method (should a contract for all this ui with a method refresh...) - try { - currentUI = (InputContentUI) newUI; - if (currentUI != null){ - currentUI.setSensitivity(true); - context.getContextValue(InputSaveVerifier.class).addCurrentPanel(currentUI); - currentUI.setLayer(true); - // tabbed ui hack - currentUI.setActionButtons(); - } - currentNode = node; - } catch (Exception e) { - log.debug(e.getMessage(), e); - } - } - - @Override - protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception { - boolean exit = true; - return exit; - } - - @Override - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); - verif.removeAllEntity(); - if (TopiaEntity.class.isInstance(data)){ - verif.addCurrentEntity((TopiaEntity) data); - } - else{ - verif.addCurrentEntity(null); - } -// verif.refreshAll(); - verif.setCurrentNode(node); - } - - public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - if (regionName == null) { - return null; - } - - ChildBuilder<TopiaEntity> childBuilder = new ChildBuilder<TopiaEntity>(builder) { - - Decorator<? extends TopiaEntity> decorator; - - @Override - public void init(Class<? extends TopiaEntity> klass) { - decorator = jaxx.runtime.PropertyDecorator.newDecorator(klass, "name"); - } - - @Override - public Decorator<? extends TopiaEntity> getDecorator(TopiaEntity child) { - return decorator; - } - - @Override - public String getJXPath(TopiaEntity child) { - return "..[@topiaId=\"" + child.getTopiaId() + "\"]"; - } - - @Override - public String getNavigationPath(TopiaEntity child) { - return child.getTopiaId(); - } - }; - - try { - - NavigationTreeNode root = builder.build(null, regionName, JAXXContextEntryDef.newDef(FisheryRegion.class), "$root", FisheryRegionUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.cells"), "../cell", "$cells", CellUI.class, null), - true, Cell.class, fisheryRegion.getCell(), CellUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.zones"), "../zone", "$zones", ZoneUI.class, null), - true, Zone.class, fisheryRegion.getZone(), ZoneUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.ports"), "../port", "$ports", PortUI.class, null), - true, Port.class, fisheryRegion.getPort(), PortUI.class, null); - - NavigationTreeNode species = builder.build(root, _("isisfish.input.tree.species"), "../species", "$species", SpeciesUI.class, null); - - for (Species specie : fisheryRegion.getSpecies()) { - NavigationTreeNode speciesChild = builder.build(species, PropertyDecorator.newDecorator(Species.class, "name"), "..[@topiaId=\"" + specie.getTopiaId() + "\"]", specie.getTopiaId(), SpeciesUI.class, null); - NavigationTreeNode populations = builder.build(speciesChild, _("isisfish.input.tree.populations"), "../population", "$populations", PopulationUI.class, null); - childBuilder.build(populations, true, Population.class, specie.getPopulation(), PopulationUI.class, null); - } - - childBuilder.build(builder.build(root, _("isisfish.input.tree.gears"), "../gear", "$gears", GearUI.class, null), - true, Gear.class, fisheryRegion.getGear(), GearUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.metiers"), "../metier", "$metiers", MetierUI.class, null), - true, Metier.class, fisheryRegion.getMetier(), MetierUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.triptypes"), "../tripType", "$tripTypes", TripTypeUI.class, null), - true, TripType.class, fisheryRegion.getTripType(), TripTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.vesseltypes"), "../vesselType", "$vesselTypes", VesselTypeUI.class, null), - true, VesselType.class, fisheryRegion.getVesselType(), VesselTypeUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.setofvessels"), "../setOfVessels", "$setOfVessels", SetOfVesselsUI.class, null), - true, SetOfVessels.class, fisheryRegion.getSetOfVessels(), SetOfVesselsUI.class, null); - - childBuilder.build(builder.build(root, _("isisfish.input.tree.strategies"), "../strategy", "$strategies", StrategyUI.class, null), - true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null); - - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - } - return builder.getModel(); - } - -} Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySaveVerifier.java (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySaveVerifier.java) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySaveVerifier.java (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySaveVerifier.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,54 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.sensitivity; + +import javax.swing.JOptionPane; + +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; + +/** + * Save verifier pour l'interface de sensibilité. + * + * Surchargé pour ne rien faire. Apparement il est difficile de se passer + * d'une instance dans les interface. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class SensitivitySaveVerifier extends InputSaveVerifier { + + @Override + public int checkEdit() { + // si jamais il y a eu des modifications dues a des setters + // qui sont passés ou des modifications d'equation + // on ne doit pas demander à l'utilisateur de sauver + // ou meme carrement sauver les modification + return JOptionPane.YES_OPTION; + } + + +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,45 +23,51 @@ #L% --> <Table> + <import> + java.util.ArrayList + java.io.File + java.io.IOException + javax.swing.ComboBoxModel + org.nuiton.util.FileUtil + fr.ifremer.isisfish.datastore.SimulationStorage + fr.ifremer.isisfish.simulator.launcher.SimulationService + fr.ifremer.isisfish.simulator.launcher.SimulationJob + fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener + fr.ifremer.isisfish.ui.simulator.SimulAction + fr.ifremer.isisfish.ui.models.common.StringComboModel + </import> + <script><![CDATA[ - import java.util.ArrayList; - import java.io.File; - import org.nuiton.util.FileUtil; - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.datastore.SimulationStorage; - import fr.ifremer.isisfish.simulator.launcher.SimulationService; - import fr.ifremer.isisfish.simulator.launcher.SimulationJob; - import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; - import fr.ifremer.isisfish.ui.models.simulation.SimulationNamesComboModel; - // declaration sépérée de la variable d'instance (jaxx) SimulationServiceListener simulationListener; - // permet de rafaichir la liste les simulations - // des qu'une simulation se termine - simulationListener = new SimulationServiceListener() { - @Override - public void simulationStart(SimulationService simService, SimulationJob job) { - } - - @Override - public void simulationStop(SimulationService simService, SimulationJob job) { - if (log.isDebugEnabled()) { - log.debug("Refresh second pass UI simulations list"); + protected void $afterCompleteSetup() { + // permet de rafaichir la liste les simulations + // des qu'une simulation se termine + simulationListener = new SimulationServiceListener() { + @Override + public void simulationStart(SimulationService simService, SimulationJob job) { } - fieldSensitivitySimulationSelect.setModel(getSensitivitySimulationModel()); - } - - @Override - public void clearJobDone(SimulationService simService) { - } + + @Override + public void simulationStop(SimulationService simService, SimulationJob job) { + if (log.isDebugEnabled()) { + log.debug("Refresh second pass UI simulations list"); + } + fieldSensitivitySimulationSelect.setModel(getSensitivitySimulationModel()); + } + + @Override + public void clearJobDone(SimulationService simService) { + } + }; + SimulationService.getService().addSimulationServiceListener(simulationListener); } - SimulationService.getService().addSimulationServiceListener(simulationListener); /** * Model de contenu de la liste des nom de simulations */ - public ComboBoxModel getSensitivitySimulationModel() { + public StringComboModel getSensitivitySimulationModel() { java.util.List<String> asNames = new ArrayList<String>(); for (String simulationName : SimulationStorage.getSimulationNames()) { if (simulationName.startsWith("as_")) { @@ -72,7 +78,7 @@ } } - SimulationNamesComboModel model = new SimulationNamesComboModel(asNames); + StringComboModel model = new StringComboModel(asNames); return model; } @@ -129,7 +135,7 @@ <row> <cell columns="3" fill="both" weightx="1.0" weighty="1.0"> <JScrollPane> - <JTextArea id='textAreaSensitivitySecondpassResult' text='' editable="false" /> + <JTextArea id='textAreaSensitivitySecondpassResult' editable="false" /> </JScrollPane> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,62 +22,35 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<fr.ifremer.isisfish.ui.NavigationUI> + <import> + javax.swing.JPopupMenu; + javax.swing.tree.DefaultTreeModel; + javax.swing.tree.TreePath; + javax.swing.tree.DefaultMutableTreeNode; + javax.swing.tree.TreeNode; - <javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + fr.ifremer.isisfish.datastore.RegionStorage; + fr.ifremer.isisfish.simulator.sensitivity.Factor; + fr.ifremer.isisfish.ui.WelcomePanelUI; + fr.ifremer.isisfish.ui.input.InputAction; + fr.ifremer.isisfish.ui.input.InputSaveVerifier; + fr.ifremer.isisfish.ui.simulator.SimulAction; + fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; + fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel; + fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer; + fr.ifremer.isisfish.ui.sensitivity.model.FactorTree + javax.swing.JComponent + java.awt.event.ActionListener + javax.swing.JMenuItem + java.awt.event.ActionEvent + </import> - <fr.ifremer.isisfish.ui.input.InputNavigationTreeCellRenderer id='navigationTreeCellRenderer' constructorParams='this'/> + <SensitivityInputHandler id="handler" /> - <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> + <fr.ifremer.isisfish.entities.FisheryRegion id='fisheryRegion' javaBean='null'/> - <java.awt.CardLayout id='cardlayoutPrincipal'/> - - <fr.ifremer.isisfish.entities.FisheryRegionImpl id='region' javaBean='null'/> - <script><![CDATA[ -import javax.swing.JPopupMenu; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; - -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; -import fr.ifremer.isisfish.ui.WelcomePanelUI; -import fr.ifremer.isisfish.ui.input.InputAction; -import fr.ifremer.isisfish.ui.input.InputSaveVerifier; -import fr.ifremer.isisfish.ui.simulator.SimulAction; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil; - -// end code constructor -getVerifier().setSensPanel(this); -new fr.ifremer.isisfish.ui.sensitivity.SensitivityNavigationTreeSelectionAdapter(this); - -factorsTree.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - // clic droit - if (e.getButton() == MouseEvent.BUTTON3) { - JPopupMenu menu = new JPopupMenu(); - JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete")); - menuItemDelete.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - deleteSelectedFactors(); - } - }); - menu.add(menuItemDelete); - menu.show(e.getComponent(), e.getX(), e.getY()); - } - else { - // autre clic - factorSelected(); - } - } -}); - protected InputAction getInputAction() { return getContextValue(InputAction.class); } @@ -94,82 +67,14 @@ return getContextValue(RegionStorage.class); } -protected void factorSelected() { - Object selectedObject = factorsTree.getSelectionValue(); - if (selectedObject != null) { - if (selectedObject instanceof Factor) { - Factor<?, ?> selectedFactor = (Factor<?, ?>)selectedObject; - FactorWizardUI wizard = new FactorWizardUI(this); - JComponent component = getSimulAction().getFactorComponent(selectedFactor); - if (component != null) { - wizard.initExisting(component, selectedFactor); - wizard.pack(); - wizard.setVisible(true); - } - else { - - // method 2 - JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, getRegion().getTopiaContext()); - if (component2 != null) { - if (log.isDebugEnabled()) { - log.debug("Component found is " + component2); - } - wizard.initExisting(component2, selectedFactor); - wizard.pack(); - wizard.setVisible(true); - } - else { - if (log.isDebugEnabled()) { - log.debug("No component found, skip edition of factor " + selectedFactor.getName()); - } - } - } - } - } -} public void setTreeModel() { - if (getRegion() != null) { + if (getFisheryRegion() != null) { getCardlayoutPrincipal().show(inputPanePrincipal,"normale"); - String regionName = getRegion().getName(); - setContextValue(getRegion()); - NavigationTreeModel model = SensitivityNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion()); - - setContextValue(model); - navigation.setModel(model); - setTreeSelection("$root"); - - /*TC-20090702 Fix bug #1772 - EC-20090706 no working solution found - model.nodeChanged(model.getRoot()); - java.util.Enumeration<?> e = model.getRoot().children(); - while (e.hasMoreElements()) { - NavigationTreeNode n = (NavigationTreeNode) e.nextElement(); - String contextPath = n.getContextPath(); - if (contextPath.equals("$root/$cells")) { - //TC-20090702 : ce noeud est trop long a recharger - continue; - } - log.debug("reload node " + contextPath); - model.nodeChanged(n); - java.util.Enumeration<?> e2 = n.children(); - while (e2.hasMoreElements()) { - NavigationTreeNode n2 = (NavigationTreeNode) e2.nextElement(); - n2.getJAXXContextValue(SensitivityTabUI.this); - } - }*/ + String regionName = getFisheryRegion().getName(); + setContextValue(getFisheryRegion()); + getHandler().loadFisheryRegionTree(this); } } -public void repaintNode(String path) { - NavigationTreeModel model = getContextValue(NavigationTreeModel.class); - NavigationTreeNode currentNode = model.findNode(path); - model.nodeChanged(currentNode); -} -public void setTreeSelection(String path) { - NavigationTreeNode node = NavigationUtil.findNode(this, null, path); - TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node)); - navigation.setSelectionPath(pathToRoot); - navigation.scrollPathToVisible(pathToRoot); -} protected void setInfoText(String s) { WelcomePanelUI root = getParentContainer(WelcomePanelUI.class); root.setStatusMessage(s); @@ -177,58 +82,55 @@ protected void regionNull() { getCardlayoutPrincipal().show(inputPanePrincipal,"none"); DefaultTreeModel model = new DefaultTreeModel(null); - navigation.setModel(model); + fisheryRegionTree.setModel(model); } public void setFactorModel() { - java.util.List<Factor<?, ?>> factors = getSimulAction().getFactors(); - FactorTreeModel model = new FactorTreeModel(factors); + FactorGroup factorGroup = getSimulAction().getFactorGroup(); + FactorTreeModel model = new FactorTreeModel(factorGroup); factorsTree.setModel(model); - factorsTree.setRootVisible(true); getParentContainer(SensitivityUI.class).getSensitivityChooserUI().setFactorCardinalityTableModel(); } - -protected void deleteSelectedFactors() { - Object selectedObject = factorsTree.getSelectionValue(); - - if (selectedObject != null) { - if (selectedObject instanceof Factor) { - Factor<?, ?> selectedFactor = (Factor<?, ?>)selectedObject; - if (log.isDebugEnabled()) { - log.debug("Deleting factor " + selectedFactor.getName()); - } - getSimulAction().removeFactor(selectedFactor); - setFactorModel(); - } - } -} ]]> </script> <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'> <JPanel layout='{new BorderLayout()}'> <JSplitPane oneTouchExpandable="true" dividerLocation="400" orientation="VERTICAL" constraints='BorderLayout.CENTER'> + <JScrollPane> + <javax.swing.tree.DefaultTreeSelectionModel id='fisheryRegionTreeSelectionModel' + selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/> + <JTree id="fisheryRegionTree" rootVisible="true" selectionRow='0' + selectionModel='{getFisheryRegionTreeSelectionModel()}' + model='{new DefaultTreeModel(null)}' + onValueChanged="getHandler().nodeSelectionChanged(this, event)" /> + </JScrollPane> <Table> <row> - <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> + <cell anchor='west' weightx='1.0'> + <JButton icon="table_multiple.png" toolTipText="isisfish.sensitivity.newfactorgroup.tip" + onActionPerformed="getHandler().addNewFactorGroup(this)"/> + </cell> + </row> + <row> + <cell columns='2' fill="both" weightx='1.0' weighty='1.0'> <JScrollPane> - <JTree id="navigation" rootVisible="true" selectionRow='0' - selectionModel='{getNavigationSelectionModel()}' - cellRenderer='{getNavigationTreeCellRenderer()}' - model='{new DefaultTreeModel(null)}'/> + <FactorTree id="factorsTree" constructorParams='this' + rootVisible="true" selectionRow='0' + model='{new FactorTreeModel(getSimulAction().getFactorGroup())}' + cellRenderer='{new FactorTreeCellRenderer()}' + onMouseClicked='getHandler().factorsTreeMouseClicked(this, event)'/> </JScrollPane> </cell> </row> </Table> - <JPanel id="factorPanel" name="factorPanel" layout='{new BorderLayout()}'> - <JScrollPane constraints='BorderLayout.CENTER'> - <JTree id="factorsTree" rootVisible="true" selectionRow='0' - model='{new DefaultTreeModel(null)}' cellRenderer='{new FactorTreeCellRenderer()}'/> - </JScrollPane> - </JPanel> </JSplitPane> </JPanel> + <java.awt.CardLayout id='cardlayoutPrincipal'/> <JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}'> - <fr.ifremer.isisfish.ui.input.NoneUI id='noneUI' constraints='"none"'/> + <JPanel layout='{new BorderLayout()}' constraints='"none"'> + <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/> + </JPanel> + <jaxx.runtime.swing.CardLayout2 id='cardlayout'/> <JPanel id="inputPane" layout='{getCardlayout()}' constraints='"normale"'/> </JPanel> </JSplitPane> -</JPanel> \ No newline at end of file +</fr.ifremer.isisfish.ui.NavigationUI> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,96 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import fr.ifremer.isisfish.ui.input.InputContentUI; -import javax.swing.JTabbedPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Sensitivity change listener to control tab swapping. - * - * @author letellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class SensitivityTabbedPaneListener implements ChangeListener { - - /** Class logger. */ - private static Log log = LogFactory.getLog(SensitivityTabbedPaneListener.class); - - protected int cacheSelectedIndex = -1; - - @Override - public void stateChanged(ChangeEvent e) { - try { - JTabbedPane pane = (JTabbedPane)e.getSource(); - pane.removeChangeListener(this); - int selectedIndex = pane.getSelectedIndex(); - if (cacheSelectedIndex != -1){ - pane.setSelectedIndex(cacheSelectedIndex); - } - if (InputContentUI.class.isInstance(pane.getSelectedComponent())){ - InputContentUI ui = (InputContentUI) pane.getSelectedComponent(); - if (closeUI(ui)) { - pane.setSelectedIndex(selectedIndex); - } - if (InputContentUI.class.isInstance(pane.getSelectedComponent())){ - ui = (InputContentUI) pane.getSelectedComponent(); - ui.setSensitivity(true); - ui.setLayer(true); - // otherwise save.cancel buttons are active in last - // refreshed ui - ui.setActionButtons(); - ui.refresh(); - cacheSelectedIndex = pane.getSelectedIndex(); - pane.addChangeListener(this); - - // bug suis les UI autre que nimbus - // la selection des onglet ne se rafraichit pas tres bien - pane.repaint(); - } - } - } catch (Exception ex) { - log.error(ex); - } - } - - /** - * Ask you to save if modification are made. - * - * @param context selected - * @return true to change tab - */ - protected boolean closeUI(InputContentUI context) throws Exception { - boolean exit = true; - return exit; - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,78 +22,77 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> +<fr.ifremer.isisfish.ui.SimulationUI> + + <import> + fr.ifremer.isisfish.ui.input.InputAction + fr.ifremer.isisfish.ui.sensitivity.SensitivitySaveVerifier + jaxx.runtime.context.JAXXInitialContext + jaxx.runtime.JAXXContext + </import> + + <SensitivityInputHandler id="handler" /> + <script><![CDATA[ - import fr.ifremer.isisfish.ui.simulator.SimulAction; - import fr.ifremer.isisfish.ui.result.ResultAction; - import jaxx.runtime.JAXXInitialContext; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; - import fr.ifremer.isisfish.ui.simulator.ParamsUI; - import fr.ifremer.isisfish.ui.simulator.ResultChoiceUI; - import fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI; - import fr.ifremer.isisfish.ui.simulator.ExportUI; - import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; - - public void selTab(int i) { - sensitivityTabs.setSelectedIndex(i); - } - public void refresh(){ - paramsUI.refresh(); - } - - // TODO duplicated code (simulUI, Params UI, SensitivityUI) - protected void importSimulation() { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showOpenDialog(null); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - //This is where a real application would open the file. - getContextValue(SimulAction.class).importSimulation(file); - refresh(); - } - } - // TODO duplicated code (simulUI, Params UI, SensitivityUI) - protected void saveSimulation() { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(null); + /** + * Refresh all simulation launch UI. + */ + @Override + protected void regionStorageChanged() { + boolean enabled = getRegionStorage() != null; + bodyTabbedPane.setEnabledAt(1, enabled); + bodyTabbedPane.setEnabledAt(2, enabled); + } - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - //This is where a real application would open the file. - getContextValue(SimulAction.class).saveSimulation(file); - } - } - ]]> - </script> - <JMenuBar id="simulMenuBar" constraints='BorderLayout.NORTH'> - <JMenu id="simulMenu" text="isisfish.simulation.menu.simulation"> - <JMenuItem id="siSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/> - <JMenuItem id="siImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/> - </JMenu> - </JMenuBar> - <JTabbedPane id="sensitivityTabs" constraints="BorderLayout.CENTER"> + @Override + public void refresh() { + paramsUI.refresh(); + } + + @Override + public void selectParametersTab() { + bodyTabbedPane.setSelectedIndex(0); + } + + @Override + public void setEnabledPrescriptTab(boolean selected) { + // no prescript in AS + } + + @Override + public void setEnabledAnalysePlanTab(boolean selected) { + // no analyse plan in AS + } + + @Override + public void refreshFactorTree() { + sensitivityTabUI.setFactorModel(); + } + ]]></script> + <JTabbedPane id="bodyTabbedPane"> <tab title='isisfish.params.title'> - <ParamsUI id='paramsUI' sensitivity='{true}' constructorParams='this'/> + <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='true' regionStorage="{getRegionStorage()}" + constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivitySaveVerifier()).add("SimulationUI", this).add(this)' /> </tab> - <tab title='isisfish.sensitivity.title'> - <SensitivityTabUI id="sensitivityTabUI" constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivityAction()).add(new InputSaveVerifier()).add(this)'/> + <tab title='isisfish.sensitivity.title' enabled="false"> + <fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI id="sensitivityTabUI" + constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivitySaveVerifier()).add("SimulationUI", this).add(this)' /> </tab> - <tab title='isisfish.sensitivityChooser.title'> + <tab title='isisfish.sensitivityChooser.title' enabled="false"> <SensitivityChooserUI id="sensitivityChooserUI" constructorParams='this'/> </tab> - <tab id="exportUITab" title='isisfish.export.title'> - <ExportUI id="exportUI" constructorParams='this'/> + <tab title='isisfish.export.title'> + <fr.ifremer.isisfish.ui.simulator.ExportUI id="exportUI" constructorParams='this'/> </tab> - <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'> - <ResultChoiceUI id="resultChoiceUI" constructorParams='this'/> + <tab title='isisfish.resultChoice.title'> + <fr.ifremer.isisfish.ui.simulator.ResultChoiceUI id="resultChoiceUI" constructorParams='this'/> </tab> - <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'> - <AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/> + <tab title='isisfish.advancedParameters.title'> + <fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/> </tab> - <tab id="secondPassUITab" title='isisfish.sensitivity.secondpass.title'> + <tab title='isisfish.sensitivity.secondpass.title'> <SensitivitySecondPassUI id="sensitivitySecondPassUI" constructorParams='this'/> </tab> </JTabbedPane> -</JPanel> +</fr.ifremer.isisfish.ui.SimulationUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/TableBlockingLayerUI.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -39,6 +39,7 @@ import org.jdesktop.jxlayer.plaf.AbstractLayerUI; import org.jdesktop.jxlayer.plaf.LayerUI; import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityContextable; import fr.ifremer.isisfish.ui.input.InputContentUI; @@ -88,7 +89,7 @@ * @see org.jdesktop.jxlayer.plaf.AbstractLayerUI#processMouseEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer) */ @Override - protected void processMouseEvent(MouseEvent event, JXLayer</*? extends */JComponent> layer) { + protected void processMouseEvent(MouseEvent event, JXLayer<? extends JComponent> layer) { // scrollbar can be moved if (!(event.getSource() instanceof JScrollBar)) { @@ -115,8 +116,8 @@ // test if sensitivity property is enabled SensitivityTableModel sensitivityModel = (SensitivityTableModel) model; - TopiaEntity value = (TopiaEntity) sensitivityTableModel.getBeanAtRow(rowIndex); - Class<? extends TopiaEntity> beanClass = value.getClass(); + TopiaEntityContextable value = (TopiaEntityContextable) sensitivityTableModel.getBeanAtRow(rowIndex); + Class<? extends TopiaEntityContextable> beanClass = value.getClass(); String property = sensitivityModel.getPropertyAtColumn(columnIndex); String sensitivityName = beanClass.getSimpleName().replaceFirst("Impl", "") + "." + property; @@ -128,7 +129,7 @@ log.debug("Clic done on an enabled factor : " + sensitivityName); } - parent.displayFactorWizard(tableSource, beanClass, value.getTopiaId(), property); + parent.getHandler().displayFactorWizard(parent, beanClass, value.getTopiaId(), property); } // mouse moved over table @@ -150,7 +151,7 @@ * @see org.jdesktop.jxlayer.plaf.AbstractLayerUI#processMouseMotionEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer) */ @Override - protected void processMouseMotionEvent(MouseEvent e, JXLayer<JComponent> l) { + protected void processMouseMotionEvent(MouseEvent e, JXLayer<? extends JComponent> l) { processMouseEvent(e, l); } } \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -27,21 +27,31 @@ <Boolean id='remove' javaBean='false'/> <Boolean id='changed' javaBean='false'/> + <import> + javax.swing.table.DefaultTableModel; + java.util.Map.Entry; + javax.swing.event.ListSelectionListener + java.util.Set + java.util.Iterator + javax.swing.DefaultComboBoxModel + javax.swing.event.ListSelectionEvent + </import> <script><![CDATA[ - import javax.swing.table.DefaultTableModel; - import java.util.Map.Entry; + - /** - * Listener to enable/disable remove button. - */ - tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - setRemove(tableTagValues.getSelectedRow() != -1); - } - }); + protected void $afterCompleteSetup() { + /** + * Listener to enable/disable remove button. + */ + tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + setRemove(tableTagValues.getSelectedRow() != -1); + } + }); - refresh(); + refresh(); + } public void refresh() { setTableTagValues(); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,13 +23,19 @@ #L% --> <Table> -<script><![CDATA[ - import fr.ifremer.isisfish.ui.WelcomePanelUI; - import fr.ifremer.isisfish.ui.models.export.ExportNameListModel; - import javax.swing.event.ListSelectionEvent; + <import> + fr.ifremer.isisfish.ui.WelcomePanelUI; + fr.ifremer.isisfish.ui.models.common.StringListModel; + javax.swing.event.ListSelectionEvent; + java.util.LinkedList + </import> - refresh(); + <script><![CDATA[ + protected void $afterCompleteSetup() { + refresh(); + } + protected SimulAction getSimulAction() { return getContextValue(SimulAction.class); } @@ -48,7 +54,7 @@ // userExports = intersection(userExports,availableExports) userExports.retainAll(availableExports); - ExportNameListModel exportModel = new ExportNameListModel(availableExports); + StringListModel exportModel = new StringListModel(availableExports); listSimulExportChoose.setModel(exportModel); for (String userExport : userExports) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,37 +23,56 @@ #L% --> <Table> + <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null" /> + <!-- ui state when editing --> - <Boolean id='sensitivity' javaBean='false'/> + <Boolean id='sensitivity' javaBean='false' /> + <import> + java.util.EventObject; + java.text.ParseException; + fr.ifremer.isisfish.datastore.RegionStorage; + fr.ifremer.isisfish.datastore.StorageChangeEvent; + fr.ifremer.isisfish.datastore.StorageChangeListener; + fr.ifremer.isisfish.datastore.StorageException; + fr.ifremer.isisfish.entities.Population; + fr.ifremer.isisfish.entities.Strategy; + fr.ifremer.isisfish.entities.FisheryRegion; + fr.ifremer.isisfish.ui.SimulationUI; + fr.ifremer.isisfish.ui.WelcomePanelUI; + fr.ifremer.isisfish.ui.WelcomeTabUI; + fr.ifremer.isisfish.ui.models.common.StringComboModel; + fr.ifremer.isisfish.ui.models.rule.RuleComboModel; + fr.ifremer.isisfish.ui.models.rule.RuleNamesListRenderer; + fr.ifremer.isisfish.ui.models.rule.RuleListModel; + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel; + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor; + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer; + fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; + fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; + fr.ifremer.isisfish.rule.Rule; + fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher; + fr.ifremer.isisfish.simulator.launcher.SimulationService; + fr.ifremer.isisfish.simulator.launcher.SimulationJob; + fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; + fr.ifremer.isisfish.simulator.sensitivity.Factor; + org.nuiton.topia.TopiaException; + org.nuiton.topia.TopiaContext; + org.nuiton.math.matrix.MatrixND; + org.nuiton.math.matrix.gui.MatrixPanelEditor; + org.apache.commons.lang.ArrayUtils; + javax.swing.SwingUtilities + javax.swing.DefaultComboBoxModel + java.awt.CardLayout + java.awt.Dimension + java.io.IOException + java.awt.BorderLayout + javax.swing.AbstractAction + javax.swing.DefaultListModel + javax.swing.JComponent + javax.swing.ComboBoxModel + </import> <script><![CDATA[ -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaContext; -import java.text.ParseException; -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.StorageChangeEvent; -import fr.ifremer.isisfish.datastore.StorageChangeListener; -import fr.ifremer.isisfish.datastore.StorageException; -import fr.ifremer.isisfish.entities.Population; -import fr.ifremer.isisfish.entities.Strategy; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.entities.FisheryRegionImpl; -import fr.ifremer.isisfish.ui.Common; -import fr.ifremer.isisfish.ui.WelcomePanelUI; -import fr.ifremer.isisfish.ui.WelcomeTabUI; -import fr.ifremer.isisfish.ui.models.rule.RuleComboModel; -import fr.ifremer.isisfish.ui.models.rule.RuleComboRenderer; -import fr.ifremer.isisfish.ui.models.rule.RuleListModel; -import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel; -import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor; -import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; -import fr.ifremer.isisfish.rule.Rule; -import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher; -import fr.ifremer.isisfish.simulator.launcher.SimulationService; -import fr.ifremer.isisfish.simulator.launcher.SimulationJob; -import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; - // instances variables déclaration SimulationServiceListener simulationListener; StorageChangeListener regionStorageListener; @@ -62,15 +81,16 @@ regionStorageListener = new StorageChangeListener() { @Override public void versionDataChanged(StorageChangeEvent e) { - fieldSimulParamsRegion.setModel(new DefaultComboBoxModel(Common.getRegionItem())); + StringComboModel model = new StringComboModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames()); + fieldSimulParamsRegion.setModel(model); } }; RegionStorage.addStorageChangeListener(regionStorageListener); -// end constructor code simulationListener = new SimulationServiceListener() { @Override public void simulationStart(SimulationService simService, SimulationJob job) { + } @Override @@ -80,27 +100,18 @@ @Override public void clearJobDone(SimulationService simService) { + } } +SimulationService.getService().addSimulationServiceListener(simulationListener); -public ParamsUI(SimulAction action) { - setContextValue(action); -} - public void refresh() { - // TODO add comment why remove/readd ? - // Disabled , concurrent modification exception - // refresh is called durring listener iteration - //SimulationService.getService().removeSimulationServiceListener(simulationListener); - //SimulationService.getService().addSimulationServiceListener(simulationListener); - if (simulAction.getSimulationStorage() != null) { fieldSimulParamsName.setText(simulAction.getSimulationStorage().getName()); } fieldSimulParamsDesc.setText(simulAction.getSimulationParameter().getDescription()); setListSimulParamsStrategiesItems(); setListSimulParamsPopulationsItems(); - setRulesListModel(); } /** @@ -117,7 +128,7 @@ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - simulAction.regionChange(selected); + simulAction.regionChange(ParamsUI.this, selected); refresh(); setSensitivityTabRegion(); getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.region.loaded")); @@ -141,10 +152,10 @@ protected void setSensitivityTabRegion() { if (isSensitivity()) { try { - // FIXME this transation in nerver closed + // FIXME this transation in never closed TopiaContext tx = simulAction.getRegionStorage().getStorage().beginTransaction(); FisheryRegion fisheryRegion = RegionStorage.getFisheryRegion(tx); - getParentContainer(SensitivityUI.class).getSensitivityTabUI().setRegion((FisheryRegionImpl) fisheryRegion); + getParentContainer(SensitivityUI.class).getSensitivityTabUI().setFisheryRegion(fisheryRegion); getParentContainer(SensitivityUI.class).getSensitivityTabUI().setTreeModel(); } catch (StorageException ex) { if (log.isErrorEnabled()) { @@ -190,16 +201,29 @@ fieldSimulParamsNbAnnees.setText(String.valueOf(simulAction.getNumberOfYear())); setPreScript(); setAnalysePlan(); - //setFactorRegion(); setExportSens(); setSensitivityCalculator(); setFactor(); + + // regles + ruleChooser.setRulesList(simulAction.getSimulationParameter().getRules()); + getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.old.simulation.loaded")); } }); } } + +/** + * Lance la simulation. + */ protected void launchSimulation() { + + // la gestion des regles est maintenant independante de SimulAction + // il faut faire le set qui va bien avant le lancement + simulAction.getSimulationParameter().setRules(ruleChooser.getRulesList()); + + if (!isSensitivity()) { simulAction.launchSimulation(fieldSimulParamsName.getText(), (SimulatorLauncher)comboSelLauncher.getSelectedItem()); } @@ -213,133 +237,54 @@ parent.setQueueTabSelection(); } } -protected void enablePreSimul() { +protected void enablePreScript() { simulAction.getSimulationParameter().setUsePreScript(fieldUseSimulPreScripts.isSelected()); - if (!isSensitivity()){ - SimulUI simul = getParentContainer(SimulUI.class); - simul.enablePreSimul(fieldUseSimulPreScripts.isSelected()); - } + SimulationUI simulationUI = getParentContainer(SimulationUI.class); + simulationUI.setEnabledPrescriptTab(fieldUseSimulPreScripts.isSelected()); } protected void enableAnalysePlan() { simulAction.getSimulationParameter().setUseAnalysePlan(fieldSimulUseAnalysePlan.isSelected()); - if (!isSensitivity()) { - SimulUI simul = getParentContainer(SimulUI.class); - simul.enableAnalysePlan(fieldSimulUseAnalysePlan.isSelected()); - } + SimulationUI simulationUI = getParentContainer(SimulationUI.class); + simulationUI.setEnabledAnalysePlanTab(fieldSimulUseAnalysePlan.isSelected()); } -protected void selTab(MouseEvent e, int i) { - if (((JCheckBox)e.getSource()).isSelected()){ - SimulUI simul = getParentContainer(SimulUI.class); - simul.selTab(i); - } -} -protected void setNbAnnees() { - simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText()); -} + protected void setListSimulParamsStrategiesItems() { + List<Strategy> strategiesSelected = simulAction.getSimulationParameter().getStrategies(); DefaultListModel listSimulParamsStrategiesModel = new DefaultListModel(); java.util.List<Strategy> strategies = simulAction.getStrategies(); for (Strategy s : strategies){ listSimulParamsStrategiesModel.addElement(s); } listSimulParamsStrategies.setModel(listSimulParamsStrategiesModel); - java.util.List<Strategy> strategiesSelected = simulAction.getSimulationParameter().getStrategies(); if (listSimulParamsStrategiesModel.size() != 0) { for (Strategy s : strategiesSelected){ int index = listSimulParamsStrategiesModel.indexOf(s); listSimulParamsStrategies.addSelectionInterval(index, index); } - - strategySelected(); + //strategySelected(); } } protected void setListSimulParamsPopulationsItems(){ + List<Population> populationsSelected = simulAction.getSimulationParameter().getPopulations(); DefaultListModel listSimulParamsPopulationsModel = new DefaultListModel(); - java.util.List<Population> populations = simulAction.getPopulations(); + List<Population> populations = simulAction.getPopulations(); for (Population p : populations){ listSimulParamsPopulationsModel.addElement(p); } listSimulParamsPopulations.setModel(listSimulParamsPopulationsModel); - java.util.List<Population> populationsSelected = simulAction.getSimulationParameter().getPopulations(); if (listSimulParamsPopulationsModel.size() != 0) { for (Population p : populationsSelected) { int index = listSimulParamsPopulationsModel.indexOf(p); listSimulParamsPopulations.addSelectionInterval(index, index); } - populationSelected(); + //simulAction.populationSelected(this); } } -protected void populationSelected(){ - if (listSimulParamsPopulations.getSelectedIndex() != -1) { - simulAction.setPopulations(listSimulParamsPopulations.getSelectedValues()); - simulParamsNumbers.setMatrix(simulAction.getSimulationParameter().getNumberOf((Population) listSimulParamsPopulations.getSelectedValue())); - } -} + protected void strategySelected(){ simulAction.setStrategies(listSimulParamsStrategies.getSelectedValues()); } -protected void saveDescription() { - simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText()); -} - -protected void setRulesListModel() { - if (log.isDebugEnabled()) { - log.debug("Set simulation rules model"); - } - RuleListModel model = new RuleListModel(simulAction.getRules()); - listSimulParamsMesuresList.setModel(model); - listSimulParamsMesuresList.setCellRenderer(model); - - onRuleSelectionChange(); -} -/** - * Called when selection change on rule list. - */ -protected void onRuleSelectionChange() { - if (simulAction.getRules().isEmpty()) { - buttonSimulParamsMesuresClear.setEnabled(false); - buttonSimulParamsMesuresRemove.setEnabled(false); - } - else { - if (listSimulParamsMesuresList.getSelectedIndex() != -1) { - buttonSimulParamsMesuresRemove.setEnabled(true); - setSimulParamsRulesModel(); - } - buttonSimulParamsMesuresClear.setEnabled(true); - } -} - -protected void setSimulParamsRulesModel() { - int selectedRuleIndex = listSimulParamsMesuresList.getSelectedIndex(); - if (selectedRuleIndex != -1) { - RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel(); - Rule selectedRule = listModel.getRules().get(selectedRuleIndex); - RuleParametersTableModel model = new RuleParametersTableModel(selectedRule); - RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule); - RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule); - cellEditor.setRegion(simulAction.getRegionStorage()); - simulParamsRules.setModel(model); - simulParamsRules.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); - simulParamsRules.getColumnModel().getColumn(1).setCellEditor(cellEditor); - } -} -protected void addRules() { - String selectedRuleName = (String)fieldSimulParamsMesuresSelect.getSelectedItem(); - simulAction.addNewRule(selectedRuleName); - setRulesListModel(); -} -protected void removeRules() { - RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel(); - Rule selectedRule = listModel.getRules().get(listSimulParamsMesuresList.getSelectedIndex()); - simulAction.removeRule(selectedRule); - setRulesListModel(); -} -protected void clearRules() { - simulAction.getSimulationParameter().clearRules(); - setRulesListModel(); -} - protected void selectFilter() { try { java.util.List<String> simulationsNames = fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.filterSimulation(simulAction.getOldSimulationItem()); @@ -377,25 +322,6 @@ simulAction.resetOldSimulatorNames(); fieldSimulParamsSelect.setModel(getSimulParamsSelectModel(false)); } -protected void saveName(){ - simulAction.setName(fieldSimulParamsName.getText()); -} - -/** - * TODO : Common code with {@link SimulUI#saveSimulation()} - * TODO duplicated code (simulUI, Params UI, SensitivityUI) - */ -protected void saveSimulation() { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(null); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - //This is where a real application would open the file. - simulAction.saveSimulation(file); - } -} - ]]> </script> <row> @@ -403,16 +329,22 @@ <Table> <row> <cell fill="horizontal"> - <JLabel text="isisfish.params.loadOldSimulation"/> + <JLabel text="isisfish.params.loadOldSimulation" /> </cell> <cell fill="horizontal" weightx="1.0"> - <JComboBox id="fieldSimulParamsSelect" model='{getSimulParamsSelectModel()}' onActionPerformed='loadOldSimulation()'/> + <JComboBox id="fieldSimulParamsSelect" + model='{getSimulParamsSelectModel()}' + onActionPerformed='loadOldSimulation()' /> </cell> <cell> - <JButton text="isisfish.params.filter" id="buttonSimulParamsSelectFilter" onActionPerformed='selectFilter()' enabled="false"/> + <JButton text="isisfish.params.filter" + id="buttonSimulParamsSelectFilter" + onActionPerformed='selectFilter()' enabled="false" /> </cell> <cell> - <JButton text="isisfish.params.clearFilter" id="buttonSimulParamsSelectClearFilter" onActionPerformed='resetFilter()' enabled="false"/> + <JButton text="isisfish.params.clearFilter" + id="buttonSimulParamsSelectClearFilter" + onActionPerformed='resetFilter()' enabled="false" /> </cell> </row> </Table> @@ -431,10 +363,17 @@ <Table> <row> <cell fill="horizontal"> - <JLabel id='lblName' text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}' minimumSize='{new Dimension(195,25)}' preferredSize='{new Dimension(195,25)}'/> + <JLabel id='lblName' + text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}' + minimumSize='{new Dimension(195,25)}' + preferredSize='{new Dimension(195,25)}' /> </cell> - <cell fill="both" weightx="1.0"> - <JTextField id="fieldSimulParamsName" onFocusLost='saveName()'/> + <cell fill="both" weightx="1.0"> + <JTextField id="fieldSimulParamsName" /> + <javax.swing.text.Document + javaBean="fieldSimulParamsName.getDocument()" + onInsertUpdate='simulAction.setName(fieldSimulParamsName.getText())' + onRemoveUpdate='simulAction.setName(fieldSimulParamsName.getText())' /> </cell> </row> </Table> @@ -443,10 +382,13 @@ <Table> <row> <cell columns="2" fill="horizontal"> - <JLabel text="isisfish.common.region"/> + <JLabel text="isisfish.common.region" /> </cell> - <cell fill="horizontal" weightx="1.0"> - <JComboBox id="fieldSimulParamsRegion" model='{new DefaultComboBoxModel(Common.getRegionItem())}' selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' onActionPerformed='regionChange()'/> + <cell fill="horizontal" weightx="1.0"> + <JComboBox id="fieldSimulParamsRegion" + model='{new fr.ifremer.isisfish.ui.models.common.StringComboModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}' + selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' + onActionPerformed='regionChange()' /> </cell> </row> </Table> @@ -454,22 +396,19 @@ </row> <row> <cell columns="4" fill="horizontal" weightx="1.0"> - <Table> - <row> - <cell> - <JLabel text="isisfish.params.description"/> - </cell> - <cell fill="horizontal" weightx="1.0"> - <JPanel/> - </cell> - </row> - </Table> + <JLabel text="isisfish.params.description" /> </cell> </row> <row> - <cell columns="4" fill="both" weightx="1.0" weighty="0.3"> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTextArea id="fieldSimulParamsDesc" text='{simulAction.getSimulationParameter().getDescription()}' onFocusLost='saveDescription()'/> + <cell columns="4" fill="both" weightx="1.0" + weighty="0.3"> + <JScrollPane> + <JTextArea id="fieldSimulParamsDesc" + text='{simulAction.getSimulationParameter().getDescription()}' /> + <javax.swing.text.Document + javaBean="fieldSimulParamsDesc.getDocument()" + onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' + onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' /> </JScrollPane> </cell> </row> @@ -478,114 +417,95 @@ <Table> <row> <cell fill="horizontal"> - <JLabel text="isisfish.params.numberYear" minimumSize='{new Dimension(140,25)}' preferredSize='{new Dimension(140,25)}'/> + <JLabel text="isisfish.params.numberYear" + minimumSize='{new Dimension(140,25)}' + preferredSize='{new Dimension(140,25)}' /> </cell> <cell fill="both" weightx="1.0"> - <JTextField id="fieldSimulParamsNbAnnees" text='{simulAction.getSimulationParameter().getNumberOfYear()}' onFocusLost='setNbAnnees()'/> + <JTextField + id="fieldSimulParamsNbAnnees" + text='{String.valueOf(simulAction.getSimulationParameter().getNumberOfYear())}' /> + <javax.swing.text.Document + javaBean="fieldSimulParamsNbAnnees.getDocument()" + onInsertUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' + onRemoveUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' /> </cell> </row> </Table> </cell> <cell columns="2" fill="horizontal" weightx="0.5"> - <JPanel/> + <JPanel /> </cell> </row> <row> - <cell fill="both" weightx="0.2" weighty="0.1"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text="isisfish.common.strategies"/> - </cell> - </row> - <row> - <cell fill="both" weightx="1.0" weighty="1.0"> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="listSimulParamsStrategies" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" onValueChanged='strategySelected()'/> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - <cell fill="both" weightx="0.4" weighty="0.1"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text="isisfish.common.populations"/> - </cell> - </row> - <row> - <cell fill="both" weightx="1.0" weighty="1.0"> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="listSimulParamsPopulations" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" - onValueChanged='populationSelected()' onFocusGained="parametersTabbedPane.setSelectedIndex(0)" /> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - <cell fill="both" weightx="0.4" weighty="0.1"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text="isisfish.common.rules"/> - </cell> - </row> - <row> - <cell fill="horizontal"> - <JComboBox id="fieldSimulParamsMesuresSelect" model='{new RuleComboModel(simulAction.getAvailableRuleNames())}' renderer='{new RuleComboRenderer()}'/> - </cell> - </row> - <row> - <cell fill="both" weightx="1.0" weighty="1.0"> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JList id="listSimulParamsMesuresList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}" - onValueChanged='onRuleSelectionChange()' onFocusGained="parametersTabbedPane.setSelectedIndex(1)" /> - </JScrollPane> - </cell> - </row> - </Table> - </cell> - <cell fill="both" weighty="0.1"> - <Table> - <row> - <cell fill="horizontal"> - <JLabel text=" " minimumSize='{new Dimension(2,15)}' preferredSize='{new Dimension(2,15)}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="buttonSimulParamsMesuresAdd" text="isisfish.common.add" onActionPerformed='addRules()'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="buttonSimulParamsMesuresRemove" text="isisfish.common.remove" enabled="false" onActionPerformed='removeRules()'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JButton id="buttonSimulParamsMesuresClear" text="isisfish.common.clear" enabled="false" onActionPerformed='clearRules()'/> - </cell> - </row> - <row> - <cell fill='both' weighty="1.0"> - <JPanel/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell columns="4" fill="both" weightx="1.0" weighty="0.6"> - <JTabbedPane id="parametersTabbedPane" minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <tab title='{_("isisfish.params.populationNumbers")}'> - <org.nuiton.math.matrix.gui.MatrixPanelEditor id="simulParamsNumbers" name="isisfish.params.populationNumbers"/> + <cell columns="4" fill="both" weightx="1.0" weighty="0.6"> + <JTabbedPane id="parametersTabbedPane" enabled="{getRegionStorage() != null}"> + <tab title='{_("isisfish.params.stategiesAndPopulations")}'> + <Table> + <row> + <cell fill="horizontal"> + <JLabel text="isisfish.common.strategies" enabled="{getRegionStorage() != null}" /> + </cell> + <cell fill="horizontal"> + <JLabel text="isisfish.common.populations" enabled="{getRegionStorage() != null}" /> + </cell> + </row> + <row> + <cell fill="both" weightx="1" + weighty="1"> + <JScrollPane> + <JList id="listSimulParamsStrategies" + selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + selectionModel="{new jaxx.runtime.swing.OneClicListSelectionModel(listSimulParamsStrategies.getSelectionModel(), listSimulParamsStrategies.getModel())}" + onValueChanged='strategySelected()' + enabled="{getRegionStorage() != null}" /> + </JScrollPane> + </cell> + <cell fill="both" weightx="1" + weighty="1"> + <JScrollPane> + <JList id="listSimulParamsPopulations" + selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + selectionModel="{new jaxx.runtime.swing.OneClicListSelectionModel(listSimulParamsPopulations.getSelectionModel(), listSimulParamsPopulations.getModel())}" + onValueChanged='simulAction.populationSelected(this)' + enabled="{getRegionStorage() != null}" /> + </JScrollPane> + </cell> + </row> + <row> + <cell fill="both" weighty="1" columns="2"> + <JPanel id="populationEffectivesPanel" + layout="{new CardLayout()}"> + <JLabel text="isisfish.params.nopopulation" + horizontalAlignment="center" + border="{BorderFactory.createEtchedBorder()}" + font-style="italic" + constraints='"default"' + enabled="{getRegionStorage() != null}" /> + <JTabbedPane id="populationEffectivesTabbedPane" + constraints='"specific"' + enabled="{getRegionStorage() != null}" /> + </JPanel> + </cell> + </row> + </Table> </tab> - <tab title='{_("isisfish.params.ruleParameters")}'> - <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JTable id="simulParamsRules" rowHeight='24' name="isisfish.params.ruleParameters"/> - </JScrollPane> + <tab title='{_("isisfish.params.rules")}'> + <Table> + <row> + <cell fill="both" weightx="1" weighty="1"> + <RuleChooser id="ruleChooser" constructorParams='this' + active="{getRegionStorage() != null}" + showFactorColumn="{isSensitivity()}" /> + </cell> + <cell anchor="north"> + <JButton id="addRuleFactorButton" + icon='{SwingUtil.createImageIcon("building_add.png")}' + onActionPerformed="simulAction.addFactorWithComponent(this, ruleChooser)" + visible="{isSensitivity()}" /> + </cell> + </row> + </Table> </tab> </JTabbedPane> </cell> @@ -598,14 +518,19 @@ <Table> <row> <cell fill="horizontal" weightx="0.3"> - <JCheckBox text="isisfish.params.usePreSimulationScript" id="fieldUseSimulPreScripts" - selected='{simulAction.getSimulationParameter().getUsePreScript()}' - visible='{!isSensitivity()}' onItemStateChanged='enablePreSimul()' onMouseReleased='selTab(event, 1)'/> + <JCheckBox text="isisfish.params.usePreSimulationScript" + id="fieldUseSimulPreScripts" + selected='{simulAction.getSimulationParameter().getUsePreScript()}' + visible='{!isSensitivity()}' + onItemStateChanged='enablePreScript()' /> </cell> <cell fill="horizontal" weightx="0.3"> - <JCheckBox text="isisfish.params.useAnalysePlan" id="fieldSimulUseAnalysePlan" - selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}' - visible='{!isSensitivity()}' onItemStateChanged='enableAnalysePlan()' onMouseReleased='selTab(event, 2)'/> + <JCheckBox text="isisfish.params.useAnalysePlan" + id="fieldSimulUseAnalysePlan" + selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}' + visible='{!isSensitivity()}' + onItemStateChanged='enableAnalysePlan()' + enabled="{getRegionStorage() != null}" /> </cell> </row> </Table> @@ -616,16 +541,23 @@ <Table> <row> <cell> - <JLabel id="lblLauncher" text="isisfish.params.lblLauncher"/> + <JLabel text="isisfish.params.simulationLauncher" /> </cell> <cell fill="horizontal" weightx="0.4"> - <JComboBox id="comboSelLauncher" model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}'/> + <JComboBox id="comboSelLauncher" + model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}' /> </cell> <cell fill="horizontal" weightx="0.4"> - <JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate" onActionPerformed='launchSimulation()'/> + <JButton id="buttonSimulParamsSimulate" + text="isisfish.common.simulate" + onActionPerformed='launchSimulation()' + enabled="{getRegionStorage() != null}" /> </cell> <cell fill="horizontal" weightx="0.2"> - <JButton id="saveSimul" text="isisfish.simulation.menu.save" onActionPerformed='saveSimulation()'/> + <JButton id="saveSimul" + text="isisfish.simulation.menu.save" + onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).saveSimulation()' + enabled="{getRegionStorage() != null}" /> </cell> </row> </Table> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -36,13 +36,14 @@ } - protected void backParameter() { + /*protected void backParameter() { SimulUI simul = getParentContainer(SimulUI.class); simul.selTab(0); - } + }*/ ]]></script> <JScrollPane constraints='BorderLayout.CENTER'> <JTextArea id="fieldSimulPreScript" onFocusLost='save()'/> </JScrollPane> - <JButton constraints='BorderLayout.SOUTH' text="isisfish.preScript.backParameter" onActionPerformed='backParameter()'/> + <JButton constraints='BorderLayout.SOUTH' text="isisfish.preScript.backParameter" + onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).selectParametersTab()'/> </JPanel> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,12 +23,17 @@ #L% --> <JPanel layout='{new BorderLayout()}'> + <import> + fr.ifremer.isisfish.ui.WelcomePanelUI + fr.ifremer.isisfish.ui.models.common.StringListModel + javax.swing.event.ListSelectionEvent + </import> <script><![CDATA[ - import fr.ifremer.isisfish.ui.WelcomePanelUI; - import fr.ifremer.isisfish.ui.models.result.ResultListModel; - import javax.swing.event.ListSelectionEvent; + - refresh(); + protected void $afterCompleteSetup() { + refresh(); + } public void refresh() { @@ -48,7 +53,7 @@ // userResults = intersection(userResults,availableResult) userResults.retainAll(availableResults); - ResultListModel resultModel = new ResultListModel(availableResults); + StringListModel resultModel = new StringListModel(availableResults); listResultNames.setModel(resultModel); for (String userResult : userResults) { Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx (from rev 3392, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,222 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + + @param : Region storage (context) + --> +<Table> + <!-- Rules collection managed by current ui instance. --> + <java.util.List genericType='fr.ifremer.isisfish.rule.Rule' id="rulesList" javaBean='new java.util.ArrayList<fr.ifremer.isisfish.rule.Rule>()'/> + + <!-- Active enabled binding property --> + <Boolean id="active" javaBean="true"/> + + <Boolean id="showFactorColumn" javaBean="false" /> + + <import> + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.util.List + fr.ifremer.isisfish.IsisFishException + fr.ifremer.isisfish.IsisFishRuntimeException + fr.ifremer.isisfish.datastore.RuleStorage + fr.ifremer.isisfish.rule.Rule + fr.ifremer.isisfish.ui.models.rule.RuleListModel + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor + fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer + fr.ifremer.isisfish.ui.models.rule.RuleParametersFactorTableCellRenderer + fr.ifremer.isisfish.ui.models.rule.RuleParametersFactorTableCellEditor + fr.ifremer.isisfish.ui.util.ErrorHelper + fr.ifremer.isisfish.ui.SimulationUI + fr.ifremer.isisfish.datastore.RegionStorage + </import> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + // Manage rule list change + addPropertyChangeListener(PROPERTY_RULES_LIST, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + selectedRulesList.setModel(new RuleListModel()); + } + else /*if (evt.getNewValue() != null)*/ { + List<Rule> rules = (List<Rule>)evt.getNewValue(); + selectedRulesList.setModel(new RuleListModel(rules)); + } + } + }); + + // fix colums size for buttons + if (isShowFactorColumn()) { + SwingUtil.fixTableColumnWidth(selectedRuleParameterTable, 2, 30); + } + } + + /** + * Get new instance for selected rules names and add it to {@link rulesList} list. + */ + protected void addSelectedRules() { + Object[] availableRuleValues = availableRuleList.getSelectedValues(); + for (Object availableRuleValue : availableRuleValues) { + String availableRuleName = (String)availableRuleValue; + try { + RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName); + Rule ruleTmp = ruleStorage.getNewRuleInstance(); + rulesList.add(ruleTmp); + } catch (IsisFishException ex) { + throw new IsisFishRuntimeException("Can't add rule", ex); + } + } + selectedRulesListModel.setRules(rulesList); + } + + /** + * Remove selected rules for selected rules list. + */ + protected void removeSelectedRules() { + SimulAction simulAction = getContextValue(SimulAction.class); + Object[] selectedRuleValues = selectedRulesList.getSelectedValues(); + for (Object selectedRuleValue : selectedRuleValues) { + + // condition pour savoir si on est dans l'instance principal + // de définition d'une simulation (hack) + if (isShowFactorColumn()) { + int ruleIndex = rulesList.indexOf(selectedRuleValue); + simulAction.preRemoveRule(ruleIndex); + getContextValue(SimulationUI.class, "SimulationUI").refreshFactorTree(); + } + + // real rule remove + rulesList.remove(selectedRuleValue); + } + selectedRulesListModel.setRules(rulesList); + selectedRulesList.clearSelection(); + } + + /** + * Clear selected rule list. + */ + protected void clearAllRules() { + // condition pour savoir si on est dans l'instance principal + // de définition d'une simulation (hack) + if (isShowFactorColumn()) { + SimulAction simulAction = getContextValue(SimulAction.class); + for (Rule rule : rulesList) { + int ruleIndex = rulesList.indexOf(rule); + simulAction.preRemoveRule(ruleIndex); + } + getContextValue(SimulationUI.class, "SimulationUI").refreshFactorTree(); + } + rulesList.clear(); + selectedRulesListModel.setRules(rulesList); + selectedRulesList.clearSelection(); + } + + /** + * Display paramters table form single selected list. + */ + protected void displayRuleParameters() { + Rule selectedRule = (Rule)selectedRulesList.getSelectedValue(); + if (selectedRule != null) { + selectedRuleParameterTableModel.setRule(selectedRule); + + RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule); + selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); + + + RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule); + cellEditor.setRegionStorage(getContextValue(RegionStorage.class)); + selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor); + + if (isShowFactorColumn()) { + RuleParametersFactorTableCellRenderer sensitivityRenderer = new RuleParametersFactorTableCellRenderer(this, selectedRule); + selectedRuleParameterTable.getColumnModel().getColumn(2).setCellRenderer(sensitivityRenderer); + RuleParametersFactorTableCellEditor sensitivityEditor = new RuleParametersFactorTableCellEditor(this, selectedRule); + selectedRuleParameterTable.getColumnModel().getColumn(2).setCellEditor(sensitivityEditor); + } + } + else { + selectedRuleParameterTableModel.setRule(null); + } + } + ]]></script> + + <row> + <cell fill="horizontal"> + <JLabel text="isisfish.params.rules.availables" enabled="{isActive()}"/> + </cell> + <cell> + <JPanel /> + </cell> + <cell fill="horizontal"> + <JLabel text="isisfish.params.rules.selected" enabled="{isActive()}"/> + </cell> + </row> + <row> + <cell fill="both" rows="3" weightx="1" weighty="1"> + <JScrollPane> + <JList id="availableRuleList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RuleStorage.getRuleNames())}' + cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleNamesListRenderer()}' + onValueChanged='addRulesButton.setEnabled(availableRuleList.getSelectedIndex() != -1)' + enabled="{isActive()}"/> + </JScrollPane> + </cell> + <cell fill='horizontal'> + <JButton id="addRulesButton" text="isisfish.common.add" enabled="false" onActionPerformed='addSelectedRules()'/> + </cell> + <cell fill="both" rows="3" weightx="1" weighty="1"> + <JScrollPane> + <fr.ifremer.isisfish.ui.models.rule.RuleListModel id="selectedRulesListModel" /> + <JList id="selectedRulesList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" + model='{selectedRulesListModel}' + cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleListCellRenderer()}' + onValueChanged='removeRuleButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);clearRulesButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);displayRuleParameters()' + enabled="{isActive()}"/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JButton id="removeRuleButton" text="isisfish.common.remove" + enabled="false" onActionPerformed='removeSelectedRules()'/> + </cell> + </row> + <row> + <cell fill='horizontal' anchor="north"> + <JButton id="clearRulesButton" text="isisfish.common.clear" + enabled="false" onActionPerformed='clearAllRules()'/> + </cell> + </row> + <row weightx="2" weighty="2" columns="3"> + <cell fill='both'> + <JScrollPane> + <fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel + id="selectedRuleParameterTableModel" showFactorColumn="{isShowFactorColumn()}" /> + <JTable id="selectedRuleParameterTable" rowHeight='24' + model="{selectedRuleParameterTableModel}" enabled="{isActive()}" /> + </JScrollPane> + </cell> + </row> +</Table> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 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 @@ -23,31 +23,39 @@ #L% --> <Table> + <import> + java.awt.Dimension + javax.swing.table.DefaultTableModel; + fr.ifremer.isisfish.datastore.AnalysePlanStorage; + fr.ifremer.isisfish.datastore.StorageChangeEvent; + fr.ifremer.isisfish.datastore.StorageChangeListener; + fr.ifremer.isisfish.simulator.AnalysePlan; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanComboModel; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanComboRenderer; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanListModel; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanListRenderer; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableModel; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellEditor; + fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellRenderer; + fr.ifremer.isisfish.datastore.RegionStorage; + </import> <SimulAction id='simulAction' javaBean='getContextValue(SimulAction.class)' /> <script><![CDATA[ - import javax.swing.table.DefaultTableModel; - import fr.ifremer.isisfish.datastore.AnalysePlanStorage; - import fr.ifremer.isisfish.datastore.StorageChangeEvent; - import fr.ifremer.isisfish.datastore.StorageChangeListener; - import fr.ifremer.isisfish.simulator.AnalysePlan; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanComboModel; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanComboRenderer; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanListModel; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanListRenderer; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableModel; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellEditor; - import fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellRenderer; + // to be notified of storage change event StorageChangeListener analyzePlanStorageListener; - analyzePlanStorageListener = new StorageChangeListener() { - @Override - public void versionDataChanged(StorageChangeEvent e) { - refresh(); - } - }; - AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener); + + protected void $afterCompleteSetup() { + analyzePlanStorageListener = new StorageChangeListener() { + @Override + public void versionDataChanged(StorageChangeEvent e) { + refresh(); + } + }; + AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener); + } public void refresh() { // analyse plans names list @@ -117,7 +125,7 @@ AnalyzePlanParametersTableModel model = new AnalyzePlanParametersTableModel(selectedAnalyzePlan); simulParamsAnalysePlans.setModel(model); AnalyzePlanParametersTableCellEditor cellEditor = new AnalyzePlanParametersTableCellEditor(selectedAnalyzePlan); - cellEditor.setRegion(simulAction.getRegionStorage()); + cellEditor.setRegionStorage(getContextValue(RegionStorage.class)); simulParamsAnalysePlans.getColumnModel().getColumn(0).setCellRenderer(new AnalyzePlanParametersTableCellRenderer(selectedAnalyzePlan)); simulParamsAnalysePlans.getColumnModel().getColumn(1).setCellEditor(cellEditor); } @@ -127,11 +135,11 @@ } } - protected void backParameter() { + /*protected void backParameter() { // TODO remove getParentContainer() use SimulUI simul = getParentContainer(SimulUI.class); simul.selTab(0); - } + }*/ ]]> </script> <row> @@ -175,7 +183,7 @@ </row> <row> <cell columns="2" fill="horizontal" weightx="1.0"> - <JButton text="isisfish.sens.backParameter" onActionPerformed='backParameter()'/> + <JButton text="isisfish.sens.backParameter" onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).selectParametersTab()'/> </cell> </row> </Table> Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,74 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.simulator; - -import javax.swing.JButton; -import javax.swing.JTabbedPane; - -/** - * SensWizard. - * - * Created: 14 nov. 2005 - * - * @author Arnaud Thimel <thimel at codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - * - * @deprecated on 20080223 seams to be unused - */ -public class SensWizard { - - /** - * Methode appelee à lors du passage d'une fenetre a une autre dans le - * wizard - * @return l'index de la tab a selectionner - */ - public static int newTab(JButton prev, JButton next, JButton finish, - JTabbedPane tabPane) { - // La direction du changement de tab (+1, -1) - //int step = ((Integer)currentContext.getData("_step")).intValue(); - // La nouvelle tab sélectionnée par l'utilisateur - int tab = tabPane.getSelectedIndex(); - if (tab > 0) { - prev.setEnabled(true); - } else { - prev.setEnabled(false); - } - // Active/desactive les boutons next et finish - if (tab == tabPane.getTabCount() - 1) { - next.setEnabled(false); - finish.setEnabled(true); - } else { - next.setEnabled(true); - finish.setEnabled(false); - } - return tab; - } - -} //SensWizard Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2005 - 2010 Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * Copyright (C) 2005 - 2011 Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin, 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,33 +27,42 @@ import static org.nuiton.i18n.I18n._; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.event.ActionEvent; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; -import java.io.Serializable; import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.SortedMap; import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.AbstractAction; +import javax.swing.JButton; import javax.swing.JComponent; +import javax.swing.JPanel; +import jaxx.runtime.SwingUtil; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.gui.MatrixPanelEditor; import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.AnalysePlanStorage; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.datastore.RegionStorage; @@ -77,12 +86,18 @@ import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityException; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; +import fr.ifremer.isisfish.ui.SimulationUI; +import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; +import fr.ifremer.isisfish.ui.sensitivity.SensitivityInputHandler; import fr.ifremer.isisfish.ui.util.ErrorHelper; /** @@ -102,23 +117,21 @@ private static Log log = LogFactory.getLog(SimulAction.class); private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd-HH-mm"); - + + /** Les parametres de simulation (commun a tous les onglet de l'interface de simulation). */ protected SimulationParameter param = null; + protected RegionStorage regionStorage = null; protected SimulationStorage simulStorage = null; - protected List<String> oldSimulNames = null; protected String simulName = null; protected SensitivityStorage sensitivityStorage = null; - protected Map<String, Factor> factors; - protected Map<String, JComponent> factorComponent = new HashMap<String, JComponent>(); - protected DesignPlan designPlan = new DesignPlan(); - /* - ************ - * Init - ************ + /** + * List de facteur sous forme d'arbre (factor group). + * {@code null} name for compatibility with 3.3.0.0. */ + protected FactorGroup factorGroup = new FactorGroup(null); public SimulAction() { init(); @@ -152,10 +165,6 @@ } ErrorHelper.showErrorDialog(_("isisfish.error.simulation.initsimulaction"), eee); } - - // factors has been requested to be sorted - // TODO add factor sorting - factors = new HashMap<String, Factor>(); } protected void setName(String name) { @@ -182,14 +191,7 @@ } ErrorHelper.showErrorDialog(_("isisfish.error.simulation.importparameter"), e); } finally { - try { - fos.close(); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Can't import simulation", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.importparameter"), e); - } + IOUtils.closeQuietly(fos); } } @@ -211,16 +213,7 @@ } ErrorHelper.showErrorDialog(_("isisfish.error.simulation.savesimulation"), e); } finally { - try { - if (fos != null) { - fos.close(); - } - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Can't save simulation", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.savesimulation"), e); - } + IOUtils.closeQuietly(fos); } } @@ -251,28 +244,15 @@ /** * Change region in simulation launcher - * + * + * @param paramsUI paramsUI * @param regionName region name */ - public void regionChange(String regionName) { - try { - regionStorage = RegionStorage.getRegion(regionName); - - // chatellier, on ne peut pas le reinitialiser, on - // perd toutes les info apres un rechergement d'une anciennes simulation - //init(); // reinitialise param pour le vider - param.setRegionName(regionName); - - // poussin 20090519 quel est l'interet de faire ca ? et encore plus maintenant qu'on reinitialise - // for (Rule r : param.getRules()) { - // rules.put(r, RuleStorage.getName(r)); - // } - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Can't change region", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.openregion"), e); - } + public void regionChange(ParamsUI paramsUI, String regionName) { + regionStorage = RegionStorage.getRegion(regionName); + paramsUI.getParentContainer(SimulationUI.class).setContextValue(regionStorage); + paramsUI.getParentContainer(SimulationUI.class).setRegionStorage(regionStorage); + param.setRegionName(regionName); } /** @@ -305,28 +285,22 @@ param.setAnalysePlanNumber(-1); regionStorage = param.getRegion(); - // Chargement des exports de sensibilites - /* not used anymore - * sensitivityExports.clear(); - for (SensitivityExport ex : param.getSensitivityExport()){ - sensitivityExports.put(ex, ex.getExportFilename()); - }*/ - // Chargement des facteurs // clear list even if mexico file doesn't exists - factors.clear(); + factorGroup.clearFactors(); File f = SimulationStorage.getMexicoDesignPlan(SimulationStorage.getSimulationDirectory(simulName)); if (f != null && f.canRead()) { if (log.isInfoEnabled()) { log.info("Import design plan from : " + f.getAbsolutePath()); } TopiaContext topiaContext = regionStorage.getStorage(); - designPlan = MexicoHelper.getDesignPlanFromXML(f, topiaContext); + DesignPlan designPlan = MexicoHelper.getDesignPlanFromXML(f, topiaContext); for (Factor factor : designPlan.getFactors()) { if (log.isDebugEnabled()) { log.debug("Find factor : " + factor.getName()); } - factors.put(factor.getPath() + factor.getName(), factor); + //factors.put(factor.getPath() + factor.getName(), factor); + factorGroup = designPlan.getFactorGroup(); } } else { @@ -335,77 +309,71 @@ } } } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't load old Simulation: " + simulName, eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.loadoldsimulation"), eee); + throw new IsisFishRuntimeException(_("isisfish.error.simulation.loadoldsimulation"), eee); } } - /* - ************ - * ParamsUI - ************ - */ - /** - * Get simulation parameters rule list. + * Called by RuleChooser component before rule deletion. + * Used to remove factor associated to rule to delete. * - * @return rules - */ - public List<Rule> getRules() { - return param.getRules(); - } - - /** - * Add new rule. + * Factor path reference rule with factor path containing rule index + * in rule list : + * for example : + * <pre> + * parameters.rule.2.parameter.tacPoids + * </pre> * - * Get a new instance of ruleItem, and add it to rule list. + * Must also rename all next indices. * - * @param ruleName rule to get copy + * @param ruleIndex rule index to to delete */ - public void addNewRule(String ruleName) { - try { - RuleStorage ruleStorage = RuleStorage.getRule(ruleName); - Rule ruleTmp = ruleStorage.getNewRuleInstance(); - param.addRule(ruleTmp); - } catch (IsisFishException e) { - if (log.isErrorEnabled()) { - log.error("Can't add rule", e); - } - ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e); - } + public void preRemoveRule(int ruleIndex) { + preRemoveRule(factorGroup, ruleIndex); } /** - * Retire une regle. + * Recursive rename and delete rule factor path. * - * @param rule rule to removes - * @return <tt>true</tt> if this list contained the specified element + * @param ruleIndex rule index to to delete */ - public boolean removeRule(Rule rule) { - return param.removeRule(rule); + protected void preRemoveRule(FactorGroup factorGroup, int ruleIndex) { + Collection<Factor> factorCopy = new ArrayList<Factor>(factorGroup.getFactors()); + for (Factor factor : factorCopy) { + if (factor instanceof FactorGroup) { + preRemoveRule((FactorGroup)factor, ruleIndex); + } + else { + Pattern factorPathPattern = Pattern.compile("^(parameters\\.rule\\.)(\\d+)(.*)$"); + Matcher factorPathMatcher = factorPathPattern.matcher(factor.getPath()); + if (factorPathMatcher.find()) { + Integer index = Integer.parseInt(factorPathMatcher.group(2)); + if (index == ruleIndex) { + // meme index, suppression + if (log.isDebugEnabled()) { + log.debug("Removing factor for index " + ruleIndex + " : " + factor.getPath()); + } + factorGroup.remove(factor); + } + else if (index > ruleIndex) { + // index supérieur, renommage + // avec un index de moins + String factorPath = factorPathMatcher.group(1) + + String.valueOf(index - 1) + factorPathMatcher.group(3); + if (log.isDebugEnabled()) { + log.debug("Renammed factor for index " + ruleIndex + " : " + factor.getPath()); + } + factor.setPath(factorPath); + } + } + } + } } - /** - * Retourne une liste d'instance de toutes les regles disponible. + * Get strategies list to fill Jlist in ParamUI. * - * Instancié (utile pour les modeles). - * - * @return instance rule list + * @return strategies list */ - public List<String> getAvailableRuleNames() { - List<String> result = new ArrayList<String>(); - for (String ruleName : RuleStorage.getRuleNames()) { - // remove last .java - String shortRuleName = ruleName.substring(0, ruleName.length() - 5); - result.add(shortRuleName); - } - return result; - } - - // Strategies - public List<Strategy> getStrategies() { List<Strategy> result = new ArrayList<Strategy>(); try { @@ -422,6 +390,11 @@ return result; } + /** + * Set parameters strategies. + * + * @param strategies + */ public void setStrategies(Object[] strategies) { List<Strategy> result = new ArrayList<Strategy>(); for (Object o : strategies) { @@ -430,8 +403,11 @@ param.setStrategies(result); } - // Population - + /** + * Get population list to fill JList in paramUI. + * + * @return populations list + */ public List<Population> getPopulations() { List<Population> result = new ArrayList<Population>(); @@ -461,6 +437,11 @@ return result; } + /** + * Set parameter population. + * + * @param populations populations to set + */ public void setPopulations(Object[] populations) { List<Population> result = new ArrayList<Population>(); for (Object o : populations) { @@ -470,13 +451,24 @@ } // Years - public int getNumberOfYear() { return param.getNumberOfYear(); } - + + /** + * Change number of simulation year by parsing string value. + * Default to 1 if value is not parsable. + * + * @param years number of years to set + */ public void setNumberOfYear(String years) { - param.setNumberOfYear(Integer.parseInt(years)); + try { + param.setNumberOfYear(Integer.parseInt(years)); + } + catch (NumberFormatException ex) { + // defaut to one year + param.setNumberOfYear(1); + } } public List<String> getSimulatorNames() { @@ -550,13 +542,17 @@ } public void removeTagValue(String tag) { - log.debug("removeTagValue: " + tag); + if (log.isDebugEnabled()) { + log.debug("removeTagValue: " + tag); + } param.getTagValue().remove(tag); } public void saveTagValue(String simulatorName) { Map<String, String> tagValues = param.getTagValue(); - log.debug("call saveTagValue: " + tagValues); + if (log.isDebugEnabled()) { + log.debug("call saveTagValue: " + tagValues); + } IsisFish.config.setDefaultTagValues(tagValues); IsisFish.config.setSimulatorClassfile(simulatorName); @@ -827,111 +823,206 @@ * * @return factor list */ - public List<Factor<?, ?>> getFactors() { - List<Factor<?, ?>> result = new ArrayList<Factor<?, ?>>(); - for (Map.Entry<?, ?> entry : factors.entrySet()) { - result.add((Factor<?, ?>) entry.getValue()); + public FactorGroup getFactorGroup() { + return factorGroup; + } + + /** + * Search factor in factor group tree by path. + * + * @param factorPath factor path to search + * @return found factor + */ + public Factor getFactor(String factorPath) { + return getFactor(factorGroup, factorPath); + } + + /** + * Recursive search for factor in factor group by path. + * + * @param factorGroup factor group to search to + * @param factorPath factor path to search + * @return found factor + */ + protected Factor getFactor(FactorGroup factorGroup, String factorPath) { + Factor result = null; + for (Factor factor : factorGroup.getFactors()) { + if (factor instanceof FactorGroup) { + result = getFactor((FactorGroup)factor, factorPath); + } + if (factorPath.equals(factor.getPath())) { + result = factor; + } } - - // sort factor on name - Collections.sort(result, new Comparator<Factor<?, ?>> (){ - @Override - public int compare(Factor<?, ?> o1, Factor<?, ?> o2) { - return o1.getName().compareTo(o2.getName()); - } - }); - return result; } + + /** + * Remove factor in factor group tree by path. + * + * @param factorPath factor path to remove + */ + public void removeFactor(String factorPath) { + removeFactor(factorGroup, factorPath); + } - public void addFactor(Factor<?, ?> f, JComponent c) { + /** + * Recursive remove for factor in factor group by path. + * + * @param factorGroup factor group to search to + * @param factorPath factor path to remove + */ + protected void removeFactor(FactorGroup factorGroup, String factorPath) { + Collection<Factor> factorCopy = new ArrayList<Factor>(factorGroup.getFactors()); + for (Factor factor : factorCopy) { + if (factor instanceof FactorGroup) { + removeFactor((FactorGroup)factor, factorPath); + } + if (factorPath.equals(factor.getPath())) { + factorGroup.remove(factor); + } + } + } + + public void addFactor(Factor f) { if (log.isDebugEnabled()) { log.debug("Add factor (" + f.getName() + ") : " +f.getPath()); } - factors.put(f.getPath() + f.getName(), f); - factorComponent.put(f.getPath() + f.getName(), c); - designPlan.setFactors(getFactors()); + factorGroup.addFactor(f); } + /** + * Ajout d'un facteur continue de type (min/max). + * + * @param name + * @param comment + * @param path + * @param min + * @param max + * @param exist + */ public void addContinuousFactor(String name, String comment, String path, Double min, - Double max, JComponent c, boolean exist) { - Factor<Double, Double> f = new Factor<Double, Double>(name); - ContinuousDomain<Double, Double> domain = new ContinuousDomain<Double, Double>(); + Double max, boolean exist) { + Factor f = new Factor(name); + ContinuousDomain domain = new ContinuousDomain(); domain.setMinBound(min); domain.setMaxBound(max); f.setDomain(domain); f.setComment(comment); f.setPath(path); if (exist) { - removeFactor(f); + removeFactor(path); } - addFactor(f, c); + addFactor(f); } + /** + * Ajout d'un facteur continue de type pourcentage. + * + * @param name + * @param comment + * @param path + * @param referenceValue + * @param coefficient + * @param exist + */ + public void addContinuousPercentageFactor(String name, String comment, String path, Double referenceValue, + Double coefficient, boolean exist) { + Factor f = new Factor(name); + ContinuousDomain domain = new ContinuousDomain(true); + domain.setReferenceValue(referenceValue); + domain.setCoefficient(coefficient); + f.setDomain(domain); + f.setComment(comment); + f.setPath(path); + if (exist) { + removeFactor(path); + } + addFactor(f); + } + public void addDiscreteFactor(String name, String comment, String path, - List<Serializable> values, JComponent c, boolean exist) { - Factor<Serializable, Serializable> f = new Factor<Serializable, Serializable>(name); - DiscreteDomain<Serializable, Serializable> domain = new DiscreteDomain<Serializable, Serializable>(); - int i = 0; - for (Serializable value : values) { + List<Object> values, boolean exist) { + addDiscreteFactor(new DiscreteDomain(), name, comment, path, values, exist); + } + + public void addDiscreteRuleFactor(String name, String comment, String path, + List<Object> values, boolean exist) { + addDiscreteFactor(new RuleDiscreteDomain(), name, comment, path, values, exist); + } + + public void addDiscreteEquationFactor(String name, String comment, String path, + List<Object> values, boolean exist) { + addDiscreteFactor(new EquationDiscreteDomain(), name, comment, path, values, exist); + } + + protected void addDiscreteFactor(DiscreteDomain domain, String name, String comment, String path, + List<Object> values, boolean exist) { + Factor f = new Factor(name); + SortedMap<Object, Object> domainValues = new TreeMap<Object, Object>(); + int label = 0; + for (Object value : values) { // FIXME test when integer // Don't work with String ;( - domain.getValues().put(i, value); + domainValues.put(label, value); // and start at 0 - i++; + label++; } + domain.setValues(domainValues); f.setDomain(domain); f.setComment(comment); f.setPath(path); if (exist) { - removeFactor(f); + removeFactor(path); } - addFactor(f, c); + addFactor(f); } public void addContinuousEquationFactor(String name, String comment, String path, - EquationContinuousDomain domain, JComponent c, - boolean exist) { + EquationContinuousDomain domain, boolean exist) { // factor name need to be composed - Factor<Double, Double> f = new Factor<Double, Double>(name + "." + domain.getVariableName()); + Factor f = new Factor(name + "." + domain.getVariableName()); f.setDomain(domain); f.setComment(comment); // don't modify path, need to be valid identifier //f.setPath(path + domain.getVariableName()); f.setPath(path); if (exist) { - removeFactor(f); + removeFactor(path); } - addFactor(f, c); + addFactor(f); } public void addContinuousMatrixFactor(String name, String comment, String path, - Double coef, MatrixND matrix, - String operateur, JComponent c, boolean exist) { - Factor<MatrixND, Double> f = new Factor<MatrixND, Double>(name); - MatrixContinuousDomain domain = new MatrixContinuousDomain(); - domain.setMatrix(matrix); - domain.setOperator(operateur); + MatrixND referenceValue, Double coef, boolean exist) { + Factor f = new Factor(name); + MatrixContinuousDomain domain = new MatrixContinuousDomain(true); + domain.setReferenceValue(referenceValue); domain.setCoefficient(coef); f.setComment(comment); f.setDomain(domain); f.setPath(path); if (exist) { - removeFactor(f); + removeFactor(path); } - addFactor(f, c); + addFactor(f); } - - public JComponent getFactorComponent(Factor<?, ?> f) { - return factorComponent.get(f.getPath() + f.getName()); + + public void addContinuousMatrixFactor(String name, String comment, String path, + MatrixND minBound, MatrixND maxBound, boolean exist) { + Factor f = new Factor(name); + MatrixContinuousDomain domain = new MatrixContinuousDomain(); + domain.setMinBound(minBound); + domain.setMaxBound(maxBound); + f.setComment(comment); + f.setDomain(domain); + f.setPath(path); + if (exist) { + removeFactor(path); + } + addFactor(f); } - public void removeFactor(Factor<?, ?> f) { - factors.remove(f.getPath() + f.getName()); - factorComponent.remove(f.getPath() + f.getName()); - designPlan.setFactors(getFactors()); - } - /* ************ * General @@ -1002,15 +1093,13 @@ * @param simulationId id of the simulation to simulate * @param launcher launcher to use * @param sensitivityCalculator sensitivity calculator to use - * @param designPlan design plan for this simulation * * @see SimulatorLauncher * @see SensitivityCalculator * @see DesignPlan */ public void launchSimulation(String simulationId, - SimulatorLauncher launcher, - SensitivityCalculator sensitivityCalculator, DesignPlan designPlan) { + SimulatorLauncher launcher, SensitivityCalculator sensitivityCalculator) { String fullSimulationId = "as_" + simulationId + "_" + DATEFORMAT.format(new java.util.Date()); @@ -1030,6 +1119,8 @@ ErrorHelper.showErrorDialog(_("isisfish.simulator.simulaction.badid", fullSimulationId), null); } else { + DesignPlan designPlan = new DesignPlan(); + designPlan.setFactorGroup(factorGroup); SimulationService.getService().submit(fullSimulationId, param, launcher, 0, sensitivityCalculator, designPlan); } @@ -1043,8 +1134,7 @@ public void launchSimulationWithSensibility(String simulationId, SimulatorLauncher launcher) { - launchSimulation(simulationId, launcher, getSensitivityCalculator(), - designPlan); + launchSimulation(simulationId, launcher, getSensitivityCalculator()); } /** @@ -1127,4 +1217,145 @@ return result; } + + /** + * Population selection changed. + * + * Fill matrix panel with population effective of selected population. + * + * @param paramsUI paramsUI + */ + public void populationSelected(final ParamsUI paramsUI) { + CardLayout layout = (CardLayout)paramsUI.getPopulationEffectivesPanel().getLayout(); + + Object[] selectedPopulationsValues = paramsUI.getListSimulParamsPopulations().getSelectedValues(); + if (ArrayUtils.isNotEmpty(selectedPopulationsValues)) { + paramsUI.getPopulationEffectivesTabbedPane().removeAll(); + setPopulations(selectedPopulationsValues); + + for (Object selectedPopulationValue : selectedPopulationsValues) { + Population selectedPopulation = (Population)selectedPopulationValue; + final MatrixPanelEditor matrixPanel = new MatrixPanelEditor(); + MatrixND populationEffectives = getSimulationParameter().getNumberOf(selectedPopulation); + matrixPanel.setMatrix(populationEffectives); + + JPanel matrixPanelComponent = new JPanel(new BorderLayout()); + matrixPanelComponent.add(matrixPanel, BorderLayout.CENTER); + + // add addFactorButton with matrixPanel (just in sensitivity cas) + if (paramsUI.isSensitivity()) { + matrixPanel.putClientProperty("sensitivityPopulation", selectedPopulation); + // TODO add another thing that action + JButton addFactorButton = new JButton(SwingUtil.createImageIcon("building_add.png")); + addFactorButton.setAction(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + addFactorWithComponent(paramsUI, matrixPanel); + } + }); + matrixPanelComponent.add(addFactorButton, BorderLayout.EAST); + } + + paramsUI.getPopulationEffectivesTabbedPane().add(matrixPanelComponent, + _("isisfish.params.populationEffectives", selectedPopulation.getName())); + } + + layout.show(paramsUI.getPopulationEffectivesPanel(), "specific"); + } + else { + layout.show(paramsUI.getPopulationEffectivesPanel(), "default"); + } + } + + /** + * Action appelée lors du clic sur les boutons a coté des composants factorisables. + * + * Contrairement à l'interface 'input', on edite ici des facteurs existants, + * (créé à la première demande). + * + * @param paramsUI paramsUI + * @param source la source de l'event + */ + public void addFactorWithComponent(ParamsUI paramsUI, JComponent source) { + + if (log.isDebugEnabled()) { + log.debug("Event intercepted on " + source); + } + + Factor selectedFactor = null; + + // new factor with rule domain + if (source instanceof RuleChooser) { + String factorPath = "parameters.rules"; + selectedFactor = getFactor(factorPath); + if (selectedFactor == null) { + selectedFactor = new Factor(_("isisfish.sensitivity.rulesfactorname")); + selectedFactor.setPath(factorPath); + selectedFactor.setDomain(new RuleDiscreteDomain()); + } + } + + // new factor with matrix continous domain + else if (source instanceof MatrixPanelEditor) { + Population population = (Population)source.getClientProperty("sensitivityPopulation"); + String factorPath = "parameters.population." + population.getName() + ".number"; + selectedFactor = getFactor(factorPath); + if (selectedFactor == null) { + selectedFactor = new Factor(_("isisfish.sensitivity.populationfactorname", population.getName())); + selectedFactor.setPath(factorPath); + MatrixContinuousDomain factorDomain = new MatrixContinuousDomain(); + MatrixND populationEffectives = getSimulationParameter().getNumberOf(population); + factorDomain.setReferenceValue(populationEffectives.copy()); + factorDomain.setCoefficient(0.0); + selectedFactor.setDomain(factorDomain); + } + } + + if (selectedFactor != null) { + FactorWizardUI wizard = new FactorWizardUI(paramsUI); + SensitivityInputHandler handler = wizard.getHandler(); + handler.initExistingFactor(wizard, selectedFactor); + wizard.pack(); + wizard.setLocationRelativeTo(paramsUI); + wizard.setVisible(true); + } + } + + /** + * Ajout d'un nouveau facteur sur un parametres de règles. + * + * Le facteur est directement crée avec un nom et un path correct. + * + * @param ruleChooser rule chooser + * @param rule rule + * @param paramName rule parameter name + */ + public void addRuleParameterFactor(RuleChooser ruleChooser, Rule rule, String paramName) { + + // get sensitivity handler (this break package rules) + // but no other choice :( + SensitivityInputHandler handler = new SensitivityInputHandler(); + + // get index of rule in rule list + // warning, factor path must always be cohérent + // with rule list, if a rule is deleted, factor on it must + // be deleted too, et next factor must be renamed + int index = ruleChooser.getRulesList().indexOf(rule); + String factorPath = "parameters.rule." + index + ".parameter." + paramName; + try { + // arrivé ici, on doit pouvoir la mettre en facteur + Object object = RuleStorage.getParameterValue(rule, paramName); + + // init new factor wizard ui + FactorWizardUI factorWizardUI = new FactorWizardUI(ruleChooser); + factorWizardUI.getFactorNameField().setText(_("isisfish.sensitivity.ruleparameterfactorname", + rule.getClass().getSimpleName(), paramName)); + factorWizardUI.setFactorPath(factorPath); + handler.initNewFactorWithValue(factorWizardUI, object); + factorWizardUI.pack(); + factorWizardUI.setLocationRelativeTo(ruleChooser); + factorWizardUI.setVisible(true); + } catch (IsisFishException ex) { + throw new IsisFishRuntimeException("Can't add factor on rule", ex); + } + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, CodeLutin + Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -22,85 +22,66 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<JPanel layout='{new BorderLayout()}'> - +<fr.ifremer.isisfish.ui.SimulationUI> + <script><![CDATA[ - import jaxx.runtime.JAXXInitialContext; - import fr.ifremer.isisfish.ui.input.InputAction; - import fr.ifremer.isisfish.ui.input.InputSaveVerifier; - import fr.ifremer.isisfish.datastore.StorageException; - import fr.ifremer.isisfish.entities.FisheryRegionImpl; - import javax.swing.ToolTipManager; + @Override + public void refresh() { + paramsUI.refresh(); + preScriptUI.refresh(); + sensUI.refresh(); + exportUI.refresh(); + resultChoiceUI.refresh(); + advancedParamsUI.refresh(); + } + + /** + * Refresh all simulation launch UI. + */ + @Override + protected void regionStorageChanged() { + + } + + @Override + public void selectParametersTab() { + bodyTabbedPane.setSelectedIndex(0); + } - public SimulUI(SimulAction action) { - setContextValue(action); + @Override + public void setEnabledPrescriptTab(boolean selected) { + bodyTabbedPane.setEnabledAt(1, selected); + if (selected) { + bodyTabbedPane.setSelectedIndex(1); } - protected void enablePreSimul(boolean selected) { - simulTabs.setEnabledAt(1, selected); + } + + @Override + public void setEnabledAnalysePlanTab(boolean selected) { + bodyTabbedPane.setEnabledAt(2, selected); + if (selected) { + bodyTabbedPane.setSelectedIndex(2); } - protected void enableAnalysePlan(boolean selected) { - simulTabs.setEnabledAt(2, selected); - } - protected void selTab(int i) { - simulTabs.setSelectedIndex(i); - } - public void refresh() { - paramsUI.refresh(); - preScriptUI.refresh(); - sensUI.refresh(); - exportUI.refresh(); - resultChoiceUI.refresh(); - advancedParamsUI.refresh(); - } - // TODO duplicated code (simulUI, Params UI, SensitivityUI) - protected void importSimulation() { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showOpenDialog(null); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - //This is where a real application would open the file. - getContextValue(SimulAction.class).importSimulation(file); - refresh(); - } - } - // TODO duplicated code (simulUI, Params UI, SensitivityUI) - protected void saveSimulation() { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(null); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - //This is where a real application would open the file. - getContextValue(SimulAction.class).saveSimulation(file); - } - } - ]]> - </script> - <JMenuBar id="simulMenuBar" constraints='BorderLayout.NORTH'> - <JMenu id="simulMenu" text="isisfish.simulation.menu.simulation"> - <JMenuItem id="siSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/> - <JMenuItem id="siImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/> - </JMenu> - </JMenuBar> - <JTabbedPane id="simulTabs" constraints='BorderLayout.CENTER'> - <tab id="paramsUITab" title='isisfish.params.title'> - <ParamsUI id="paramsUI" constructorParams='this' /> + } + ]]></script> + <JTabbedPane id="bodyTabbedPane"> + <tab title='isisfish.params.title'> + <ParamsUI id="paramsUI" constructorParams='this' regionStorage="{getRegionStorage()}"/> </tab> - <tab id="preScriptUITab" title='isisfish.preScript.title' enabled='false'> + <tab title='isisfish.preScript.title' enabled='false'> <PreScriptsUI id="preScriptUI" constructorParams='this' /> </tab> - <tab id="sensUITab" title='isisfish.sens.title' enabled='false'> + <tab title='isisfish.sens.title' enabled='false'> <SensUI id="sensUI" constructorParams='this' /> </tab> - <tab id="exportUITab" title='isisfish.export.title'> + <tab title='isisfish.export.title'> <ExportUI id="exportUI" constructorParams='this' /> </tab> - <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'> + <tab title='isisfish.resultChoice.title'> <ResultChoiceUI id="resultChoiceUI" constructorParams='this' /> </tab> - <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'> + <tab title='isisfish.advancedParameters.title'> <AdvancedParamsUI id="advancedParamsUI" constructorParams='this' /> </tab> </JTabbedPane> -</JPanel> \ No newline at end of file +</fr.ifremer.isisfish.ui.SimulationUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialog.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialog.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialog.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -71,7 +71,7 @@ if ($binding.equals("reset.enabled")) { if (comboResult != null) { $bindingSources.put("comboResult", comboResult); - this.comboResult.addItemListener((java.awt.event.ItemListener) jaxx.runtime.Util.getEventListener(java.awt.event.ItemListener.class, this, "$pr$u10")); + this.comboResult.addItemListener((java.awt.event.ItemListener) jaxx.runtime.JAXXUtil.getEventListener(java.awt.event.ItemListener.class, this, "$pr$u10")); } processDataBinding($binding); } else super.applyDataBinding($binding); @@ -80,7 +80,7 @@ public void removeDataBinding(String $binding) { if ($binding.equals("reset.enabled")) { if (comboResult != null) { - ((jaxx.runtime.swing.JAXXComboBox) $bindingSources.remove("comboResult")).removeItemListener((java.awt.event.ItemListener) jaxx.runtime.Util.getEventListener(java.awt.event.ItemListener.class, this, "$pr$u10")); + ((jaxx.runtime.swing.JAXXComboBox) $bindingSources.remove("comboResult")).removeItemListener((java.awt.event.ItemListener) jaxx.runtime.JAXXUtil.getEventListener(java.awt.event.ItemListener.class, this, "$pr$u10")); } } else super.removeDataBinding($binding); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,5 +23,5 @@ #L% --> <fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI modal="true"> - <fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterPanelUI id='content' constructorParams='this'/> + <fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterPanelUI id='content' constructorParams='this'/> </fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterPanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterPanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/filter/SimulationFilterPanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,13 +23,17 @@ #L% --> <fr.ifremer.isisfish.ui.widget.filter.FilterPanelUI> - <script> - import fr.ifremer.isisfish.simulator.SimulationMeta; - - protected static java.text.SimpleDateFormat simpleDateFormat = - new java.text.SimpleDateFormat("dd/MM/yyyy"); +<import> + fr.ifremer.isisfish.simulator.SimulationMeta + fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI + org.jdesktop.swingx.JXDatePicker + + java.text.SimpleDateFormat +</import> +<script><![CDATA[ + protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); - public SimulationFilterPanelUI(fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI dialog) { + public SimulationFilterPanelUI(FilterDialogUI dialog) { super(dialog); } /** @@ -56,8 +60,8 @@ SimulationMeta.simulationStart.name(), SimulationMeta.simulationEnd.name()); } - </script> - <Table> + ]]></script> +<Table> <row fill='horizontal'> <cell> <JLabel labelFor='{simulationName}' @@ -104,15 +108,13 @@ <JLabel labelFor='{simulationStart}' text='isisfish.filter.simulation.simulationStart' toolTipText='isisfish.filter.simulation.tooltip.simulationStart'/> - <org.nuiton.widget.DatePicker - id="simulationStart" constructorParams="simpleDateFormat" - columns='7' onFocusLost="doCheck()"/> + <JXDatePicker + id="simulationStart" onFocusLost="doCheck()"/> <JLabel labelFor='{simulationEnd}' text='isisfish.filter.simulation.simulationEnd' toolTipText='isisfish.filter.simulation.tooltip.simulationEnd'/> - <org.nuiton.widget.DatePicker - id="simulationEnd" constructorParams="simpleDateFormat" - columns='7' onFocusLost="doCheck()"/> + <JXDatePicker + id="simulationEnd" onFocusLost="doCheck()"/> </HBox> </cell> </row> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/util/ErrorHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -28,10 +28,25 @@ import static org.nuiton.i18n.I18n._; import java.awt.Component; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import javax.swing.JOptionPane; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.MultiPartEmail; import org.jdesktop.swingx.JXErrorPane; import org.jdesktop.swingx.error.ErrorInfo; +import org.jdesktop.swingx.error.ErrorReporter; +import fr.ifremer.isisfish.IsisConfig; +import fr.ifremer.isisfish.IsisFish; + /** * Error helper. * @@ -41,7 +56,7 @@ * Last update : $Date$ * By : $Author$ */ -public class ErrorHelper { +public class ErrorHelper implements ErrorReporter { /** * Display a user friendly error frame. @@ -52,11 +67,15 @@ */ public static void showErrorDialog(Component parent, String message, Throwable cause) { - + JXErrorPane pane = new JXErrorPane(); ErrorInfo info = new ErrorInfo(_("isisfish.error.errorpane.title"), _("isisfish.error.errorpane.htmlmessage", message), null, null, cause, null, null); - JXErrorPane.showDialog(parent, info); + pane.setErrorInfo(info); + if (cause != null) { + pane.setErrorReporter(new ErrorHelper()); + } + JXErrorPane.showDialog(parent, pane); } /** @@ -77,4 +96,70 @@ public static void showErrorDialog(String message, Throwable cause) { showErrorDialog(null, message, cause); } + + /* + * @see org.jdesktop.swingx.error.ErrorReporter#reportError(org.jdesktop.swingx.error.ErrorInfo) + */ + @Override + public void reportError(ErrorInfo errorInfo) throws NullPointerException { + + MultiPartEmail email = new MultiPartEmail(); + try { + String emailTo = "support at codelutin.com"; + + // smtp + email.setHostName("smtp"); + // to + email.addTo(emailTo, "Support"); + + // from + email.setFrom("no-reply at isis-fish.org", "Isis-Fish"); + // subject + email.setSubject("Project error notification : Isis-Fish"); + // add reply-to for spam + email.addReplyTo("no-reply at isis-fish.org"); + + // message description + String message = formatMessage("Project", "Isis-Fish " + IsisConfig.getVersion()); + message += formatMessage("Date", new Date().toString()); + message += formatMessage("Title", errorInfo.getTitle()); + message += formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", "")); + + // message configuration + message += formatMessage("Configuration", null); + List<String> propertiesNames = new ArrayList<String>(IsisFish.config.getOptions().stringPropertyNames()); + Collections.sort(propertiesNames); + for (String propertyName : propertiesNames) { + // security, don't send string containing password : + if (!propertyName.contains("pass")) { + message += "\t" + propertyName + " : " + IsisFish.config.getOptions().getProperty(propertyName) + "\n"; + } + } + + // message exception + StringWriter out = new StringWriter(); + PrintWriter writer = new PrintWriter(out); + errorInfo.getErrorException().printStackTrace(writer); + message += formatMessage("Exception", out.toString()); + + // TODO i18n files are iso encoded :( + email.setContent(message, "text/plain; charset=ISO-8859-9"); + + // send mail + email.send(); + + JOptionPane.showMessageDialog(null, "A report message has been sent to " + emailTo); + } catch (EmailException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected String formatMessage(String category, String content) { + String formatted = category + " :\n"; + if (StringUtils.isNotEmpty(content)) { + formatted += "\t" + content + "\n"; + } + return formatted; + } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/CommitDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,12 +23,12 @@ #L% --> <JDialog modal="true" title='isisfish.vcs.commit'> + <import> + java.awt.Color + </import> <script><![CDATA[ // FIXME a refaire -// import org.nuiton.vcs.ui.FieldModelUtil.ModuleFile; -// import org.nuiton.vcs.VCSFileState; - // protected ModuleFile<VCSFileState> model; protected Object model; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateConfirmDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,13 +23,12 @@ #L% --> <JDialog modal="true" title='isisfish.vcs.updateconfirm'> + <import> + java.awt.Color + </import> <script><![CDATA[ // FIXME a refaire - -// import org.nuiton.vcs.ui.FieldModelUtil.ModuleFile; -// import org.nuiton.vcs.VCSFileState; - // protected ModuleFile<VCSFileState> model; protected Object model; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/UpdateDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -26,9 +26,6 @@ <script><![CDATA[ // FIXME a refaire -// import static org.nuiton.vcs.VCSState.*; -// import org.nuiton.vcs.VCSState; - // protected org.nuiton.vcs.VCSRepositoryState model; protected Object model; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSConfigUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,16 +23,21 @@ #L% --> <JDialog> + <import> + javax.swing.text.html.HTMLEditorKit; + javax.swing.text.html.HTMLDocument; + javax.swing.event.HyperlinkListener; + javax.swing.text.html.HTMLFrameHyperlinkEvent; + javax.swing.event.HyperlinkEvent; + java.io.PrintWriter; + java.io.StringWriter; + java.net.URL; + javax.swing.JComponent + java.awt.Color + java.awt.Desktop + </import> + <script><![CDATA[ - import javax.swing.text.html.HTMLEditorKit; - import javax.swing.text.html.HTMLDocument; - import javax.swing.event.HyperlinkListener; - import javax.swing.text.html.HTMLFrameHyperlinkEvent; - import javax.swing.event.HyperlinkEvent; - import java.io.PrintWriter; - import java.io.StringWriter; - import java.net.URL; - public boolean cancel; protected boolean invalidFirstName; protected boolean invalidLastName; @@ -147,8 +152,8 @@ <row fill='horizontal'> <cell columns='2' weighty="1" fill='both'> <JScrollPane height="60"> - <JEditorPane id="helpEditor" editable="false" /> - </JScrollPane> + <JEditorPane id="helpEditor" editable="false" /> + </JScrollPane> </cell> </row> <row fill='horizontal'> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSGenerateSshKeyUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,17 +23,22 @@ #L% --> <JDialog title='isisfish.server.ssh.generateKey.title' modal='true'> + <import> + com.jcraft.jsch.JSch; + com.jcraft.jsch.KeyPair; + org.nuiton.util.FileUtil; + java.io.File; + java.io.IOException; + java.util.ArrayList; + java.util.Arrays; + java.util.HashMap; + java.util.Map; + java.awt.Color + javax.swing.JComponent + </import> <script><![CDATA[ - import com.jcraft.jsch.JSch; - import com.jcraft.jsch.KeyPair; - import org.nuiton.util.FileUtil; - import java.io.File; - import java.io.IOException; - import java.util.ArrayList; - import java.util.Arrays; - import java.util.HashMap; - import java.util.Map; + private static VCSGenerateSshKeyUI instance; public static VCSGenerateSshKeyUI getInstance(JDialog parent) { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/vcs/VCSPassPhraseUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,6 +23,11 @@ #L% --> <JDialog title='isisfish.vcs.ask.passphrase.title' modal='true'> + <import> + java.io.BufferedReader + java.io.InputStreamReader + java.io.IOException + </import> <script><![CDATA[ private boolean cancel; private static VCSPassPhraseUI instance; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,55 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.widget; - -import java.awt.Frame; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** - * FormInterval. - */ -public class FormInterval extends Frame { - - /** serialVersionUID. */ - private static final long serialVersionUID = 4911081593147906648L; - - class QuitListener extends WindowAdapter { - public void windowClosing(WindowEvent e) { - e.getWindow().dispose(); - } - } - - public FormInterval(Interval i) { - IntervalPanel ip = new IntervalPanel(); - this.add(ip); - // ip.setEnabled(false); - ip.setModel(i); - - this.addWindowListener(new QuitListener()); - pack(); - } -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/Interval.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/Interval.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/Interval.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -76,7 +76,9 @@ } /** - * Retourne le nombre minimal que peut prendre comme valeur cette interval + * Retourne le nombre minimal que peut prendre comme valeur cette interval. + * + * @return interval minimal value */ public int getMin() { return min; @@ -91,7 +93,9 @@ } /** - * Retourne le nombre maximal que peut prendre comme valeur cette interval + * Retourne le nombre maximal que peut prendre comme valeur cette interval. + * + * @return interval maximal value */ public int getMax() { return max; @@ -209,9 +213,10 @@ } /** - * retourne une chaine XML qui represente l'objet. + * Retourne une chaine XML qui represente l'objet. * * @deprecated since 20090414 (unused) + * @return interval representation as xml */ public String toXML() { return "<Interval min=\"" + getMin() + "\" max=\"" + getMax() @@ -220,27 +225,9 @@ } /** - * Retourne une representation string de la valeur donne. - * - * @deprecated since 20090414 (unused) - */ - public String getString(int entier) { - return String.valueOf(entier); - } - - /** - * Retourne une representation entiere de la valeur String donne - * - * @deprecated since 20090414 (unused) - */ - public int getString(String ch) { - return Integer.parseInt(ch); - } - - /** * @return une iteration */ - public Iterator iterator() { + public Iterator<Integer> iterator() { return new IntervalIterator(getMin(), getMax(), getFirst(), getLast()); } @@ -269,8 +256,8 @@ return result; } - public static class IntervalIterator implements Iterator { - private int min; + public static class IntervalIterator implements Iterator<Integer> { + //private int min; private int max; @@ -281,7 +268,7 @@ private int current; public IntervalIterator(int min, int max, int first, int last) { - this.min = min; + //this.min = min; this.max = max; this.first = first; this.last = last; @@ -298,7 +285,7 @@ return (current++) % (max + 1); } - public Object next() { + public Integer next() { return new Integer(nextInt()); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalGraphic.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalGraphic.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalGraphic.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -52,7 +52,7 @@ /** serialVersionUID. */ private static final long serialVersionUID = -6795996897731533693L; - + /* some constants. */ private static final int HANDLE_WITH = 5; private static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR); @@ -61,117 +61,118 @@ private static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR); /* Colors. */ - private Color backColor = Color.blue; - private Color foreColor = Color.yellow; - private Color lineColor = Color.yellow.darker(); + private Color backColor = Color.BLUE; + private Color foreColor = Color.YELLOW; + private Color lineColor = Color.YELLOW.darker(); protected Interval model; /** - * rapport entre le model et la vu + * Rapport entre le model et la vue. */ protected float coef; /** - * decalage de la position de la souris lors d'un drag par rapport - * a la position de l'element 1 + * Decalage de la position de la souris lors d'un drag par rapport + * à la position de l'element 1. */ protected float delta; //tous pour changer la selection avec la souris private boolean inDrag = false; private int cursorType = 1; - private Cursor mouseCursor; + //private Cursor mouseCursor; - //si vrai le composant est editable private boolean enable = true; class MouseClick extends MouseAdapter { - public void mouseEntered( MouseEvent e) { + /*public void mouseEntered( MouseEvent e) { mouseCursor = getCursor(); - } - public void mousePressed( MouseEvent e) { + }*/ + public void mousePressed(MouseEvent e) { int mouseX = e.getX(); - if(model.getFirst() <= model.getLast()) { - inDrag = (model.getFirst()*coef - HANDLE_WITH < mouseX) && - (mouseX < (model.getLast()+1)*coef + HANDLE_WITH); + if (model.getFirst() <= model.getLast()) { + inDrag = (model.getFirst() * coef - HANDLE_WITH < mouseX) + && (mouseX < (model.getLast() + 1) * coef + HANDLE_WITH); + } else if (model.getFirst() > model.getLast()) { + inDrag = ((0 <= mouseX) && (mouseX < (model.getLast() + 1) + * coef + HANDLE_WITH)) + || ((model.getFirst() * coef - HANDLE_WITH < mouseX) && (mouseX <= getSize().width)); } - else if(model.getFirst() > model.getLast()) { - inDrag = - ((0 <= mouseX) && - (mouseX < (model.getLast()+1)*coef + HANDLE_WITH)) - || - ((model.getFirst()*coef - HANDLE_WITH < mouseX) && - (mouseX <= getSize().width)); + if (inDrag) { + delta = mouseX - (model.getFirst() * coef); } - if(inDrag) { - delta = mouseX - (model.getFirst()*coef); - } } - public void mouseReleased( MouseEvent e) { + public void mouseReleased(MouseEvent e) { inDrag = false; } } class MouseMove extends MouseMotionAdapter { - public void mouseMoved( MouseEvent e ) { + public void mouseMoved(MouseEvent e) { if (!inDrag && enable) { int x = e.getX(); //on determine sur quel section on est - if((model.getFirst()*coef - HANDLE_WITH < x ) && - (x < model.getFirst()*coef + HANDLE_WITH)) { - cursorType = 0; - setCursor(W_RESIZE_CURSOR); - }else if(((model.getLast()+1)*coef - HANDLE_WITH <x ) && - (x < (model.getLast()+1)*coef + HANDLE_WITH)) { - cursorType = 2; - setCursor(E_RESIZE_CURSOR); - delta = x - (model.getLast()*coef); + if ((model.getFirst() * coef - HANDLE_WITH < x) + && (x < model.getFirst() * coef + HANDLE_WITH)) { + cursorType = 0; + setCursor(W_RESIZE_CURSOR); + } else if (((model.getLast() + 1) * coef - HANDLE_WITH < x) + && (x < (model.getLast() + 1) * coef + HANDLE_WITH)) { + cursorType = 2; + setCursor(E_RESIZE_CURSOR); + delta = x - (model.getLast() * coef); + } else { + boolean bool = ((model.getFirst() <= model.getLast()) + && (model.getFirst() * coef + HANDLE_WITH < x) && (x < (model + .getLast() + 1) + * coef - HANDLE_WITH)) + || ((model.getFirst() > model.getLast()) && (((0 <= x) && (x < (model + .getLast() + 1) + * coef - HANDLE_WITH)) || ((model + .getFirst() + * coef + HANDLE_WITH < x) && (x <= getSize().width)))); + + if (bool) { + cursorType = 1; + setCursor(MOVE_CURSOR); } else { - boolean bool = - ((model.getFirst() <= model.getLast()) && - (model.getFirst()*coef + HANDLE_WITH < x) && - (x < (model.getLast()+1)*coef - HANDLE_WITH)) - || - ((model.getFirst() > model.getLast()) && - (((0 <= x) && - (x < (model.getLast()+1)*coef - HANDLE_WITH)) - || - ((model.getFirst()*coef + HANDLE_WITH < x) && - (x <= getSize().width)))); - - if (bool) { - cursorType = 1; - setCursor(MOVE_CURSOR); - } - else { - cursorType = 4; - setCursor(DEFAULT_CURSOR); - } + cursorType = 4; + setCursor(DEFAULT_CURSOR); } + } } } - public void mouseDragged( MouseEvent e ){ - if (inDrag && enable){ - int x=e.getX(); - switch (cursorType){ - case 0: //on tire par le debut - if (x < 0) x = 0; - if (x > getSize().width) x = getSize().width; + public void mouseDragged(MouseEvent e) { + if (inDrag && enable) { + int x = e.getX(); + switch (cursorType) { + case 0: //on tire par le debut + if (x < 0) { + x = 0; + } + if (x > getSize().width) { + x = getSize().width; + } model.setFirst(Math.round(x / coef)); break; - case 1: //on deplace - int decal = Math.round((x-delta)/coef) - model.getFirst(); + case 1: //on deplace + int decal = Math.round((x - delta) / coef) + - model.getFirst(); model.move(decal); break; - case 2: //on tire par la fin - if (x < 0) x = 0; - if (x > getSize().width) x = getSize().width; - model.setLast(Math.round((x-coef) / coef)); + case 2: //on tire par la fin + if (x < 0) { + x = 0; + } + if (x > getSize().width) { + x = getSize().width; + } + model.setLast(Math.round((x - coef) / coef)); break; } } @@ -179,17 +180,19 @@ } /** - * Constructeur - */ - public IntervalGraphic(Interval m){ + * Constructor with interval value. + * + * @param m interval + */ + public IntervalGraphic(Interval m) { super(); setModel(m); addMouseListener(new MouseClick()); addMouseMotionListener(new MouseMove()); } - public void setModel(Interval m){ - if(this.model != null) { + public void setModel(Interval m) { + if (this.model != null) { this.model.deleteObserver(this); } this.model = m; @@ -197,15 +200,15 @@ update(this.model, null); } - public void setEnabled(boolean enable){ + public void setEnabled(boolean enable) { this.enable = enable; } /** - * Dessine sur le graphique l'interval courant - */ - protected void redraw( Graphics g ) { - coef = (float)getSize().width / (float)(model.getMax()+1); + * Dessine sur le graphique l'interval courant. + */ + protected void redraw(Graphics g) { + coef = (float) getSize().width / (float) (model.getMax() + 1); int width = getSize().width; int height = getSize().height; @@ -215,46 +218,43 @@ //peindre le fond tmpg.setColor(backColor); - tmpg.fillRect(0 , 0, width, height); + tmpg.fillRect(0, 0, width, height); //peindre la section tmpg.setColor(foreColor); - for (Interval.IntervalIterator i=(Interval.IntervalIterator)model.iterator();i.hasNext();){ + for (Interval.IntervalIterator i = (Interval.IntervalIterator) model + .iterator(); i.hasNext();) { int val = i.nextInt(); tmpg.setColor(foreColor); - tmpg.fillRect(Math.round(val*coef) , 0, - Math.round(coef) , height); + tmpg.fillRect(Math.round(val * coef), 0, Math.round(coef), height); tmpg.setColor(lineColor); - tmpg.drawRect(Math.round(val*coef) , 0, - Math.round(coef) , height); + tmpg.drawRect(Math.round(val * coef), 0, Math.round(coef), height); } g.drawImage(ImageBuffer, 0, 0, getSize().width, getSize().height, - new ImageObserver(){ - public boolean imageUpdate( Image img, int infoflags, - int x, int y, - int width, int height ){ - return true; - } - }); + new ImageObserver() { + public boolean imageUpdate(Image img, int infoflags, int x, + int y, int width, int height) { + return true; + } + }); } - /** - */ - public void paint( Graphics g ){ + @Override + public void paint(Graphics g) { redraw(g); } - /** - */ - public void update( Graphics g ){ + @Override + public void update(Graphics g) { redraw(g); } /** - * Call by observable object - */ - public void update(Observable o, Object arg){ + * Called by observable object. + */ + @Override + public void update(Observable o, Object arg) { repaint(); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalLabel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalLabel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalLabel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -40,7 +40,7 @@ * Mise a jour: $Date: 2009-03-09 15:40:20 +0100 (lun. 09 mars 2009) $ * par : $Author: sletellier $ */ -class IntervalLabel extends JLabel implements Observer { +public class IntervalLabel extends JLabel implements Observer { /** serialVersionUID. */ private static final long serialVersionUID = -6269941008930677478L; @@ -66,6 +66,7 @@ this.renderArray = renderArray; } + @Override public void update(Observable o, Object arg) { setText(toString(model.getFirst()) + " - " + toString(model.getLast())); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalPanel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalPanel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalPanel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -46,15 +46,10 @@ /** serialVersionUID. */ private static final long serialVersionUID = 4245022583233407638L; + private final static int DEFAULT_WIDTH = 110; private final static int DEFAULT_HEIGHT = 50; - public static void main(String args[]) { - Interval i = new Interval(0, 11); - FormInterval f = new FormInterval(i); - f.setVisible(true); - } - private Interval model = null; private IntervalGraphic graph; private IntervalLabel label; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,61 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.widget; - -import fr.ifremer.isisfish.IsisFish; -import javax.swing.Icon; -import javax.swing.JLabel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.Resource; - -/** - * VCSConnectionState. - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - * - * @deprecated since 20090414 (unused) - */ -public class VCSConnectionState extends JLabel { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static Log log = LogFactory.getLog(VCSConnectionState.class); - - public VCSConnectionState() { - Icon icon; - boolean connected = IsisFish.vcs.isConnected(); - if (connected) { - icon = Resource.getIcon("images/stock_connect.png"); - } else { - icon = Resource.getIcon("images/stock_disconnect.png"); - } - setIcon(icon); - } - -} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -56,8 +56,6 @@ import fr.ifremer.isisfish.util.ConverterUtil; /** - * ParameterTableCellEditor. - * * Un editeur generic de champs qui se base sur le model de données * a editer. * @@ -77,7 +75,7 @@ /** Class logger. */ private static Log log = LogFactory.getLog(ParameterTableCellEditor.class); - protected RegionStorage region = null; + protected RegionStorage regionStorage = null; protected Component editor = null; @@ -122,18 +120,24 @@ } /** - * @return Returns the topiaContext. + * Return region storage. + * + * @return returns the region storage. */ public RegionStorage getRegion() { - return this.region; + return regionStorage; } /** - * @param region - * The topiaContext to set. + * Set region storage. + * + * @param regionStorage the region storage to set. */ - public void setRegion(RegionStorage region) { - this.region = region; + public void setRegionStorage(RegionStorage regionStorage) { + this.regionStorage = regionStorage; + if (regionStorage == null && log.isWarnEnabled()) { + log.warn("setRegionStorage called with null value in parameters table cell editor"); + } } public Component getTableCellEditorComponent(JTable table, Object value, @@ -149,10 +153,10 @@ case Topia: // on a un bean comme parametre try { - if (region == null) { + if (regionStorage == null) { return null; } - TopiaContext context = region.getStorage().beginTransaction(); + TopiaContext context = regionStorage.getStorage().beginTransaction(); if (context != null) { List list = context.find("from " + type.getName()); c = new JComboBox(list.toArray()); @@ -184,14 +188,11 @@ } int month = date.getMonth().getMonthNumber(); int yea = date.getYear(); - editor = new DateComponent(month, yea, region == null ? null : region - .getStorage()); + editor = new DateComponent(month, yea); //editor = new JTextField(String.valueOf(date.getDate())); break; case Mounth: - editor = DateComponent.createMounthCombo(((Month) value) - .getMonthNumber(), region == null ? null : region - .getStorage()); + editor = DateComponent.createMounthCombo(((Month) value).getMonthNumber()); break; case File: // break; @@ -225,7 +226,7 @@ log.debug("getCellEditorValue [" + type + "] [mapping:" + mapping + "=" + editor); } - + return editor; } @@ -287,8 +288,9 @@ } if (result instanceof String && !String.class.equals(type)) { - if (region != null) - context = region.getStorage(); + if (regionStorage != null) { + context = regionStorage.getStorage(); + } ConvertUtilsBean cub = ConverterUtil.getConverter(context); result = cub.convert((String) result, type); } @@ -321,10 +323,10 @@ protected JComboBox year; - public DateComponent(int mounth, int year, TopiaContext context) { + public DateComponent(int mounth, int year) { super(new GridLayout(0, 2)); - this.mounth = createMounthCombo(mounth, context); + this.mounth = createMounthCombo(mounth); this.year = createYearCombo(200, year); this.add(this.mounth); @@ -355,48 +357,19 @@ public int getSelectedValue() { int selectedYear = getSelectedYear(); int selectedMounth = getSelectedMounth(); - if (log.isInfoEnabled()) { - log.info("selected mounth " + selectedMounth); - log.info("selected year " + selectedYear); + if (log.isDebugEnabled()) { + log.debug("selected mounth " + selectedMounth); + log.debug("selected year " + selectedYear); } return selectedMounth + selectedYear * 12; } - public static JComboBox createMounthCombo(int mounth, - TopiaContext context) { + public static JComboBox createMounthCombo(int mounth) { JComboBox combo = EnumEditor.newEditor(MonthEnum.class); combo.setSelectedIndex(mounth); return combo; } - /*public static JComboBox createMounthCombo(int mounth, TopiaContext context) { - JComboBox combo = createMounthCombo0(context); - combo.setSelectedIndex(mounth); - return combo; - } - - private static JComboBox createMounthCombo0(TopiaContext context) { - - List<String> listM = new ArrayList<String>(); - // TODO Should use database ? data instead of thoses awfull hardcore - // code... - listM.add("janvier"); - listM.add("fevrier"); - listM.add("mars"); - listM.add("avril"); - listM.add("mai"); - listM.add("juin"); - listM.add("juillet"); - listM.add("aout"); - listM.add("septembre"); - listM.add("octobre"); - listM.add("novembre"); - listM.add("decembre"); - JComboBox combo = new JComboBox(listM.toArray()); - listM.clear(); - return combo; - }*/ - public static JComboBox createYearCombo(int nb, int selectedYear) { List<Integer> listI = new ArrayList<Integer>(); for (int i = 0; i < nb; i++) Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterDialogUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterDialogUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,26 +23,31 @@ #L% --> <JDialog> - <script> - import jaxx.runtime.JAXXObject; - import javax.swing.text.html.HTMLEditorKit; - import javax.swing.text.html.HTMLDocument; - import javax.swing.event.HyperlinkListener; - import javax.swing.text.html.HTMLFrameHyperlinkEvent; - import javax.swing.event.HyperlinkEvent; - import java.io.PrintWriter; - import java.io.StringWriter; + <import> + jaxx.runtime.JAXXObject + javax.swing.text.html.HTMLEditorKit + javax.swing.text.html.HTMLDocument + javax.swing.event.HyperlinkListener + javax.swing.text.html.HTMLFrameHyperlinkEvent + javax.swing.event.HyperlinkEvent + java.io.PrintWriter + java.io.StringWriter - import org.nuiton.widget.DatePicker; - import org.nuiton.widget.InvalidDateException; - + fr.ifremer.isisfish.ui.widget.filter.FilterModel + fr.ifremer.isisfish.ui.widget.filter.FilterParamModel + fr.ifremer.isisfish.ui.widget.filter.FilterPanelUI + java.util.List + java.awt.Desktop + javax.swing.DefaultComboBoxModel + </import> + <script><![CDATA[ /** filter model */ - protected fr.ifremer.isisfish.ui.widget.filter.FilterModel model; + protected FilterModel model; /** use to display filtered result in a comboBox */ protected DefaultComboBoxModel modelResult; - public fr.ifremer.isisfish.ui.widget.filter.FilterParamModel getParamModel(String paramKey) { + public FilterParamModel getParamModel(String paramKey) { return model.getParamModel(paramKey); } @SuppressWarnings({"unchecked"}) @@ -51,12 +56,12 @@ } /** @return list of last filter list obtain */ @SuppressWarnings({"unchecked"}) - protected java.util.List getFilterResult() { + protected List getFilterResult() { // obtain list filtered return model.getFiltered(); } @SuppressWarnings({"unchecked"}) - public java.util.List obtainFilterResult() { + public List obtainFilterResult() { // compact dialog setSize(getMinimumSize()); repaint(); @@ -134,7 +139,7 @@ (HTMLFrameHyperlinkEvent)e); } else { try { - if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { Desktop.getDesktop().browse(e.getURL().toURI()); } else { doc.setPage(e.getURL()); @@ -173,13 +178,13 @@ doc.setEditorKit(new HTMLEditorKit()); doc.addHyperlinkListener(createHyperLinkListener()); - </script> + ]]></script> <Table> <row fill='horizontal'> <cell columns='4' weighty="1" fill='both'> <JScrollPane height="200"> - <JEditorPane id="doc" /> - </JScrollPane> + <JEditorPane id="doc" /> + </JScrollPane> </cell> </row> <row fill='horizontal'> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterPanelUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterPanelUI.jaxx 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/filter/FilterPanelUI.jaxx 2011-06-14 17:43:37 UTC (rev 3393) @@ -23,18 +23,22 @@ #L% --> <JPanel> - <script> - import org.nuiton.widget.DatePicker; - import org.nuiton.widget.InvalidDateException; - - protected fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI dialog; +<import> + org.jdesktop.swingx.JXDatePicker + fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI + java.text.SimpleDateFormat + fr.ifremer.isisfish.ui.widget.filter.FilterParamModel + fr.ifremer.isisfish.ui.util.JaxxUtil + javax.swing.JTextField + javax.swing.JCheckBox +</import> +<script><![CDATA[ + protected FilterDialogUI dialog; - protected static java.text.SimpleDateFormat simpleDateFormat = - new java.text.SimpleDateFormat("dd/MM/yyyy"); + protected static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); - protected FilterPanelUI(fr.ifremer.isisfish.ui.widget.filter.FilterDialogUI dialog) { - this.dialog = dialog; - + protected FilterPanelUI(FilterDialogUI dialog) { + this.dialog = dialog; } /** @@ -48,41 +52,31 @@ public void doCheck() { if (dialog!=null) dialog.doCheck(); } - @SuppressWarnings({"unchecked"}) + public void doReset() { - fr.ifremer.isisfish.ui.util.JaxxUtil.doReset(get$objectMap()); + JaxxUtil.doReset(get$objectMap()); } protected void extractTextFieldParam(String paramKey) { JTextField field = (JTextField) getObjectById(paramKey); - fr.ifremer.isisfish.ui.widget.filter.FilterParamModel paramModel = dialog.getParamModel(paramKey); + FilterParamModel paramModel = dialog.getParamModel(paramKey); if (paramModel.canUse(field.getText())) paramModel.extractParam(field.getText()); } protected void extractCheckBoxParam(String paramKey) { JCheckBox field = (JCheckBox) getObjectById(paramKey); - fr.ifremer.isisfish.ui.widget.filter.FilterParamModel paramModel = dialog.getParamModel(paramKey); + FilterParamModel paramModel = dialog.getParamModel(paramKey); if (field.isSelected()) paramModel.extractParam("true"); } protected void extractDateInterval(String name, String paramKey, String paramKey2) { - DatePicker field = (DatePicker) getObjectById(paramKey); - DatePicker field2 = (DatePicker) getObjectById(paramKey2); - fr.ifremer.isisfish.ui.widget.filter.FilterParamModel paramModel = dialog.getParamModel(name); - if (paramModel.canUse(field.getText(), field2.getText())) { - java.util.Date d0,d1; - try { - d0 = field.getDate(); - } catch (InvalidDateException e) { - d0=null; - } - try { - d1 = field2.getDate(); - } catch (InvalidDateException e) { - d1=null; - } - paramModel.extractParam(d0==null?null:d0.getTime()+"",d1==null?null:d1.getTime()+""); - } + JXDatePicker field = (JXDatePicker) getObjectById(paramKey); + JXDatePicker field2 = (JXDatePicker) getObjectById(paramKey2); + FilterParamModel paramModel = dialog.getParamModel(name); + java.util.Date d0,d1; + d0 = field.getDate(); + d1 = field2.getDate(); + paramModel.extractParam(d0==null?null:d0.getTime()+"",d1==null?null:d1.getTime()+""); } - </script> + ]]></script> </JPanel> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -31,7 +31,9 @@ import java.lang.annotation.Target; /** - * ArgTypes.java + * Annotation utilisée pour specifier le type des parametres. + * + * Pour etre plus explicit que "List" en renseignant "List<Zone>" par exemple. * * Created: 4 juil. 2006 12:40:46 * Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Args.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Args.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/Args.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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 @@ -31,7 +31,8 @@ import java.lang.annotation.Target; /** - * Args.java + * Annotation pour specifier le nom des arguments car il est impossible + * de les avoir par introspection. * * Created: 4 juil. 2006 12:40:46 * Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, 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,27 +26,12 @@ package fr.ifremer.isisfish.util; import static org.nuiton.i18n.I18n._; -import info.monitorenter.cpdetector.io.ASCIIDetector; -import info.monitorenter.cpdetector.io.ByteOrderMarkDetector; -import info.monitorenter.cpdetector.io.CodepageDetectorProxy; -import info.monitorenter.cpdetector.io.JChardetFacade; -import info.monitorenter.cpdetector.io.ParsingDetector; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.Reader; -import java.io.Writer; import java.lang.reflect.Method; -import java.net.MalformedURLException; import java.net.URL; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -56,8 +41,8 @@ import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -88,7 +73,7 @@ private static final Log log = LogFactory.getLog(CompileHelper.class); /** CP detector proxy. */ - protected static CodepageDetectorProxy detector; + //protected static CodepageDetectorProxy detector; /** * Recherche tous les fichiers qui un source plus recent que la version compilé. @@ -113,8 +98,8 @@ * @param fqn le nom complet de la classe a charger * @return la classe souhaité ou null si la class n'est pas trouvée */ - public static Class loadClass(String fqn) { - Class result = null; + public static Class<?> loadClass(String fqn) { + Class<?> result = null; try { ClassLoader cl = IsisFish.config.getScriptClassLoader(); result = cl.loadClass(fqn); @@ -127,7 +112,7 @@ public static Object newInstance(String fqn) { Object result = null; try { - Class clazz = loadClass(fqn); + Class<?> clazz = loadClass(fqn); if (clazz != null) { result = clazz.newInstance(); @@ -222,10 +207,16 @@ protected static int compile(List<File> classpath, Collection<File> src, File dest, PrintWriter out) { dest.mkdirs(); - + int result = -1000; try { - JavaCompiler compiler = JavacTool.create(); + + // look for best available Java compiler (if none, use provided) + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + if (compiler == null) { + compiler = JavacTool.create(); + } + // Use system compiler // JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fileManager = compiler @@ -319,19 +310,19 @@ } /** - * Extract documentation from interface (Equation) + * Extract documentation from interface (Equation). + * * @param category * @param name * @param javaInterface * @return doc */ public static String extractDoc(String category, String name, - Class javaInterface) { - String content = ""; - content = "<p>Equation : " + Class<?> javaInterface) { + String content = "<p>Equation : " + createHREF(javaInterface.getName(), category) + " - " + name + "</p>"; - content += "<h3>Parameter: name and type</h3>"; + content += "<h3>" + _("isisfish.editor.parametersnameandtypes") + " :</h3>"; Method[] methods = javaInterface.getDeclaredMethods(); Method interfaceMethod = methods[0]; @@ -345,7 +336,7 @@ stringTypes = argTypes.value(); } else { stringTypes = new String[names.length]; - Class[] types = interfaceMethod.getParameterTypes(); + Class<?>[] types = interfaceMethod.getParameterTypes(); for (int i = 0; i < types.length; i++) { stringTypes[i] = types[i].getName(); } @@ -353,33 +344,39 @@ for (int i = 0; i < names.length; i++) { content += "<li>" + names[i] + " : " + createHREF(stringTypes[i]); - // if (i+1<names.length) { - // content += "\n"; - // } } - try { - FileUtil.writeString(new File("/tmp/testDoc.html"), content); - } catch (IOException eee) { - if (log.isWarnEnabled()) { - log.warn("TODO untreated error", eee); - } - } return content; } - private static String createHREF(String type, String... texts) { - String ref = IsisFish.config.getJavadocURL() - + type.replaceAll("\\.", "/") + ".html"; + /** + * Create a html link to isis javadoc. + * + * @param type class type + * @param texts link display text + * @return + */ + protected static String createHREF(String type, String... texts) { + + // si pas de text, on affiche le type String text = type; if (texts.length > 0) { text = texts[0]; } - String result = "<a href='" + ref + "'>" + text + "</a>"; + + String result = null; + if (type.startsWith("fr.ifremer.isisfish")) { + String ref = IsisFish.config.getJavadocURL() + type.replaceAll("\\.", "/") + ".html"; + result = "<a href='" + ref + "'>" + text + "</a>"; + } else { + // n'affiche pas de lien pour les types + // genre "double" qui ne sont pas dans la javadoc d'isisfish + result = text; + } return result; } - protected static CodepageDetectorProxy getCodepageDetector() { + /*protected static CodepageDetectorProxy getCodepageDetector() { if (detector == null) { detector = CodepageDetectorProxy.getInstance(); // A singleton. @@ -395,15 +392,14 @@ detector.add(ASCIIDetector.getInstance()); // Fallback, see javadoc. } return detector; - } - + }*/ - /** + /* * Convert all files to UTF-8. * * @param files fiels to convert * @return converted file list - */ + * public static List<File> convertToUnicode(List<File> files) { CodepageDetectorProxy myDetector = getCodepageDetector(); @@ -470,5 +466,5 @@ } return files; - } + }*/ } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHAgent.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHAgent.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHAgent.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -128,8 +128,7 @@ isValid = true; passphraseForKeys.put(privatekeyFile, passphrase); } else { - message = _( - "isisfish.ssh.askpassphrase.wrongpassphrase", + message = _("isisfish.ssh.askpassphrase.wrongpassphrase", privatekeyFile); } } while (!isValid); @@ -169,4 +168,4 @@ return String.valueOf(passwordField.getPassword()); } -} \ No newline at end of file +} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUserInfo.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUserInfo.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUserInfo.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -64,7 +64,7 @@ */ protected String passwd; - /** + /** * Password text field. */ protected JPasswordField passwordField = new JPasswordField(20); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -59,7 +59,7 @@ STATUS_NORMAL, STATUS_ADDED, STATUS_MODIFIED, - STATUS_DELETED, + STATUS_DELETED } /** Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, Code Lutin, Benjamin Poussin + * Copyright (C) 2002 - 2011 Ifremer, Code Lutin, Benjamin Poussin, 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 @@ -49,26 +49,29 @@ /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(VCSFactory.class); - private VCSFactory() {} + protected static final Properties TYPE_ALIASES = new Properties(); + static { + TYPE_ALIASES.setProperty("", VCSNone.class.getName()); + TYPE_ALIASES.setProperty(VCS.TYPE_NONE, VCSNone.class.getName()); + TYPE_ALIASES.setProperty(VCS.TYPE_SVN, VCSSVN.class.getName()); + } + + private VCSFactory() { + + } + /** - * VCSNone factory, looking for vcs.type key in config to find vcs class to used. + * VCS factory, looking for vcs.type key in config to find vcs class to used. * If no vcs.type found or is not valid class, use {@link VCSNone}. * - * @param config - * @return usable VCSNone + * @param config config + * @return usable VCS */ static public VCS createVCS(IsisConfig config) { - Properties aliases = new Properties(); - // for empty and TYPE_NONE we used this class - aliases.setProperty("", VCSNone.class.getName()); - aliases.setProperty(VCS.TYPE_NONE, VCSNone.class.getName()); - aliases.setProperty(VCS.TYPE_SVN, VCSSVN.class.getName()); - - VCS result = null; String type = config.getOption(VCS.VCS_TYPE); // try to convert if type is not class name but an alias - String classname = aliases.getProperty(type, type); + String classname = TYPE_ALIASES.getProperty(type, type); File dataDir = config.getDatabaseDirectory(); String protocol = config.getOption(VCS.VCS_PROTOCOL); @@ -78,13 +81,56 @@ String login = config.getOption(VCS.VCS_USER_NAME); String password = config.getOption(VCS.VCS_USER_PASSWORD); + VCS result = makeVCSInstance(classname, dataDir, protocol, host, path, sshKeyFile, login, password); + return result; + } + + /** + * Create VCS to manage community VCS repository. + * + * @param config config + * @return usable VCS + */ + static public VCS createPublicVCS(IsisConfig config) { + String type = config.getOption(IsisConfig.Option.VCS_COMMUNITY_TYPE.key); + // try to convert if type is not class name but an alias + String classname = TYPE_ALIASES.getProperty(type, type); + + File dataDir = config.getCommunityDatabaseDirectory(); + String protocol = config.getOption(IsisConfig.Option.VCS_COMMUNITY_PROTOCOL.key); + String host = config.getOption(IsisConfig.Option.VCS_COMMUNITY_HOST_NAME.key); + String path = config.getOption(IsisConfig.Option.VCS_COMMUNITY_PATH.key); + File sshKeyFile = config.getSSHPrivateKeyFilePath(); + String login = config.getOption(IsisConfig.Option.VCS_COMMUNITY_USER_NAME.key); + String password = config.getOption(IsisConfig.Option.VCS_COMMUNITY_PASSWORD.key); + + VCS result = makeVCSInstance(classname, dataDir, protocol, host, path, sshKeyFile, login, password); + return result; + } + + /** + * Make CSV instance. + * + * @param classname class name + * @param dataDir root data dir + * @param protocol protocol + * @param host host + * @param path path + * @param sshKeyFile ssh key file + * @param login login + * @param password password + * @return CSV instance + */ + static protected VCS makeVCSInstance(String classname, File dataDir, String protocol, + String host, String path, File sshKeyFile, String login, String password) { + VCS result = null; try { - Class<?> clazz = (Class<?>) ConvertUtils.convert(classname, Class.class); + Class clazz = (Class) ConvertUtils.convert(classname, Class.class); result = (VCS) ConstructorUtils.invokeConstructor(clazz, new Object[]{dataDir, protocol, host, path, sshKeyFile, login, password}); } catch (Exception eee) { if (log.isErrorEnabled()) { - log.error(_("isisfish.vcs.factory.cantinstanciate", type), eee); + log.error(_("isisfish.vcs.factory.cantinstanciate", classname), eee); } result = new VCSNone(dataDir, protocol, host, path, sshKeyFile, login, password); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2008 - 2010 Ifremer, CodeLutin + * Copyright (C) 2008 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -168,7 +168,7 @@ passphrase = SSHAgent.getAgent().getPassphrase(sshKeyFile); } catch(InvalidPassphraseException e) { - if(log.isWarnEnabled()) { + if (log.isWarnEnabled()) { log.warn("Can't get passphrase for key", e); } } @@ -283,8 +283,7 @@ || !url.getHost().equals(newUrl.getHost())) { if (fireAction(VCSActionEvent.SWITCH_PROTOCOL)) { if (log.isInfoEnabled()) { - log.info(_( - "isisfish.vcs.vcssvn.checkProtocol.relocate", + log.info(_("isisfish.vcs.vcssvn.checkProtocol.relocate", localRoot, url, newUrl)); } @@ -314,8 +313,11 @@ @Override public List<File> checkFileStatus() throws VCSException { List<File> fileInConflict = null; - + Map<File, SVNStatus> status = getRemoteStatus(null, true); + // add local missing files + status.putAll(getLocalStatus(null, true, SVNStatusType.STATUS_MISSING)); + // si des fichiers ont ete mis a jour sur le serveur on se synchronise if (status.size() > 0) { if (fireAction(VCSActionEvent.UPDATE_REPOSITORY, status.keySet() @@ -522,10 +524,6 @@ File destDir = getLocalRepository(); destDir.mkdirs(); - // getSVNManager().getUpdateClient().doCheckout(source, destDir, null, - // SVNRevision.HEAD, recurse); - - // since svnkit 1.2 SVNUpdateClient updateClient = getSVNManager() .getUpdateClient(); long newRevision = updateClient.doCheckout(source, // SVNURL url @@ -625,13 +623,11 @@ if ((acceptedStatusType.isEmpty() && status.getContentsStatus() != SVNStatusType.STATUS_NONE && status .getContentsStatus() != SVNStatusType.STATUS_NORMAL) - || acceptedStatusType.contains(status - .getContentsStatus())) { + || acceptedStatusType.contains(status.getContentsStatus())) { File statusFile = status.getFile(); - if (statusFile.exists() - && (!statusFile.isDirectory() - || status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED || status - .getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED)) { + if (!statusFile.isDirectory() || + status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED || + status.getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { // on ne met pas les repertoires pere dans le status // car en fait ca veut dire qu'un fichier/rep dans ce // repertoire a ete ajout/modifier/delete, et on l'aura @@ -641,12 +637,6 @@ } } }; - // getSVNManager().getStatusClient().doStatus(file, - // recurse, - // false, // on remote - // !acceptedStatusType.contains(SVNStatusType.STATUS_NORMAL), // report only change file, - // acceptedStatusType.contains(SVNStatusType.STATUS_IGNORED), // includeIgnored, - // handler); SVNStatusClient statusClient = getSVNManager().getStatusClient(); statusClient.doStatus(localFile, // File @@ -667,14 +657,20 @@ } /** + * Retourne la liste des fichiers qui ont été mis à jour sur le serveur. + * + * Le status des fichiers retourné est : + * <ul> + * <li>SVNStatusType.STATUS_ADDED (remote) pour ajout local + * <li>SVNStatusType.STATUS_DELETED (remote) pour suppression locale + * </ul> + * * @param file * @param recurse - * @param wanted * @return remote status * @throws VCSException */ - protected Map<File, SVNStatus> getRemoteStatus(File file, boolean recurse, - SVNStatusType... wanted) throws VCSException { + protected Map<File, SVNStatus> getRemoteStatus(File file, boolean recurse) throws VCSException { try { File localFile = file; @@ -683,21 +679,21 @@ } final Map<File, SVNStatus> result = new HashMap<File, SVNStatus>(); - final Set<SVNStatusType> acceptedStatusType = new HashSet<SVNStatusType>( - Arrays.asList(wanted)); ISVNStatusHandler handler = new ISVNStatusHandler() { public void handleStatus(SVNStatus status) throws SVNException { - if ((acceptedStatusType.size() == 0 - && status.getRemoteContentsStatus() != SVNStatusType.STATUS_NONE && status - .getRemoteContentsStatus() != SVNStatusType.STATUS_NORMAL) - || acceptedStatusType.contains(status - .getRemoteContentsStatus())) { + if (log.isDebugEnabled()) { + log.debug("Status on file " + status.getFile() + " rstatus:" + + status.getRemoteContentsStatus() + " lstatus:" + status.getContentsStatus()); + } + + if (!status.getRemoteContentsStatus().equals(SVNStatusType.STATUS_NONE) && + !status.getRemoteContentsStatus().equals(SVNStatusType.STATUS_NORMAL)) { File statusFile = status.getFile(); - if (!statusFile.isDirectory() - || status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED - || status.getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { - // on ne met pas les repertoires pere dans le status + if (!statusFile.isDirectory() || + status.getRemoteContentsStatus().equals(SVNStatusType.STATUS_ADDED) || + status.getRemoteContentsStatus().equals(SVNStatusType.STATUS_DELETED)) { + // on ne met pas les repertoires pere dans le status // car en fait ca veut dire qu'un fichier/rep dans ce // repertoire a ete ajout/modifier/delete, et on l'aura // aussi dans les resultats et ca suffit @@ -707,20 +703,13 @@ } }; - // getSVNManager().getStatusClient().doStatus(localFile, - // recurse, - // true, // on remote - // !acceptedStatusType.contains(SVNStatusType.STATUS_NORMAL), // report only change file, - // acceptedStatusType.contains(SVNStatusType.STATUS_IGNORED), // includeIgnored, - // handler); - SVNStatusClient statusClient = getSVNManager().getStatusClient(); statusClient.doStatus(localFile, // File path, SVNRevision.HEAD, // SVNRevision revision, SVNDepth.INFINITY, // SVNDepth depth, true, // boolean remote, - !acceptedStatusType.contains(SVNStatusType.STATUS_NORMAL), // boolean reportAll, - acceptedStatusType.contains(SVNStatusType.STATUS_IGNORED), // boolean includeIgnored, + true, // boolean reportAll, + false, // boolean includeIgnored, true, // boolean collectParentExternals, handler, // ISVNStatusHandler handler, null); // Collection changeLists @@ -1072,8 +1061,6 @@ update(localFile.getParentFile(), false); } - //getSVNManager().getUpdateClient().doUpdate(file, SVNRevision.HEAD, recurse); - SVNUpdateClient updateClient = getSVNManager() .getUpdateClient(); long newRevision = updateClient.doUpdate(localFile, // File file @@ -1094,8 +1081,6 @@ result.addAll(status.keySet()); // on supprime les conflits pour pouvoir commiter convenablement // les fichiers - //getSVNManager().getWCClient().doResolve(localFile, recurse); - // FIXME use conflit resolution choice ? SVNWCClient wcClient = getSVNManager().getWCClient(); wcClient.doResolve(localFile, // File file @@ -1213,10 +1198,7 @@ log.info(_("isisfish.vcs.vcssvn.settag.switchfromto", currentTag, tag)); } - //getSVNManager().getUpdateClient().doSwitch( - // localRoot, newUrl, SVNRevision.HEAD, true); - // svnkit 1.2 code SVNUpdateClient updateClient = getSVNManager() .getUpdateClient(); long newRevision = updateClient.doSwitch(localRoot, // File path @@ -1244,7 +1226,6 @@ filesInConflict.addAll(status.keySet()); // on supprime les conflits pour pouvoir commiter convenablement // les fichiers - //getSVNManager().getWCClient().doResolve(localFile, recurse); // FIXME use conflit resolution choice ? SVNWCClient wcClient = getSVNManager().getWCClient(); Deleted: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,1118 +0,0 @@ -Add\ to\ default\ queue= -Analyse\ plan\ error,\ too\ many\ simulation\ for\ %s\ \:\ %s= -Can't\ add\ result\ '%1$s'\ at\ date\ %2$s=Can't add result '%1$s' at date %2$s -Can't\ add\ simulation\:\ %s= -Can't\ create\ simulation\ logger=Can't create simulation logger -Can't\ delete\ simulation= -Can't\ delete\ simulation\ %s\ = -Can't\ display\ simulation\ log= -Can't\ do\ post\ action\ %s= -Can't\ do\ simulation\ %s= -Can't\ download\ archive\ \:\ %s= -Can't\ download\ file= -Can't\ evaluate\ simulation\ prescript= -Can't\ export\ simulation\ %s= -Can't\ get\ changlog= -Can't\ get\ result\:\ %1$s=Can't get result\: %1$s -Can't\ instanciate\ export\ %1$s=Can't instanciate export %1$s -Can't\ instantiate\ %s= -Can't\ open\ log\ for\ %s= -Can't\ open\ simulation\ internal\ frame= -Can't\ read\ ssh\ key\ \:\ %s= -Can't\ simulate\ %s= -Check\ state\ of\ local\ repository\:\ %s= -Command\ '%s'\ fail\ to\ execute= -Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s= -Error\ during\ vcs\ initialisation= -Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys= -Generate\ next\ simulation= -Import\ one\ java\ file\ script\ source= -Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s= -Import\ zipped\ file\ containing\ all\ scripts\ directory\ structure= -Info=Info -Jobs\ submited\ is\ not\ ItemSimulation\ but\ was\ %s= -Last\ entry\ was\ %s\ extract\ name\ %s= -Launcher\ %s\ will\ be\ stopped\ because\ there\ are\ too\ many\ error\ (%s)= -Local\ repository\ don't\ exist= -Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s= -Normal\ stop\ thread,\ this\ is\ not\ an\ error= -Not\ start\ simulation\ %s\ because\ user\ ask\ stop= -Process\ template\ error= -Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import= -Region\ %s\ already\ inited= -Remote\ control\ file\ doesn't\ exists\ %s= -Remote\ information\ file\ doesn't\ exists\ %s= -Rename\ data\ directory\ to\ %s= -Show\ help= -Show\ version= -SimulationExecutor\ started\ with\ %s\ thread\ for\ %s= -Skip\ data\ migration\ (disabled)= -Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to= -Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s= -SubProcess\ start\:\ %s\ %s= -Switch\ repository\ type\ to\ none= -Try\ to\ log\ on\ %s@%s\:%d= -Use\ branches,\ switch\ not\ needed= -User\ restart\ simulation\ %s= -User\ stop\ simulation\ %s= -could\ not\ close\ reader\ %1$s=could not close reader %1$s -could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s -could\ not\ filter\ on\ simulations=could not filter on simulations -could\ not\ found\ %s= -could\ not\ found\ log\ file\ %1$s=could not found log file %1$s -could\ not\ found\ region\ %s= -could\ not\ found\ simulation\ %s= -could\ not\ read\ at\ offset\ %1$s\ for\ reason\ %2$s=could not read at offset %1$s for reason %2$s -destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= -destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= -directory\ %s\ must\ be\ a\ directory= -filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. -isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2010.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Please, report any bug you can found.<html> -isisfish.about.licensetext=You can modify and redistribute the program under the conditions of the GNU General Public License (version 2 or later). A copy of the GPL is in the file "LICENSE.txt" provided with Isis-Fish. All rights reserved. No guarantees are provided for use of this program. -isisfish.about.title=About Isis-Fish... -isisfish.advancedParameters.title=Advanced parameters -isisfish.advancedParams.freeParameters=Free parameters -isisfish.advancedParams.libLevelLogger=Library log level -isisfish.advancedParams.scriptLevelLogger=Script log level -isisfish.advancedParams.simulLevelLogger=Simulator log level -isisfish.advancedParams.simulationCache=Simulation cache -isisfish.advancedParams.simulationStatistique=Simulation statistics -isisfish.advancedParams.simulatorUse=Simulator to Use -isisfish.cell.comments=Comments -isisfish.cell.land=Land -isisfish.cell.latitude=Latitude -isisfish.cell.longitude=Longitude -isisfish.cell.name=Name -isisfish.change.equation=Can't change equation -isisfish.commit.message=Enter commit message -isisfish.common.add=Add -isisfish.common.add.short=add -isisfish.common.alert=alert -isisfish.common.apply=Apply -isisfish.common.blank=\ -isisfish.common.cancel=Cancel -isisfish.common.check=Check -isisfish.common.clear=Clear -isisfish.common.confirm=Confirm -isisfish.common.date=Date -isisfish.common.debug=debug -isisfish.common.delete=Delete -isisfish.common.duration.inhours=in hours -isisfish.common.ellipsis=... -isisfish.common.emigration=Emigration -isisfish.common.equation=Equation -isisfish.common.error=error -isisfish.common.file=File -isisfish.common.finish=Finish -isisfish.common.gear=Gear -isisfish.common.immigration=immigration -isisfish.common.info=info -isisfish.common.migration=migration -isisfish.common.module=Module -isisfish.common.month=month %1$s -isisfish.common.name=Name -isisfish.common.new=New -isisfish.common.newMatrix=New matrix -isisfish.common.next=Next -isisfish.common.ok=Ok -isisfish.common.openEditor=Open editor -isisfish.common.population=Population -isisfish.common.populationGroup=Population group -isisfish.common.populations=Populations -isisfish.common.port=Port -isisfish.common.prev=Previous -isisfish.common.region=Region -isisfish.common.remove=Remove -isisfish.common.reset=Reset -isisfish.common.rules=Rules -isisfish.common.save=Save -isisfish.common.saveModel=Save as model -isisfish.common.saveNextSimulation=Save for next simulation -isisfish.common.season=Season -isisfish.common.setOfVessels=Set of vessels -isisfish.common.simulate=Simulate -isisfish.common.strategies=Strategies -isisfish.common.sum=Sum -isisfish.common.tag=Tag -isisfish.common.tripType=Trip type -isisfish.common.valid=Valid -isisfish.common.value=Value -isisfish.common.warn=warn -isisfish.common.year=year -isisfish.common.zone=Zone -isisfish.config.category.main=Main -isisfish.config.category.main.description=Main configuration -isisfish.config.category.misc=Misc -isisfish.config.category.misc.description=Miscealenous -isisfish.config.category.versioning=VCS -isisfish.config.category.versioning.description=Versioning system -isisfish.config.database.lockmode.description=Database lock mode -isisfish.config.main.compileDirectory.description=Script compilation directory -isisfish.config.main.configFileName.description=Configuration filename -isisfish.config.main.defaultBackupDirectory.description=Backup directory -isisfish.config.main.defaultExportNames.description=Exports to do after simulation -isisfish.config.main.defaultMapFile.description=Default map file to use for map without custom maps -isisfish.config.main.defaultResultNames.description=Result names to manage during a simulation -isisfish.config.main.defaultSimulator.description=Default simulator to use to simulate -isisfish.config.main.defaultTagValue.description= -isisfish.config.main.encoding.description=encoding used on system -isisfish.config.main.javadocDirectory.description=Javadoc generation directory -isisfish.config.main.javadocURL.description=Javadoc url -isisfish.config.main.launchUI.description=Display user interface -isisfish.config.main.localSimulator.description=Local simulator launcher name (same process) -isisfish.config.main.locale.description=user locale -isisfish.config.main.monitoringDirectory.description=Folder containing all necessary information needed to restart simulation -isisfish.config.main.performcron.description=Perform all task registered in cron service -isisfish.config.main.performmigration.description=Perform data migration -isisfish.config.main.performvcsupdate.description=Perform vcs update -isisfish.config.main.remoteCaparmor.description=Remote simulator launcher name -isisfish.config.main.simulation.ssh.control.check.interval=Control check interval (seconds) -isisfish.config.main.simulation.ssh.control.check.interval.description=Control check interval (seconds) -isisfish.config.main.simulation.ssh.datapath=Isis-Fish database -isisfish.config.main.simulation.ssh.datapath.description=Isis-Fish database path -isisfish.config.main.simulation.ssh.isis.home=Isis-Fish home -isisfish.config.main.simulation.ssh.isis.home.description=Isis-Fish installation directory -isisfish.config.main.simulation.ssh.javapath=Java path -isisfish.config.main.simulation.ssh.javapath.description=Java location on remote server (full path or relative to $PATH, by default value is caparmor configuration) -isisfish.config.main.simulation.ssh.max.threads=SSH threads count -isisfish.config.main.simulation.ssh.max.threads.description=Number of simultaneous simulations to do through SSH. Might only be usefull for dependent analysis plans. Otherwise keep value at '1'. -isisfish.config.main.simulation.ssh.pbsbinpath=PBS executables directory -isisfish.config.main.simulation.ssh.pbsbinpath.description=PBS executables (qsub, qdel...) directory -isisfish.config.main.simulation.ssh.pbsqsuboptions=Qsub arguments -isisfish.config.main.simulation.ssh.pbsqsuboptions.description=Arguments used at qsub job sumbit. Default to '-m n' don't send mail. -isisfish.config.main.simulation.ssh.server=Simulation server -isisfish.config.main.simulation.ssh.server.description=Simulation server address -isisfish.config.main.simulation.ssh.sftpserver.description=Transfer server address (set empty to use scp from simulation server) -isisfish.config.main.simulation.ssh.tmppath=Server temp directory -isisfish.config.main.simulation.ssh.tmppath.description=Server temp directory -isisfish.config.main.simulation.ssh.userhome=User home directory -isisfish.config.main.simulation.ssh.userhome.description=User home directory -isisfish.config.main.simulation.ssh.username=SSH identifier -isisfish.config.main.simulation.ssh.username.description=SSH identifier -isisfish.config.main.simulationShowOnlyError.description= -isisfish.config.main.smtpServer.description=Smtp server address -isisfish.config.main.subSimulator.description=Sub process simulator launcher name -isisfish.config.main.userMail.description=User email address -isisfish.config.main.userName.description=User name -isisfish.config.ssh.key.file=SSH key -isisfish.config.ssh.key.file.description=Private SSH key path -isisfish.config.vcs.hostName.description= -isisfish.config.vcs.localDatabasePath.description= -isisfish.config.vcs.noPassPhrase.description= -isisfish.config.vcs.passphrase.description= -isisfish.config.vcs.remotePath.description= -isisfish.config.vcs.type.description= -isisfish.config.vcs.useSshConnexion.description= -isisfish.config.vcs.userName.description= -isisfish.config.vcs.userPassword.description= -isisfish.dataResult.export.csv=Export to CSV -isisfish.dataResult.label=Value -isisfish.date.toString=%1$s %2$s -isisfish.effortDescription.crewFoodCost=Crew food cost -isisfish.effortDescription.crewShareRate=Crew share rate -isisfish.effortDescription.crewSize=Crew size -isisfish.effortDescription.economicTitle=\u00C9conomiques parameters -isisfish.effortDescription.effortTitle=Fishing effort parameters -isisfish.effortDescription.fishingOperation=Fishing operation -isisfish.effortDescription.fishingOperationDuration=Fishing operation duration -isisfish.effortDescription.fishingOperationDuration.tooltip=In hours -isisfish.effortDescription.fixedCrewSalary=Fixed crew salary -isisfish.effortDescription.gearsNumberPerOperation=Gears number per operation -isisfish.effortDescription.landingCosts=Landing costs -isisfish.effortDescription.otherRunningCost=Other running cost -isisfish.effortDescription.parametersTitle=M\u00E9tiers parameters -isisfish.effortDescription.repairAndMaintenanceGearCost=Repair and maintenance gear cost -isisfish.effortDescription.title=Practiced metier -isisfish.effortDescription.toString=EffortDescription for %1$s with %2$s -isisfish.effortDescription.unitCostOfFishing=Fishing unit cost -isisfish.equation.editor.title=Equation Editor -isisfish.error.acceptable.population=New value isn't acceptable value for this population -isisfish.error.add.card=Error while adding of result to the map. -isisfish.error.add.logger.simulation=isisfish.error.add.logger.simulation -isisfish.error.add.result.data=Error while adding result ot data. -isisfish.error.add.result.graph=Error while adding result to graph -isisfish.error.add.tray=Can't add system tray icon -isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s -isisfish.error.change.equation=Can't change equation -isisfish.error.compile.fileerror=File %s can't be compiled \! -isisfish.error.compile.script=Can't compile script\: %1$s -isisfish.error.compiled.parameter=Can't get rule parameter from compiled class -isisfish.error.conversion.data=Erreur lors de la conversion du fichier de donn\u00E9es -isisfish.error.create.equation=Can't create equation -isisfish.error.delete.database=Can't delete database -isisfish.error.delete.file=could not delete file %1$s -isisfish.error.delete.vcs.files=Can't delete vcs files -isisfish.error.during.simulation=Error during simulation -isisfish.error.emigration.negative=emigration negative -isisfish.error.empty.code.rubbin=rubbin's code is empty -isisfish.error.empty.emigration=emigration empty -isisfish.error.empty.id.geographic=goegraphic identifier is empty -isisfish.error.empty.immigration=immigration empty -isisfish.error.empty.migration=Migration empty -isisfish.error.empty.name=The name is empty -isisfish.error.empty.params.name=Parameter name is empty -isisfish.error.empty.population=Population is empty -isisfish.error.empty.scientific.name=scentific name is empty -isisfish.error.empty.season=info season empty -isisfish.error.empty.selectivity=selectivity is empty -isisfish.error.empty.species=specie capturable empty -isisfish.error.empty.species.name=specie's name is empty -isisfish.error.empty.unit=measure unit is empty -isisfish.error.equation.openeditor=Can't open equation editor -isisfish.error.equation.return.number=EquationImpl must return a number\: %1$s -isisfish.error.equation.savemodel=Can't save equation as model -isisfish.error.errorpane.htmlmessage=<html><b>IsisFish has handled \:</b><br />%s</b></html> -isisfish.error.errorpane.title=Error -isisfish.error.evaluate.equation=Can't evaluate equation\: %1$s -isisfish.error.evaluate.preplan.script= -isisfish.error.evalute.plan.script=Can't evaluate plan script -isisfish.error.factor.invalid=Factor is not valid -isisfish.error.file.already.exists=The file %1$s already exist -isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population -isisfish.error.immigration.negative=immigration negative -isisfish.error.import.convertible=Erreur lors de l'import, la version du fichier que vous souhaitez importer n'est pas transformable en une version importable. -isisfish.error.import.file=Can't import file %1$s -isisfish.error.import.recent.files=Erreur lors de l'import, la version du fichier que vous souhaitez importer est plus r\u00E9cente que la version souhait\u00E9e. -isisfish.error.init.map=Can't init map. -isisfish.error.input.addentity=Can't add entity "%s" -isisfish.error.input.cancelentity=Can't cancel modification on entity -isisfish.error.input.createentity=Can't create entity -isisfish.error.input.removeentity=Can't remove entity "%s" -isisfish.error.input.save=Can't save modifications -isisfish.error.input.saveentity=Can't save entity -isisfish.error.input.spacializematrix= -isisfish.error.instanciate=Can't instanciate %1$s -isisfish.error.instanciate.export=Can't instanciate export %1$s -isisfish.error.invalid.costs.fix=les co\u00FBts fixes sont invalides -isisfish.error.invalid.distribution.recruitment=distribution de recrutement invalide -isisfish.error.invalid.equation=Invalid equation -isisfish.error.invalid.equation.name=Invalid equation name -isisfish.error.invalid.file.name=The script name %1$s is not valid. -isisfish.error.invalid.interval.reproduction.recruitment=interval entre la reproduction et le recrutement invalide -isisfish.error.invalid.mean.weight=Invalid mean weight -isisfish.error.invalid.natural.death=natural mortality on classes naissantes invalide -isisfish.error.invalid.nullequation=Equation %s doesn't exist \! -isisfish.error.invalid.number=The number is invalid -isisfish.error.invalid.range=La gamme possible n'a pas de valeur acceptable -isisfish.error.invalid.values.params=Parametre controlable hors valeurs possibles -isisfish.error.invalidate.natural.death=natural mortality invalid -isisfish.error.invoke.method=Can't invoke method '%1$s' for class %2$s -isisfish.error.linkageerror.message=Isis-Fish has detected a script use error.\nCompilation directory has been deleted to force recompilation.\n\nPlease, restart Isis-Fish. -isisfish.error.linkageerror.title=Init error -isisfish.error.load.class=Can't load class\: %1$s -isisfish.error.load.classloader=Can't create ClassLoader for script, bad directory\: %1$s for reason %2$s -isisfish.error.load.file=could not load file %1$s -isisfish.error.log.closeAppender=could not close appender %1$s for category %2$s -isisfish.error.log.console.dispose=Une erreur est survenue pendant la fermeture de la console %1$s de log, raison %2$s -isisfish.error.log.createAppender=could not create appender [%1$s] \: %2$s for reason %3$s -isisfish.error.log.foundAppender=\=could not found log appender %1$s for category %2$s -isisfish.error.matrix.more.2d=Matrice de plus de 2 dimensions\!\!\nS\u00E9lectionnez moins d'\u00E9l\u00E9ments ou utilisez l'op\u00E9rateur somme. -isisfish.error.migration.negative=Migration negative -isisfish.error.no.matrix=No matrix for \: %s -isisfish.error.no.null.time.step=Error, the time step should not be null -isisfish.error.no.sector=No sector defined -isisfish.error.no.select.simulation=Could not select simulation -isisfish.error.no.target.species=No target species in %1$s for %2$s -isisfish.error.not.found.code=Could not found codeclass for %1$s -isisfish.error.not.found.description=Could not found description for %1$s -isisfish.error.not.found.field=Could not found field %1$s doc for %2$s -isisfish.error.not.found.field.class=Could not found field %1$s for class %2$s -isisfish.error.not.null.class.grown=Null value for grown class -isisfish.error.not.null.mean.weight=Null mean weight -isisfish.error.not.null.natural.death=Null natural mortality -isisfish.error.not.possible.metier=Pas de m\u00E9tier possible -isisfish.error.not.support.class=this class does not support -isisfish.error.number.classes.upper.zero=Error, the number of classes must be upper than 0 -isisfish.error.out.memory=Out of memory try with more memory (option -mx) -isisfish.error.overlap.season=Cette saison chevauche une autre saison -isisfish.error.parse.date=Can't parse date %1$s -isisfish.error.parse.long=Can't parse long %1$s -isisfish.error.plan.parameter=Can't get plan parameter from compiled class -isisfish.error.prepare.data=Can't prepare data -isisfish.error.prepare.information.simulation=Can't prepare information for simulation -isisfish.error.read.simulation=Can't read simulation information %1$s -isisfish.error.read.simulation.parameters=Can't read simulation parameters from file %1$s -isisfish.error.region.addmap=Can't add map in region -isisfish.error.region.already.exists=This region already exists -isisfish.error.region.cancel= -isisfish.error.region.check=Can't check region -isisfish.error.region.commit=Can't commit region -isisfish.error.region.copy=Can't copy region -isisfish.error.region.create=Can't create new region -isisfish.error.region.export=Can't export region -isisfish.error.region.import=Can't import region -isisfish.error.region.load=Can't load region -isisfish.error.region.name.empty=Region name is empty -isisfish.error.region.new= -isisfish.error.region.remove=Can't remove region -isisfish.error.region.removemap=Can't remove map in region -isisfish.error.region.save=Can't save modification on region -isisfish.error.remove.directory=Can't remove directory %1$s -isisfish.error.rename.region=Can't rename region to %1$s -isisfish.error.save.checkSum.compilation=Can't save checkSum to compilation\: %1$s -isisfish.error.save.script.compilation=Can't save script to compilation\: %1$s -isisfish.error.save.simulation.parameters=Can't save simulation parameters in file %1$s -isisfish.error.script.create=isisfish.error.script.create -isisfish.error.script.delete=Can't delete file %1$s for reason %2$s -isisfish.error.script.import=Can't import file for reason %1$s -isisfish.error.script.load=Can't load file %1$s for reason %2$s -isisfish.error.script.save=Can't save file %1$s for reason %2$s -isisfish.error.sensitivity.export=Can't do region factors export -isisfish.error.simulation.addanalyseplan=Can't add analyze plan -isisfish.error.simulation.addrule=Can't add rule -isisfish.error.simulation.getparametervalue=Can't get parameter value -isisfish.error.simulation.getresultname=Can't get result names list -isisfish.error.simulation.importparameter=Can't import simulation parameters -isisfish.error.simulation.initsimulaction=Can't init simulation -isisfish.error.simulation.launchsimulation=Can't launch simulation -isisfish.error.simulation.listoldsimulation=Can't get old simulation list -isisfish.error.simulation.listpopulation=Can't get population list -isisfish.error.simulation.liststrategies=Can't get strategies list -isisfish.error.simulation.loadoldsimulation=Can't load old simulation -isisfish.error.simulation.log.openAppender=could not open appender of simulation %1$s for reason %2$s -isisfish.error.simulation.openregion=Can't open region -isisfish.error.simulation.remote.global=Can't launch a simulation on remote server -isisfish.error.simulation.remote.wrongportvalue=Connection port value is incorrect \: %s -isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s -isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s -isisfish.error.simulation.resultXml.write=Can't write simulation result XML for reason %1$s -isisfish.error.simulation.savesimulation=Can't save simulation parameters -isisfish.error.simulation.setparametervalue=Can't set parameter value -isisfish.error.source.parameter=Can't get parameter from source -isisfish.error.strategy.order=Strategy %1$s don't have 12 StrategyMonthInfo but %2$s. Recreate them -isisfish.error.undefined.classes=No classes defined -isisfish.error.undefined.correspondence.zones.reproduction.recruitment=pas de correspondance entre les zones de reproduction et les zones de recrutement -isisfish.error.undefined.gear=The engin is not defined -isisfish.error.undefined.mesh=No mesh defined -isisfish.error.undefined.mesh.sector=No mesh defined in sector -isisfish.error.undefined.meta.population=No population defined -isisfish.error.undefined.natural.death=No natural mortality on classes naissantes -isisfish.error.undefined.sector=No sector defined -isisfish.error.undefined.stategy=No strategy defined -isisfish.error.undefined.stategy.months=The strategy is not defined for some mounths -isisfish.error.undefined.zone.population=No population's zone defined -isisfish.error.undefined.zone.recruitment=No recrutment's zone defined -isisfish.error.undefined.zone.reproduction=No reprodution's zone defined -isisfish.error.unsupported.equation.langage=Unsupported language '%1$s' for equation\: %2$s -isisfish.error.wait.simThread=Can't wait SimThread -isisfish.error.warning.title=Warning -isisfish.error.write.simulation=Can't write information %1$s -isisfish.export.saved=Export saved -isisfish.export.title=Results export -isisfish.filter=Filter -isisfish.filter.apply=Apply filter -isisfish.filter.cancel=Cancel -isisfish.filter.log.levelDebug=Debug -isisfish.filter.log.levelError=Error -isisfish.filter.log.levelFatal=Fatal -isisfish.filter.log.levelInfo=Info -isisfish.filter.log.levelTrace=Trace -isisfish.filter.log.levelWarn=Warn -isisfish.filter.log.tooltip.levelDebug=Debug -isisfish.filter.log.tooltip.levelError=Error -isisfish.filter.log.tooltip.levelFatal=Fatal -isisfish.filter.log.tooltip.levelInfo=Info -isisfish.filter.log.tooltip.levelTrace=Trace -isisfish.filter.log.tooltip.levelWarn=Warn -isisfish.filter.log.tooltip.message=Enter a term to search and press Enter -isisfish.filter.reset=Reset -isisfish.filter.result=Results -isisfish.filter.result.found=Results (%d/%d) -isisfish.filter.select=Select -isisfish.filter.select.simulation=Select a simulation -isisfish.filter.simulation=Filter simulations -isisfish.filter.simulation.analysePlanNumber=Analyse plan number -isisfish.filter.simulation.description=Description -isisfish.filter.simulation.local=Local -isisfish.filter.simulation.numberOfYear=Number of year -isisfish.filter.simulation.regionName=Region name -isisfish.filter.simulation.simulationEnd=Simulation end date (dd/MM/yyyy) -isisfish.filter.simulation.simulationName=Simulation name -isisfish.filter.simulation.simulationStart=Simulation start date (dd/MM/yyyy) -isisfish.filter.simulation.simulatorName=Simulator name -isisfish.filter.simulation.tooltip.analysePlanNumber=Filter on analyse number -isisfish.filter.simulation.tooltip.description=Filter on description (regex) -isisfish.filter.simulation.tooltip.local=Filter only local simulations -isisfish.filter.simulation.tooltip.numberOfYear=Filter on number of year (exact sequence) -isisfish.filter.simulation.tooltip.regionName=Filter on region name (regex) -isisfish.filter.simulation.tooltip.simulationEnd=Filter on region end date (format dd/MM/yyyy) -isisfish.filter.simulation.tooltip.simulationName=Filter on simulation name -isisfish.filter.simulation.tooltip.simulationStart=Filter on simulation start date (format dd/MM/yyyy) -isisfish.filter.simulation.tooltip.simulatorName=Filter on simulator name -isisfish.filter.simulation.tooltip.useAnalysePlan=Filter on simulations with analyse plan -isisfish.filter.simulation.tooltip.useOptimization=Filter on simulations with optimization -isisfish.filter.simulation.tooltip.usePreScript=Filter on simulations with pre-script -isisfish.filter.simulation.tooltip.useStatistic=Filter on simulations with statistic -isisfish.filter.simulation.useAnalysePlan=analyse plan -isisfish.filter.simulation.useOptimization=optimization -isisfish.filter.simulation.usePreScript=pre-script -isisfish.filter.simulation.useStatistic=statistic -isisfish.fisheryRegion.addMap=Add map -isisfish.fisheryRegion.area=Fishery area boundaries -isisfish.fisheryRegion.comments=Comments -isisfish.fisheryRegion.delMap=Delete map -isisfish.fisheryRegion.latitude=Lat. -isisfish.fisheryRegion.latitude.max=Lat. max. -isisfish.fisheryRegion.latitude.min=Lat. min. -isisfish.fisheryRegion.longitude=Long. -isisfish.fisheryRegion.longitude.max=Long. max. -isisfish.fisheryRegion.longitude.min=Long. min. -isisfish.fisheryRegion.name=Region name -isisfish.fisheryRegion.ofCells=of cells (option) -isisfish.fisheryRegion.selectFile=Select a file -isisfish.fisheryRegion.spatial=Spatial resolution -isisfish.gear.comments=Comments -isisfish.gear.effortUnit=Effort Unit -isisfish.gear.name=Name -isisfish.gear.rangeValues=Range of values -isisfish.gear.standardisationFactor=Standardisation factor -isisfish.gear.technicalParameter=Technical parameter -isisfish.gear.title=Gear -isisfish.graphBean.graph.render=Choose a graph render -isisfish.graphCombo.render.bar=Verticals bar rendering -isisfish.graphCombo.render.bar.3d=3D verticals bars rendering -isisfish.graphCombo.render.bar.stacked=Stacked verticals bars rendering -isisfish.graphCombo.render.line=Line rendering -isisfish.graphCombo.render.line.3d=3D line rendering -isisfish.graphCombo.render.min.max=Min/max rendering -isisfish.graphCombo.render.surface=Area rendering -isisfish.graphCombo.render.surface.stacked=Stacked area rendering -isisfish.infoItem.label=defaultToolTip-fr.ifremer.resultat.InfoItem.label -isisfish.infoItem.sum=Sum all elements -isisfish.infoItem.sum.year=Sum elements per year -isisfish.input.continueCells=Continue to cells -isisfish.input.continueGears=Continue to gears -isisfish.input.continueMetiers=Continue to metiers -isisfish.input.continuePopulations=Continue to populations -isisfish.input.continuePorts=Continue to ports -isisfish.input.continueSetOfVessels=Continue to set of vessels -isisfish.input.continueSpecies=Continue to species -isisfish.input.continueStrategies=Continue to strategies -isisfish.input.continueTripTypes=Continue to trip types -isisfish.input.continueVesselTypes=Continue to vessel types -isisfish.input.continueZones=Continue to zones -isisfish.input.map.copytoclicboard=Copy to clipboard -isisfish.input.menu.addRegion=Add region -isisfish.input.menu.commit=Commit change -isisfish.input.menu.copyRegion=Copy region -isisfish.input.menu.exportRegion=Export region -isisfish.input.menu.importRegion=Import region -isisfish.input.menu.importRegionSimulation=Import region from simulation -isisfish.input.menu.importRegionV2=Import region from v2 -isisfish.input.menu.importRenameRegion=Import region and rename -isisfish.input.menu.removeLocaly=Remove localy -isisfish.input.menu.removeLocalyRemotely=Remove localy and remotely -isisfish.input.menu.sensitivity=Mexico -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.sensitivity.export.cancel=Factor export canceled -isisfish.input.sensitivity.export.complete=Factor export complete -isisfish.input.sensitivity.export.running=Exporting factors... -isisfish.input.sensitivity.export.title=Export factors -isisfish.input.title=Fishery input -isisfish.input.tree.cells=Cells -isisfish.input.tree.gears=Gears -isisfish.input.tree.metiers=Metiers -isisfish.input.tree.populations=Populations -isisfish.input.tree.ports=Ports -isisfish.input.tree.setofvessels=Set of vessels -isisfish.input.tree.species=Species -isisfish.input.tree.strategies=Strategies -isisfish.input.tree.triptypes=Trip types -isisfish.input.tree.vesseltypes=Vessel types -isisfish.input.tree.zones=Zones -isisfish.launch.anonymous=read only -isisfish.launch.email=email -isisfish.launch.firstname=firstname -isisfish.launch.init.done=init done in %1$s. -isisfish.launch.lasstname=lasstname -isisfish.launch.server.authenticationMethod=server access -isisfish.launch.server.login=server login -isisfish.launch.server.ssh.confirm.passphrase=confirm passphrase -isisfish.launch.server.ssh.key.change=Change your ssh key -isisfish.launch.server.ssh.key.generate=Generate ssh key -isisfish.launch.server.ssh.no.passphrase=no passphrase -isisfish.launch.server.ssh.passphrase=passphrase -isisfish.launch.server.ssh.privateKeyFile=private ssh key -isisfish.launch.server.ssh.publicKeyFile=public ssh key -isisfish.launch.ssh=read-write (ssh) -isisfish.launch.stop=Stopping simulation... -isisfish.launching=after init done in %1$s. -isisfish.log.addAppender=add appender [%1$s] -isisfish.log.body=Message to add -isisfish.log.closeAppender=closing appender %1$s for category %2$s -isisfish.log.mail.failed=Can't send report by mail. Is your mail server up ? (I'm trying to contact the < %1$s > smtp server) -isisfish.log.mail.send=A report has been sent to %1$s -isisfish.log.mail.send.title=Send simulation %1$s by email -isisfish.log.mailTo=Destination adress -isisfish.log.removeAppender=remove appender [%1$s] -isisfish.log.restoreLogLevel=swap back level for logger %1$s from level %2$s to level %3$s -isisfish.log.sendAll=Send the complete simulation archive -isisfish.log.sendMail=Send by email -isisfish.log.simulation.name=IsisFish simulation %1$s -isisfish.log.swapLogLevel=swap level for logger %1$s from level %2$s to level%3$s -isisfish.log.tooltip.body=The message will be join to email -isisfish.log.tooltip.mailTo=Enter destination adress -isisfish.log.tooltip.sendAll=Send the complete simulation archive, or just the log file -isisfish.log.tooltip.sendMail=Click here to send the email with files -isisfish.message.add.objets.simulation=Add new objets simulation -isisfish.message.backup.database.finished=backup database finished -isisfish.message.backup.database.progress=backup database in progress -isisfish.message.cancel.finished=Cancel finished -isisfish.message.check.finished=Check finished -isisfish.message.checking.cell= -isisfish.message.choose.archive=choose archive file or directory -isisfish.message.commit.cancelled=commit cancelled -isisfish.message.commit.finished=commit finished -isisfish.message.commit.region.canceled=Commit region canceled -isisfish.message.commiting.region=Commiting region %1$s ... -isisfish.message.compilation.time=Compilation time %1$ss -isisfish.message.confirm.delete.object=Do you really want delete object %1$s -isisfish.message.confirm.remove.region=Do you really want to remove the region %1$s ? -isisfish.message.confirm.remove.script=Do you want to remove script '%1$s' ? -isisfish.message.copy.finished=Copy finished -isisfish.message.copy.region=Copy region -isisfish.message.creating.region=Creating region %1$s -isisfish.message.creation.finished=Creation finished -isisfish.message.delete.canceled=delete canceled -isisfish.message.delete.entities=Delete entities -isisfish.message.delete.entity=Delete entity -isisfish.message.delete.finished=delete finished -isisfish.message.delete.object=To delete object %1$s, all next object will be deleted\n\n -isisfish.message.directory.not.exists= -isisfish.message.evaluation.finished=evaluation finished -isisfish.message.export.done=export done -isisfish.message.export.zip=Export to zip file %1$s -isisfish.message.file.already.exists=File %s already exists, do you want overwrite it ? -isisfish.message.file.overwrite=File exists, do you want overwrite it ? -isisfish.message.import=Import %1$s -isisfish.message.import.equation.convert=Manual equation convertion -isisfish.message.import.finished=Import finished -isisfish.message.import.region.name=Enter name for imported region -isisfish.message.import.region.xml=XMLed Region -isisfish.message.import.region.zipped=Zipped Region -isisfish.message.import.scripts.file=Import scripts from a zipped archive -isisfish.message.import.scripts.file.cancelled=Import scripts cancelled -isisfish.message.import.scripts.file.done=Scripts imported -isisfish.message.import.scripts.zipped=Zipped script (*.zip) -isisfish.message.import.xml.v2.file=Import xml v2 file -isisfish.message.import.zip=Import zip file -isisfish.message.launchui.notlaunch=User interface not started -isisfish.message.load.finished=Load finished -isisfish.message.load.map=Try to load map file\: %1$s -isisfish.message.loading.old.simulation=Loading old simulation... -isisfish.message.loading.region=Loading region... -isisfish.message.name.imported.region=Enter name for imported region -isisfish.message.new.filename=Enter the name of the new file. (use only chars and _ and start with uppercase) -isisfish.message.new.formule.category=Select the equation model's category -isisfish.message.new.formule.title=New equation model -isisfish.message.new.region.name=Enter new region name -isisfish.message.old.simulation.loaded=Old simulation loaded -isisfish.message.page.modified=This page has been modified, do you want to save it ? -isisfish.message.presimulation.script.execution=Presimulation Script execution -isisfish.message.recruitment.number.month=Input the number of month of recruitment -isisfish.message.region.commited=Region commited -isisfish.message.region.loaded=Region loaded -isisfish.message.region.remove.canceled=Region remove canceled -isisfish.message.region.removed=Region removed -isisfish.message.remove.canceled=Remove canceled -isisfish.message.remove.finished=Remove finished -isisfish.message.removing.region=Removing region %1$s ... -isisfish.message.result.verif.region=R\u00E9sultat de la v\u00E9rification de la r\u00E9gion -isisfish.message.save.finished=Save finished -isisfish.message.saveModel.dialog=Input equation model name -isisfish.message.saveModel.finished=Save model finished -isisfish.message.script.commit=Enter commit message for modification on %s -isisfish.message.setting.cache.aspects=Setting Cache aspects -isisfish.message.setting.trace.aspects=Setting Trace aspects -isisfish.message.simulation.ended=Simulation ended -isisfish.message.simulation.execution=Simulation execution -isisfish.message.simulation.prepare=Preparing simulation -isisfish.message.tray.disabled=SystemTray disabled -isisfish.metier.comments=Comments -isisfish.metier.name=Name -isisfish.metier.rangeValues=Range of values -isisfish.metier.title=Metier -isisfish.metierMonitor.metiers=Metiers -isisfish.metierMonitor.strategies=Strategies -isisfish.metierSeasonInfo.toString=%1$s season %2$s-%3$s -isisfish.metierSeasonInfoSpecies.mainSpecies=Main species for the metier -isisfish.metierSeasonInfoSpecies.selectSeason=Select a season -isisfish.metierSeasonInfoSpecies.selectSpecies=Select a species -isisfish.metierSeasonInfoSpecies.species=Species -isisfish.metierSeasonInfoSpecies.targetFactor=Target factor -isisfish.metierSeasonInfoSpecies.title=Catchable species -isisfish.metierSeasonInfoZone.comments=Comments -isisfish.metierSeasonInfoZone.season=Season -isisfish.metierSeasonInfoZone.selectSeason=Select a season -isisfish.metierSeasonInfoZone.title=Seasons / Zones -isisfish.misc.databasemigration.question=La base de donn\u00E9e est en version \: %s.\n\nUne migration en version %s est n\u00E9c\u00E9ssaire.\nVoulez vous migrer la base de donn\u00E9es ? -isisfish.misc.databasemigration.title=Database migration -isisfish.misc.nuitonmigration=IsisFish has detected some code based on CodeLutin libraries in following user scripts.\nDo you want to migrate those script on new nuiton libraries ? -isisfish.monitor.title=Application Monitor -isisfish.month.april=april -isisfish.month.august=august -isisfish.month.december=december -isisfish.month.february=february -isisfish.month.january=january -isisfish.month.july=july -isisfish.month.june=june -isisfish.month.march=march -isisfish.month.may=may -isisfish.month.november=november -isisfish.month.october=october -isisfish.month.september=september -isisfish.params.changeLogLev=Change from level '%1$s' to level '%2$s' -isisfish.params.clearFilter=Clear filter -isisfish.params.description=Description -isisfish.params.filter=Filter -isisfish.params.lblLauncher=Simulation launcher -isisfish.params.loadOldSimulation=Load old simulation -isisfish.params.numberYear=Number of year -isisfish.params.populationNumbers=Population numbers input -isisfish.params.ruleParameters=Rule's parameters -isisfish.params.sensitivityName=Sensitivity name -isisfish.params.simulationName=Simulation name -isisfish.params.title=Parameters -isisfish.params.toString.fishery=P\u00EAcherie\: %1$s\n\n -isisfish.params.toString.lib.logger.level=Level of libraries' logger \: %1$s -isisfish.params.toString.number.years=Number of years\: %1$s\n\n -isisfish.params.toString.plan=Plan\: %1$s -isisfish.params.toString.plan.number=Analyse plan sequence number\: %1$s\n\n -isisfish.params.toString.populations=Populations \: -isisfish.params.toString.rule=Rule\: %1$s -isisfish.params.toString.script.logger.level=Level of scripts' logger \: %1$s -isisfish.params.toString.script.presimulation=Script de presimulation -isisfish.params.toString.simul.logger.level=Level of simulator's logger \: %1$s -isisfish.params.toString.simulation.done=Simulation done with \: %1$s -isisfish.params.toString.strategies=Strat\u00E9gies \: -isisfish.params.useAnalysePlan=Use simulation plan -isisfish.params.usePreSimulationScript=Use pre simulation script -isisfish.population.capturability=Capturability -isisfish.population.comments=Comments -isisfish.population.group=Group -isisfish.population.groups=Groups -isisfish.population.mappingZoneReproZoneRecru=MappingZoneReproZoneRecru -isisfish.population.matrixAbundance=Abundance matrix -isisfish.population.matrixAbundance1D=matrixAbundance1D -isisfish.population.recruitment=Recruitment -isisfish.population.reproduction=Reproduction -isisfish.population.season=Season -isisfish.population.zones=Zones -isisfish.populationBasics.confirmCreateGroups=Warning, running groups creation wizard will delete all existing groups and objects which depend on it.\nDo you want to re-create groups ? -isisfish.populationBasics.geographicID=Geographic identifier -isisfish.populationBasics.growth=Growth -isisfish.populationBasics.growthReverse=Reverse growth -isisfish.populationBasics.maturityGroup=Maturity group -isisfish.populationBasics.name=Name -isisfish.populationBasics.numberGroup=Number of group -isisfish.populationBasics.plusGroup=Plus group -isisfish.populationBasics.recreateClasses=Recreate classes -isisfish.populationBasics.title=Population input -isisfish.populationCapturability.comments=Comments -isisfish.populationCapturability.selectCoefficient=Select a coefficient per season and per class -isisfish.populationCapturability.title=Capturability input -isisfish.populationEquation.meanWeight=Mean weight -isisfish.populationEquation.naturalDeathRate=Natural death rate -isisfish.populationEquation.price=Price -isisfish.populationEquation.title=Equations input -isisfish.populationGroup.age=Age -isisfish.populationGroup.comments=Comments -isisfish.populationGroup.length=Length -isisfish.populationGroup.maximumLength=Maximum length -isisfish.populationGroup.meanWeigth=Mean Weigth -isisfish.populationGroup.minimumLength=Minimum length -isisfish.populationGroup.naturalDeathRate=Natural death rate -isisfish.populationGroup.price=Price -isisfish.populationGroup.reproductionRate=Reproduction rate -isisfish.populationGroup.title=Population group input -isisfish.populationGroup.toString=%1$s Group %2$s -isisfish.populationMigration.comments=Comments -isisfish.populationMigration.selectSeason=Select a season -isisfish.populationMigration.title=Migration -isisfish.populationMigration.useEquation=Use equation -isisfish.populationMigrationEmigration.coefficient=Coefficient -isisfish.populationMigrationEmigration.departureZone=Departure Zone -isisfish.populationMigrationEmigration.title=Population emigration -isisfish.populationMigrationImmigration.arrivalZone=Arrival Zone -isisfish.populationMigrationImmigration.coefficient=Coefficient -isisfish.populationMigrationImmigration.title=Population immigration -isisfish.populationMigrationMigration.arrivalZone=Arrival zone -isisfish.populationMigrationMigration.coefficient=Coefficient -isisfish.populationMigrationMigration.departureZone=Departure zone -isisfish.populationMigrationMigration.title=Population migration -isisfish.populationRecruitment.comments=Comments -isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Month gap between repro and recruitment -isisfish.populationRecruitment.recruitmentDistribution=Recruitment distribution -isisfish.populationRecruitment.reproductionEquation=Reproduction equation -isisfish.populationRecruitment.title=Recruitment input -isisfish.populationSeasonInfo.arrival=Arrival -isisfish.populationSeasonInfo.departure=Departure -isisfish.populationSeasonInfo.distributionSpawing=Distribution of spawing -isisfish.populationSeasonInfo.emigration=Emigration -isisfish.populationSeasonInfo.group=Group -isisfish.populationSeasonInfo.immigration=Immigration -isisfish.populationSeasonInfo.migration=Migration -isisfish.populationSeasonInfo.months=Months -isisfish.populationSeasonInfo.toString=%1$s season %2$s-%3$s -isisfish.populationSeasons.Reproduction=Reproduction -isisfish.populationSeasons.changeGroup=Change of group -isisfish.populationSeasons.comments=Comments -isisfish.populationSeasons.computeCoefficient=Calculate coefficient -isisfish.populationSeasons.distributionSpawning=Distribution of spawning -isisfish.populationSeasons.noSpacialized=Not spacialized -isisfish.populationSeasons.selectSeason=Select a season -isisfish.populationSeasons.showSpacialized=Show the spacialized -isisfish.populationSeasons.spacialized=Spacialized -isisfish.populationSeasons.spacialized.visualisation=Spacialized -isisfish.populationSeasons.title=Saisons -isisfish.populationZones.betweenSpawningRecruitmentAreas=Match between spawning and recruitment areas -isisfish.populationZones.selectPopulationAreas=Select the population areas -isisfish.populationZones.selectRecruitmentAreas=Select the recruitment areas -isisfish.populationZones.selectSpawningAreas=Select the spawning areas -isisfish.populationZones.title=Zones -isisfish.port.cell=Port cell -isisfish.port.comments=Comments -isisfish.port.name=Name -isisfish.preScript.backParameter=Back to parameter tab -isisfish.preScript.title=Pre simulation script -isisfish.queue.clearDone=Clear done jobs -isisfish.queue.id=Id -isisfish.queue.launcher=Simulation launcher -isisfish.queue.masterplan=Master plan -isisfish.queue.notstarted=Not started -isisfish.queue.plan=Plan -isisfish.queue.progression=Progress -isisfish.queue.restartSimulation=Restart -isisfish.queue.showLog=Show simulation log -isisfish.queue.simulationLaunch=Simulation queue launch -isisfish.queue.status=Status -isisfish.queue.stopSimulation=Stop simulation -isisfish.queue.title=Queue -isisfish.result.abundance=Abondance -isisfish.result.add=Add a result -isisfish.result.begin.simulation=Simulation start \: -isisfish.result.capture=Capture -isisfish.result.capture.metier=Capture by metier -isisfish.result.choose.simulation=Choose a Simulation -isisfish.result.datas=Datas -isisfish.result.dimension=Dimension -isisfish.result.end.simulation=Simuation end \: -isisfish.result.export=Export -isisfish.result.export.file=Export text file -isisfish.result.file=File -isisfish.result.graph=Graph -isisfish.result.map=Map -isisfish.result.new.window=Open a new window -isisfish.result.quit=Quitter -isisfish.result.reject.metier=Rejet par metier -isisfish.result.remove.simulation=Remove simulation -isisfish.result.show.simulation.log=Show logs -isisfish.result.statusBar=\ -isisfish.result.stress.metier=Effort par metier -isisfish.result.summary=Summary -isisfish.result.title=Results -isisfish.result.unload.metier=Debarquement par metier -isisfish.resultChoice.save=Results to save -isisfish.resultChoice.saved=Results saved -isisfish.resultChoice.title=Result choice -isisfish.script.check=Check -isisfish.script.check.tooltip=Check syntax of the current script -isisfish.script.commit=Commit -isisfish.script.commit.tooltip=Commit script to SVN server -isisfish.script.compilation.failed=%s -isisfish.script.compilation.ok=Compilation complete.\n---------------------\n\n%s -isisfish.script.copy=Copy -isisfish.script.copy.tooltip=Copy current selection (Ctrl-c) -isisfish.script.cut=Cut -isisfish.script.cut.tooltip=Cut current selection (Ctrl-x) -isisfish.script.evaluate=Evaluate -isisfish.script.evaluate.tooltip=Try to eval current script (must be have main() method) -isisfish.script.export=Export -isisfish.script.export.checkAll=(Un)Check all scripts -isisfish.script.export.chooseDir=... -isisfish.script.export.tooltip=Export selected script(s) to zip archive -isisfish.script.export.tooltip.checkAll=(Un)Check all scripts to export -isisfish.script.export.tooltip.chooseDir=Choose directory to export script to -isisfish.script.import=Import scripts from archive -isisfish.script.import.cancel=Cancel -isisfish.script.import.checkAll=(Un)Check all script to import -isisfish.script.import.import=Import -isisfish.script.import.labelAdd=Following files will be added. Confirm adding. -isisfish.script.import.labelOverwrite=Following files already exists. Confirm overridding. -isisfish.script.import.tooltip.checkAll=(Un)Check all scripts -isisfish.script.javadoc.ok=Javadoc generated-----------------\n\n%s -isisfish.script.menu.checkSyntax=Check syntax -isisfish.script.menu.code=Code -isisfish.script.menu.commit=Commit script to server -isisfish.script.menu.copy=Copy -isisfish.script.menu.cut=Cut -isisfish.script.menu.deleteLocaly=Delete localy -isisfish.script.menu.deleteLocalyServer=Delete localy and on server -isisfish.script.menu.diff=Display diff with server version -isisfish.script.menu.edit=Edit -isisfish.script.menu.evaluate=Evaluate -isisfish.script.menu.file=File -isisfish.script.menu.javadocgenerate=Generate script javadoc -isisfish.script.menu.javadocgenerated=Javadoc generated in %s -isisfish.script.menu.javadocgenerating=Generating javadoc in %s... -isisfish.script.menu.javadocshow=Show script javadoc -isisfish.script.menu.new=New -isisfish.script.menu.paste=Paste -isisfish.script.menu.save=Save -isisfish.script.menu.txtExport=Export -isisfish.script.menu.txtImport=Import -isisfish.script.menu.txtNewAnalysePlan=New analyse plan -isisfish.script.menu.txtNewEquationModel=New equation model -isisfish.script.menu.txtNewExport=New export -isisfish.script.menu.txtNewRule=New rule -isisfish.script.menu.txtNewScript=New script -isisfish.script.menu.txtNewSensitivity=New sensitivity calculator -isisfish.script.menu.txtNewSensitivityExport=New sensitivity export -isisfish.script.menu.txtNewSimulator=New simulator -isisfish.script.menu.txtVCS=Server -isisfish.script.menu.update=Update from server -isisfish.script.new=New -isisfish.script.new.tooltip=Create new script -isisfish.script.paste=Paste -isisfish.script.paste.tooltip=Paste current selection (Ctrl-v) -isisfish.script.save=Save -isisfish.script.save.tooltip=Save script -isisfish.script.title=Script Editor -isisfish.season.toString=season %1$s-%2$s -isisfish.selectivity.equation=Equation -isisfish.selectivity.selectPopulation=Select a population -isisfish.selectivity.title=Selectivity -isisfish.sens.backParameter=Back to parameter tab -isisfish.sens.title=Simulation plan -isisfish.sensitivity.coefficient=Coefficient (in %) -isisfish.sensitivity.comment=Comment -isisfish.sensitivity.continue=Continuous factor -isisfish.sensitivity.discret=Discret factor -isisfish.sensitivity.displaysecondpass=Display results -isisfish.sensitivity.equation.variable.action=Action -isisfish.sensitivity.equation.variable.coefficient=Coef. (in %) -isisfish.sensitivity.equation.variable.name=Name -isisfish.sensitivity.equation.variable.operator=Operator -isisfish.sensitivity.equation.variable.value=Value -isisfish.sensitivity.export=Export -isisfish.sensitivity.factor=Factor -isisfish.sensitivity.factors=Factors -isisfish.sensitivity.firstValue=First value -isisfish.sensitivity.increment=Cardinality -isisfish.sensitivity.lastValue=Last value -isisfish.sensitivity.name=Factor name -isisfish.sensitivity.operator=Operator -isisfish.sensitivity.secondpass=Analyze results -isisfish.sensitivity.secondpass.title=Analyze results -isisfish.sensitivity.select=Method -isisfish.sensitivity.selectDiscretNumber=Number of factors -isisfish.sensitivity.title=Sensitivity analysis -isisfish.sensitivity.validDiscretNumber=Ok -isisfish.sensitivity.value=Value -isisfish.sensitivityChooser.title=Sensitivities input -isisfish.server.ssh.generateKey.title=Generate Ssh key -isisfish.setOfVessels.comments=Comments -isisfish.setOfVessels.fixedCosts=Fixed costs -isisfish.setOfVessels.name=Name -isisfish.setOfVessels.numberOfVessels=Number of vessels -isisfish.setOfVessels.technicalEfficiency=Technical efficiency -isisfish.setOfVessels.title=Caracteristics -isisfish.setOfVessels.vesselType=Vessel type -isisfish.simpleResult.more.information=Click a cell for more information... -isisfish.simulation.log.console.title=Log console for simulation '%1$s' -isisfish.simulation.log.showConsole=Display log console for simulation %1$s -isisfish.simulation.menu.import=Restore simulation parameters -isisfish.simulation.menu.save=Save simulation parameters -isisfish.simulation.menu.simulation=Simulation -isisfish.simulation.name=Simulation name -isisfish.simulation.remote.message.connection=Connecting to Caparmor -isisfish.simulation.remote.message.deletingfiles=Deleting simulation files -isisfish.simulation.remote.message.downloadresults=Downloading results -isisfish.simulation.remote.message.upload=Uploading simulation -isisfish.simulation.remote.message.waitingstart=Waiting for simulation start -isisfish.simulation.restarting=Restarting... -isisfish.simulation.title=Simulation launcher -isisfish.simulator.launcher.inprocess=in current process -isisfish.simulator.launcher.remote=on Caparmor server -isisfish.simulator.launcher.subprocess=in subprocess -isisfish.simulator.simulaction.badid=Can't start simulation, bad id\: %s -isisfish.simulator.ssh.configuration.connecting=Connection... -isisfish.simulator.ssh.configuration.connectingpk=Connection with public key... -isisfish.simulator.ssh.configuration.connection=Connection information -isisfish.simulator.ssh.configuration.connectionerror=Can't connect -isisfish.simulator.ssh.configuration.connectionok=Connection successfull -isisfish.simulator.ssh.configuration.environment=Caparmor configuration -isisfish.simulator.ssh.configuration.freespace=Used space disk \: -isisfish.simulator.ssh.configuration.freespace.confirmdelete=Warning, deleting folder '%s' is irreversible.\nDo you confirm the deletion of contents ? -isisfish.simulator.ssh.configuration.freespace.label=Size of %s \: %s -isisfish.simulator.ssh.configuration.invalidpassphrase=Invalid passphrase -isisfish.simulator.ssh.configuration.keygenerate=Generate -isisfish.simulator.ssh.configuration.status=Status -isisfish.simulator.ssh.configuration.test=Test configuration -isisfish.simulator.ssh.configuration.title=Caparmor launcher configuration -isisfish.simulator.subprocess.readoutput.error= -isisfish.species.age=Age -isisfish.species.cee=CEE -isisfish.species.comments=Comments -isisfish.species.length=Length -isisfish.species.name=Species name -isisfish.species.rubbinCode=Rubbin code -isisfish.species.scientificName=Scientific name -isisfish.species.structured=Structured -isisfish.ssh.askpassphrase.message=Enter passphrase for key '%s' \: -isisfish.ssh.askpassphrase.title=SSH key unlocking -isisfish.ssh.askpassphrase.wrongpassphrase=Wrong passphrase, enter a new one for key '%s' \: -isisfish.strategy.comments=Comments -isisfish.strategy.inactivity=Inactivity equation -isisfish.strategy.inactivityEquationUsed=Use inactivity equation -isisfish.strategy.name=Name -isisfish.strategy.proportionSetOfVessels=Set of vessels proportion -isisfish.strategy.title=Caracteristics -isisfish.strategyMonthInfo.metier=Metier -isisfish.strategyMonthInfo.minInactivityDays=Min inactivity days -isisfish.strategyMonthInfo.numberOfTrips=Number of trips -isisfish.strategyMonthInfo.proportion=Proportion -isisfish.strategyMonthInfo.title=StrategyMonthInfo -isisfish.strategyMonthInfo.toString=%1$s %2$s -isisfish.timeUnit.day=Day -isisfish.timeUnit.hours=Hours -isisfish.tray.simulation=Isis-fish - %1$s \: %2$s/%3$s -isisfish.tray.simulation.multi=Isis-fish - %s / %s -isisfish.tray.simulation.no=Isis-fish - No simulation -isisfish.tripType.comments=Comments -isisfish.tripType.duration=Duration -isisfish.tripType.minTime=Minimum time between trips -isisfish.tripType.name=Name -isisfish.vcs.ask.passphrase=Enter your pass phrase (if your private key have one). -isisfish.vcs.ask.passphrase.title=Ask your pass phrase -isisfish.vcs.commit=vcs.commit -isisfish.vcs.commit.cancel=vcs.commit.cancel -isisfish.vcs.commit.label=vcs.commit.label -isisfish.vcs.commit.ok=vcs.commit.ok -isisfish.vcs.factory.cantinstanciate=Can't instanciate wanted VCS (%s), use default -isisfish.vcs.howto.save.key=How to register my public key on labs forge -isisfish.vcs.init.notfoundcantdownload=No database version %s found and can't get it.\nYou must go to ISIS-Fish web site and download database manually. -isisfish.vcs.init.wrongprotocol=Your database repository\: %s\n don't use correct protocol.\nDo you want to make backup of your database and take the correct one ? -isisfish.vcs.save.key=Go to labs forge to register my public key -isisfish.vcs.switchprotocol.confirm=Protocol to access repository script has changed.\nDo you want to switch your repository ? -isisfish.vcs.switchtag.warningconflict=Your repository is now up-to-date, but following files are conflicted, you may check them \: -isisfish.vcs.switchversion.confirm=You don't use correct repository script for your application version %s.\nDo you want to switch your repository ? -isisfish.vcs.update=vcs.update -isisfish.vcs.update.cancel=cancel -isisfish.vcs.update.checkAll=checkAll -isisfish.vcs.update.local=local -isisfish.vcs.update.local.modified=modified -isisfish.vcs.update.local.outofdateAndModified=outofdateAndModified -isisfish.vcs.update.local.tooltip.modified= -isisfish.vcs.update.local.tooltip.outofdateAndModified= -isisfish.vcs.update.local.tooltip.unversionned= -isisfish.vcs.update.local.unversionned=unversionned -isisfish.vcs.update.ok=ok -isisfish.vcs.update.remote=remote -isisfish.vcs.update.remote.missing=missing -isisfish.vcs.update.remote.outofdate=outofdate -isisfish.vcs.update.remote.tooltip.missing= -isisfish.vcs.update.remote.tooltip.outofdate= -isisfish.vcs.update.tooltip.checkAll=checkAll -isisfish.vcs.update.tooltip.local= -isisfish.vcs.update.tooltip.remote= -isisfish.vcs.update.warningconflict=Your repository is now up-to-date, but following files are conflicted, you may check them \:\n -isisfish.vcs.updateconfirm=updateconfirm -isisfish.vcs.updateconfirm.cancel=cancel -isisfish.vcs.updateconfirm.checkAll=checkAll -isisfish.vcs.updateconfirm.label= -isisfish.vcs.updateconfirm.label2= -isisfish.vcs.updateconfirm.ok=ok -isisfish.vcs.updateconfirm.tooltip.checkAll= -isisfish.vcs.updaterepository.confirm=Your repository is not up to date.\nDo you want to update following files ? -isisfish.vcs.vcssvn.add.error=Can't add file -isisfish.vcs.vcssvn.add.errorreadonly=You can't add file, this repository is readonly -isisfish.vcs.vcssvn.checkProtocol.error=Can't get address on serveur of local repository -isisfish.vcs.vcssvn.checkProtocol.relocate=Relocate repository %s from %s to %s -isisfish.vcs.vcssvn.checkout.error=Can't checkout -isisfish.vcs.vcssvn.cleanup.error=Can't cleanup working copy -isisfish.vcs.vcssvn.commit.error=Can't commit files -isisfish.vcs.vcssvn.commit.errorreadonly=You can't commit file, this repository is readonly -isisfish.vcs.vcssvn.delete.error=Can't delete file -isisfish.vcs.vcssvn.delete.errorreadonly=You can't delete file, this repository is readonly -isisfish.vcs.vcssvn.diff.error=Can't get diff -isisfish.vcs.vcssvn.gettag.error=Can't get address on serveur of local repository -isisfish.vcs.vcssvn.getupdate.error=Can't status file -isisfish.vcs.vcssvn.global.filelocalandremotestatus=file %s status is (l\:%s/r\:%s) -isisfish.vcs.vcssvn.global.filestatus=status for %s is %s -isisfish.vcs.vcssvn.global.foundUpdatedFile=add %s as updated file -isisfish.vcs.vcssvn.global.torevision=At revision \: %d -isisfish.vcs.vcssvn.isconnected.switchoff=Can't connect to serveur, switch to off line\: %s -isisfish.vcs.vcssvn.isconnected.switchto=Connection to serveur available, switch on line\: %s -isisfish.vcs.vcssvn.isonremote.error=file %s is not on server -isisfish.vcs.vcssvn.istag.notexist=Tag %s don't exist -isisfish.vcs.vcssvn.isuptodate.error=Can't get file status -isisfish.vcs.vcssvn.list.error=Can't list files -isisfish.vcs.vcssvn.localstatus.error=Can't status file -isisfish.vcs.vcssvn.remotestatus.error=Can't status file -isisfish.vcs.vcssvn.setTag.error=Can't get address on server of local repository -isisfish.vcs.vcssvn.settag.switchfromto=Switch repository tag from %s to %s -isisfish.vcs.vcssvn.update.error=Can't update files -isisfish.vcs.vcssvn.update.notinlocal=Can't update file that not in local repository -isisfish.versionStorage.removed=Removed -isisfish.vesselType.activityRange=Activity range -isisfish.vesselType.comments=Comments -isisfish.vesselType.fuelCost=Fuel cost of travel -isisfish.vesselType.length=Length -isisfish.vesselType.maxDuration=Maximum trip duration -isisfish.vesselType.miniCrew=Minimum crew size -isisfish.vesselType.name=Name -isisfish.vesselType.speed=Speed -isisfish.welcome.menu.about=About -isisfish.welcome.menu.api=API -isisfish.welcome.menu.close=Close -isisfish.welcome.menu.configuration=Configuration -isisfish.welcome.menu.configuration.sshlauncher=Caparmor configuration -isisfish.welcome.menu.configuration.vcs=VCS Configuration -isisfish.welcome.menu.file=File -isisfish.welcome.menu.frame=Window -isisfish.welcome.menu.help=Help -isisfish.welcome.menu.help.isisfish=Isis-Fish Website -isisfish.welcome.menu.help.isisfishapi=Isis-Fish API -isisfish.welcome.menu.help.javaapi=Java API -isisfish.welcome.menu.help.matrixapi=NuitonMatrix API -isisfish.welcome.menu.help.topiaapi=ToPIA API -isisfish.welcome.menu.input=Input -isisfish.welcome.menu.monitor=Logs frame -isisfish.welcome.menu.queue=Simulation queue -isisfish.welcome.menu.result=Result -isisfish.welcome.menu.script=Script -isisfish.welcome.menu.simulation=Simulation launcher -isisfish.welcome.menu.synchro=Server synchronization -isisfish.welcome.title=Ifremer Simulation -isisfish.wizardGroupCreation.allGroupsSameSize=All groups have the same size -isisfish.wizardGroupCreation.allValues=Input all the values -isisfish.wizardGroupCreation.computedGrowthCurve=Computed by a growth curve -isisfish.wizardGroupCreation.firstAge=First age -isisfish.wizardGroupCreation.firstAgeHelp=First age \= minimal age -isisfish.wizardGroupCreation.firstGroup=First group -isisfish.wizardGroupCreation.firstLength=First min length -isisfish.wizardGroupCreation.firstLengthHelp=First min length \= minimal length of first group -isisfish.wizardGroupCreation.gapBetweenGroupsHelp=gap between to group is 1 year. -isisfish.wizardGroupCreation.groupWidth=Group width -isisfish.wizardGroupCreation.groupWidthHelp=Group width \= width of group -isisfish.wizardGroupCreation.lastAge=Last age -isisfish.wizardGroupCreation.lastAgeHelp=Last age \= maximal age -isisfish.wizardGroupCreation.maxGroupsLength=Maximal groups length -isisfish.wizardGroupCreation.maxGroupsLengthHelp=A semicolon ';' must separe maximal length of each group -isisfish.wizardGroupCreation.numberGroup=Number of group -isisfish.wizardGroupCreation.numberGroupHelp=number of Group \= number of group wanted -isisfish.wizardGroupCreation.numberGroups=Number of groups -isisfish.wizardGroupCreation.populationCharacteristics=Input the population characteristics -isisfish.wizardGroupCreation.selectGroupLengthType=Select group length type -isisfish.wizardGroupCreation.timeStep=Time step (in month) -isisfish.wizardGroupCreation.title=Group creation -isisfish.wizardGroupCreation.undefinedGrowthEquation=The equation used is the population's growth curve, it needs to be defined first. -isisfish.zone.cells=Zone cells -isisfish.zone.comments=Comments -isisfish.zone.name=Name -region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= -simulate\ %s\ with\ file\ %s= Deleted: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,1118 +0,0 @@ -Add\ to\ default\ queue= -Analyse\ plan\ error,\ too\ many\ simulation\ for\ %s\ \:\ %s= -Can't\ add\ result\ '%1$s'\ at\ date\ %2$s=Can't add result '%1$s' at date %2$s -Can't\ add\ simulation\:\ %s= -Can't\ create\ simulation\ logger=Can't create simulation logger -Can't\ delete\ simulation= -Can't\ delete\ simulation\ %s\ = -Can't\ display\ simulation\ log= -Can't\ do\ post\ action\ %s= -Can't\ do\ simulation\ %s= -Can't\ download\ archive\ \:\ %s= -Can't\ download\ file= -Can't\ evaluate\ simulation\ prescript= -Can't\ export\ simulation\ %s= -Can't\ get\ changlog=Impossible d'obtenir de changelog -Can't\ get\ result\:\ %1$s=Can't get result\: %1$s -Can't\ instanciate\ export\ %1$s=Can't instanciate export %1$s -Can't\ instantiate\ %s= -Can't\ open\ log\ for\ %s= -Can't\ open\ simulation\ internal\ frame= -Can't\ read\ ssh\ key\ \:\ %s= -Can't\ simulate\ %s= -Check\ state\ of\ local\ repository\:\ %s= -Command\ '%s'\ fail\ to\ execute= -Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s= -Error\ during\ vcs\ initialisation= -Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys= -Generate\ next\ simulation= -Import\ one\ java\ file\ script\ source= -Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s= -Import\ zipped\ file\ containing\ all\ scripts\ directory\ structure= -Info=Info -Jobs\ submited\ is\ not\ ItemSimulation\ but\ was\ %s= -Last\ entry\ was\ %s\ extract\ name\ %s= -Launcher\ %s\ will\ be\ stopped\ because\ there\ are\ too\ many\ error\ (%s)= -Local\ repository\ don't\ exist= -Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s= -Normal\ stop\ thread,\ this\ is\ not\ an\ error= -Not\ start\ simulation\ %s\ because\ user\ ask\ stop= -Process\ template\ error= -Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import= -Region\ %s\ already\ inited=La r\u00E9gion %s a d\u00E9j\u00E0 \u00E9t\u00E9 initialis\u00E9e -Remote\ control\ file\ doesn't\ exists\ %s= -Remote\ information\ file\ doesn't\ exists\ %s= -Rename\ data\ directory\ to\ %s= -Show\ help= -Show\ version= -SimulationExecutor\ started\ with\ %s\ thread\ for\ %s= -Skip\ data\ migration\ (disabled)= -Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to= -Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s= -SubProcess\ start\:\ %s\ %s= -Switch\ repository\ type\ to\ none= -Try\ to\ log\ on\ %s@%s\:%d= -Use\ branches,\ switch\ not\ needed= -User\ restart\ simulation\ %s= -User\ stop\ simulation\ %s= -could\ not\ close\ reader\ %1$s=could not close reader %1$s -could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s -could\ not\ filter\ on\ simulations=could not filter on simulations -could\ not\ found\ %s= -could\ not\ found\ log\ file\ %1$s=could not found log file %1$s -could\ not\ found\ region\ %s= -could\ not\ found\ simulation\ %s= -could\ not\ read\ at\ offset\ %1$s\ for\ reason\ %2$s=could not read at offset %1$s for reason %2$s -destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= -destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= -directory\ %s\ must\ be\ a\ directory= -filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. -isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2010.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Merci de rapporter les bugs.<html> -isisfish.about.licensetext=Vous pouvez modifier et redistribuer ce programme sous les conditions \u00E9nonc\u00E9es par la licence GNU GPL (version 2 ou ult\u00E9rieure). Une copie de la licence GPL est dans le fichier \u00AB\u00A0LICENSE.txt\u00A0\u00BB fourni avec Isis-Fish. Tous droits r\u00E9serv\u00E9s. Aucune garantie n'est fournie pour l'utilisation de ce programme. -isisfish.about.title=\u00C0 propos de Isis-Fish... -isisfish.advancedParameters.title=Param\u00E8tres avanc\u00E9s -isisfish.advancedParams.freeParameters=Param\u00E8tres libres -isisfish.advancedParams.libLevelLogger=Niveau de tracage des librairies -isisfish.advancedParams.scriptLevelLogger=Niveau de tracage des scripts -isisfish.advancedParams.simulLevelLogger=Niveau de tracage du simulateur -isisfish.advancedParams.simulationCache=Simulation cache -isisfish.advancedParams.simulationStatistique=Simulation statistique -isisfish.advancedParams.simulatorUse=Simulateur \u00E0 utiliser -isisfish.cell.comments=Commentaires -isisfish.cell.land=Terre -isisfish.cell.latitude=Latitude -isisfish.cell.longitude=Longitude -isisfish.cell.name=Nom -isisfish.change.equation=Ne peut pas changer l'\u00E9quation -isisfish.commit.message=Entrer un message de commit -isisfish.common.add=Ajouter -isisfish.common.add.short=Aj. -isisfish.common.alert=alerte -isisfish.common.apply=Appliquer -isisfish.common.blank=\ -isisfish.common.cancel=Annuler -isisfish.common.check=V\u00E9rifier -isisfish.common.clear=Effacer -isisfish.common.confirm=Confirmation -isisfish.common.date=Date -isisfish.common.debug=Debug -isisfish.common.delete=Supprimer -isisfish.common.duration.inhours=En heures -isisfish.common.ellipsis=... -isisfish.common.emigration=\u00E9migration -isisfish.common.equation=Equation -isisfish.common.error=Erreur -isisfish.common.file=Fichier -isisfish.common.finish=Terminer -isisfish.common.gear=Engin -isisfish.common.immigration=immigration -isisfish.common.info=Info -isisfish.common.migration=migration -isisfish.common.module=Module -isisfish.common.month=mois %1$s -isisfish.common.name=Nom -isisfish.common.new=Nouveau -isisfish.common.newMatrix=Nouvelle matrice -isisfish.common.next=Suivant -isisfish.common.ok=Ok -isisfish.common.openEditor=Ouvrir l'\u00E9diteur -isisfish.common.population=Population -isisfish.common.populationGroup=Groupe de population -isisfish.common.populations=Populations -isisfish.common.port=Port -isisfish.common.prev=Pr\u00E9c\u00E9dent -isisfish.common.region=R\u00E9gion -isisfish.common.remove=Supprimer -isisfish.common.reset=R\u00E9initialiser -isisfish.common.rules=R\u00E8gles -isisfish.common.save=Sauver -isisfish.common.saveModel=Sauver comme mod\u00E8le -isisfish.common.saveNextSimulation=Sauver pour la prochaine simulation -isisfish.common.season=Saison -isisfish.common.setOfVessels=Flottille -isisfish.common.simulate=Simuler -isisfish.common.strategies=Strat\u00E9gies -isisfish.common.sum=somme -isisfish.common.tag=Tag -isisfish.common.tripType=Type de trajet -isisfish.common.valid=Valider -isisfish.common.value=Valeur -isisfish.common.warn=Warning -isisfish.common.year=ann\u00E9e -isisfish.common.zone=Zone -isisfish.config.category.main=Globale -isisfish.config.category.main.description=Configuration globale -isisfish.config.category.misc=Divers -isisfish.config.category.misc.description=Divers -isisfish.config.category.versioning=VCS -isisfish.config.category.versioning.description=Gestionnaire de version -isisfish.config.database.lockmode.description=M\u00E9thode de v\u00E9rouillage \u00E0 utiliser pour la base de donn\u00E9es -isisfish.config.main.compileDirectory.description=le r\u00E9pertoire o\u00F9 sont compil\u00E9s les scripts -isisfish.config.main.configFileName.description=le fichier de configuration \u00E0 utiliser -isisfish.config.main.defaultBackupDirectory.description=le r\u00E9pertoire o\u00F9 stocker les backups des donn\u00E9es -isisfish.config.main.defaultExportNames.description=les noms des exports \u00E0 effectuer apr\u00E8s une simulation -isisfish.config.main.defaultMapFile.description=noms de la carte par d\u00E9faut pour une base sans cartes -isisfish.config.main.defaultResultNames.description=les noms des r\u00E9sultats \u00E0 traiter durant une simulation -isisfish.config.main.defaultSimulator.description=le nom du simulateur par d\u00E9faut \u00E0 utiliser lors d'une simulation -isisfish.config.main.defaultTagValue.description= -isisfish.config.main.encoding.description=l'encoding du syst\u00E8me -isisfish.config.main.javadocDirectory.description=dossier de g\u00E9n\u00E9ration de la javadoc des scripts -isisfish.config.main.javadocURL.description=l'url de la javadoc des scripts -isisfish.config.main.launchUI.description=Affiche l'interface utilisateur -isisfish.config.main.localSimulator.description=Nom du simulateur local (processus courant) -isisfish.config.main.locale.description=la locale utilisateur -isisfish.config.main.monitoringDirectory.description=Dossier contenant les informations permettant de relancer les simulations -isisfish.config.main.performcron.description=D\u00E9marre toutes les t\u00E2ches d\u00E9finies dans le service cron -isisfish.config.main.performmigration.description=Migre les donn\u00E9es -isisfish.config.main.performvcsupdate.description=Met \u00E0 jour le d\u00E9p\u00F4t VCS -isisfish.config.main.remoteCaparmor.description=Nom du lanceur de simulation distante -isisfish.config.main.simulation.ssh.control.check.interval=V\u00E9rification de la progression (secondes) -isisfish.config.main.simulation.ssh.control.check.interval.description=Temps d'attente en secondes entre deux v\u00E9rifications de progression -isisfish.config.main.simulation.ssh.datapath=Base de donn\u00E9es -isisfish.config.main.simulation.ssh.datapath.description=Emplacement de la base de donn\u00E9es (isis-database) -isisfish.config.main.simulation.ssh.isis.home=Installation d'Isis-Fish -isisfish.config.main.simulation.ssh.isis.home.description=Emplacement d'installation d'Isis-Fish sur le serveur -isisfish.config.main.simulation.ssh.javapath=Emplacement de java -isisfish.config.main.simulation.ssh.javapath.description=Emplacement de java sur le serveur (chemin total, ou relatif au $PATH, par d\u00E9faut la valeur est celle de caparmor) -isisfish.config.main.simulation.ssh.max.threads=Nombre de thread SSH -isisfish.config.main.simulation.ssh.max.threads.description=Nombre de simulation simultan\u00E9e \u00E0 faire en SSH. Attention, ne doit \u00EAtre utilis\u00E9 que pour faire plusieurs plans d'analyse d\u00E9pendants en m\u00EAme temps, sinon laisser '1'. -isisfish.config.main.simulation.ssh.pbsbinpath=Emplacement des executables PBS -isisfish.config.main.simulation.ssh.pbsbinpath.description=Emplacement des commandes PBS (qsub, qdel...) sur le serveur -isisfish.config.main.simulation.ssh.pbsqsuboptions=Arguments qsub -isisfish.config.main.simulation.ssh.pbsqsuboptions.description=Arguments utilis\u00E9s lors de la soumission des jobs. Par d\u00E9faut '-m n' pas d'envoi de mails. -isisfish.config.main.simulation.ssh.server=Serveur de simulation -isisfish.config.main.simulation.ssh.server.description=Adresse du serveur de simulation -isisfish.config.main.simulation.ssh.sftpserver.description=Adresse du serveur de transfert de fichier (laisser vide pour utiliser directement scp sur le serveur de simulation) -isisfish.config.main.simulation.ssh.tmppath=Dossier temporaire -isisfish.config.main.simulation.ssh.tmppath.description=Emplacement du dossier temporaire -isisfish.config.main.simulation.ssh.userhome=R\u00E9pertoire d'accueil -isisfish.config.main.simulation.ssh.userhome.description=R\u00E9pertoire d'accueil de l'utilisateur -isisfish.config.main.simulation.ssh.username=Identifiant -isisfish.config.main.simulation.ssh.username.description=Identifiant SSH pour se connecter au serveur -isisfish.config.main.simulationShowOnlyError.description=pour indiquer si l'on doit conserver dans l'UI des simulations termin\u00E9es uniquement celles avec erreur -isisfish.config.main.smtpServer.description=le nom du serveur smtp \u00E0 utiliser pour envoyer les courriels -isisfish.config.main.subSimulator.description=Nom du simulateur en sous processus -isisfish.config.main.userMail.description=le courriel de l'utilisateur -isisfish.config.main.userName.description=le nom - pr\u00E9nom de l'utilisateur -isisfish.config.ssh.key.file=Cl\u00E9 SSH -isisfish.config.ssh.key.file.description=Emplacement de la cl\u00E9 priv\u00E9e SSH -isisfish.config.vcs.hostName.description=le nom du serveur vcs \u00E0 utiliser -isisfish.config.vcs.localDatabasePath.description= -isisfish.config.vcs.noPassPhrase.description=pour indiquer si la clef priv\u00E9e ssh2 utilis\u00E9e pour communiquer avec le serveur vcs est prot\u00E9g\u00E9 par une passe-phrase -isisfish.config.vcs.passphrase.description=la passe-phrase utilis\u00E9e pour prot\u00E9ger la clef priv\u00E9e ssh -isisfish.config.vcs.remotePath.description=le chemin jusqu'au parent du module de donn\u00E9es sur le serveur vcs -isisfish.config.vcs.type.description=le type de communication vcs utilis\u00E9 -isisfish.config.vcs.useSshConnexion.description=pour indiquer si l'on utilise une connexion s\u00E9curis\u00E9e pour communiquer avec le serveur vcs (ssh2) -isisfish.config.vcs.userName.description=le login de l'utilisateur sur le serveur vcs -isisfish.config.vcs.userPassword.description= -isisfish.dataResult.export.csv=Exporter en CSV -isisfish.dataResult.label=Valeur -isisfish.date.toString=%1$s %2$s -isisfish.effortDescription.crewFoodCost=Co\u00FBt de l'alimentation pour l'\u00E9quipage -isisfish.effortDescription.crewShareRate=Taux de partage de l'\u00E9quipage -isisfish.effortDescription.crewSize=Taille de l'\u00E9quipage -isisfish.effortDescription.economicTitle=Param\u00E8tres \u00E9conomiques -isisfish.effortDescription.effortTitle=Param\u00E8tres d'effort de p\u00EAche -isisfish.effortDescription.fishingOperation=Op\u00E9ration de p\u00EAche -isisfish.effortDescription.fishingOperationDuration=Dur\u00E9e de la p\u00EAche -isisfish.effortDescription.fishingOperationDuration.tooltip=En heures -isisfish.effortDescription.fixedCrewSalary=Salaire d'\u00E9quipage fixe -isisfish.effortDescription.gearsNumberPerOperation=Nombre d'engins par op\u00E9ration -isisfish.effortDescription.landingCosts=Co\u00FBts d'accastillage -isisfish.effortDescription.otherRunningCost=Autres co\u00FBts -isisfish.effortDescription.parametersTitle=Param\u00E8tres des m\u00E9tiers -isisfish.effortDescription.repairAndMaintenanceGearCost=Co\u00FBts de maintenance -isisfish.effortDescription.title=M\u00E9tiers pratiqu\u00E9s -isisfish.effortDescription.toString=EffortDescription for %1$s with %2$s -isisfish.effortDescription.unitCostOfFishing=Co\u00FBt unitaire de la p\u00EAche -isisfish.equation.editor.title=Editeur d'\u00E9quation -isisfish.error.acceptable.population=La nouvelle valeur n'est pas une valeur valide pour cette population -isisfish.error.add.card=Erreur lors de l'ajout du r\u00E9sultat \u00E0 la carte. -isisfish.error.add.logger.simulation=isisfish.error.add.logger.simulation -isisfish.error.add.result.data=Erreur lors de l'ajout du r\u00E9sultat au data. -isisfish.error.add.result.graph=Erreur lors de l'ajout du r\u00E9sultat au graph. -isisfish.error.add.tray=Impossible d'ajouter une icone de notification -isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s -isisfish.error.change.equation=Can't change equation -isisfish.error.compile.fileerror=Le fichier %s contient des erreurs \! -isisfish.error.compile.script=Impossible de compiler le script \: %s -isisfish.error.compiled.parameter=Can't get rule parameter from compiled class -isisfish.error.conversion.data=Erreur lors de la conversion du fichier de donn\u00E9es -isisfish.error.create.equation=Can't create equation -isisfish.error.delete.database=Can't delete database -isisfish.error.delete.file=could not delete file %1$s -isisfish.error.delete.vcs.files=Can't delete vcs files -isisfish.error.during.simulation=Error during simulation -isisfish.error.emigration.negative=emigration negative -isisfish.error.empty.code.rubbin=le code rubbin est vide -isisfish.error.empty.emigration=emigration vide -isisfish.error.empty.id.geographic=l'identifiant g\u00E9ographique est vide -isisfish.error.empty.immigration=immigration vide -isisfish.error.empty.migration=Migration vide -isisfish.error.empty.name=le nom est vide -isisfish.error.empty.params.name=le nom du param\u00E8tre est vide -isisfish.error.empty.population=Population est vide -isisfish.error.empty.scientific.name=le nom scientifique est vide -isisfish.error.empty.season=info saison vide -isisfish.error.empty.selectivity=s\u00E9lectivit\u00E9 est vide -isisfish.error.empty.species=espece capturable vide -isisfish.error.empty.species.name=le nom d'espece est vide -isisfish.error.empty.unit=l'unit\u00E9 de mesure est vide -isisfish.error.equation.openeditor=Impossible d'ouvrir l'editeur d'\u00E9quation -isisfish.error.equation.return.number=EquationImpl doit retourner un nombre \: %1$s -isisfish.error.equation.savemodel=Impossible de sauver l'\u00E9quation en tant que mod\u00E8le -isisfish.error.errorpane.htmlmessage=<html><b>IsisFish a d\u00E9tect\u00E9 une erreur \:</b><br />%s</b></html> -isisfish.error.errorpane.title=Erreur -isisfish.error.evaluate.equation=Impossible d'\u00E9valuer l'\u00E9quation\: %1$s -isisfish.error.evaluate.preplan.script= -isisfish.error.evalute.plan.script=Can't evaluate plan script -isisfish.error.factor.invalid=Le facteur n'est pas valide -isisfish.error.file.already.exists=The file %1$s already exist -isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population -isisfish.error.immigration.negative=immigration negative -isisfish.error.import.convertible=Erreur lors de l'import, la version du fichier que vous souhaitez importer n'est pas transformable en une version importable. -isisfish.error.import.file=Can't import file %1$s -isisfish.error.import.recent.files=Erreur lors de l'import, la version du fichier que vous souhaitez importer est plus r\u00E9cente que la version souhait\u00E9e. -isisfish.error.init.map=Can't init map. -isisfish.error.input.addentity=Impossible d'ajouter l'entit\u00E9 "%s" -isisfish.error.input.cancelentity=Impossible d'annuler les modifications -isisfish.error.input.createentity=Impossible de cr\u00E9er une nouvelle entit\u00E9 -isisfish.error.input.removeentity=Impossible de supprimer l'entit\u00E9 "%s" -isisfish.error.input.save=Impossible de sauver les modifications -isisfish.error.input.saveentity=Impossible de sauver les modifications -isisfish.error.input.spacializematrix= -isisfish.error.instanciate=Can't instanciate %1$s -isisfish.error.instanciate.export=Can't instanciate export %1$s -isisfish.error.invalid.costs.fix=les co\u00FBts fixes sont invalides -isisfish.error.invalid.distribution.recruitment=distribution de recrutement invalide -isisfish.error.invalid.equation=Equation invalide -isisfish.error.invalid.equation.name=Nom d'\u00E9quation invalide -isisfish.error.invalid.file.name=Le nom du script %1$s n'est pas valide. -isisfish.error.invalid.interval.reproduction.recruitment=interval entre la reproduction et le recrutement invalide -isisfish.error.invalid.mean.weight=poids moyen invalide -isisfish.error.invalid.natural.death=mortalit\u00E9 naturelle sur les classes naissantes invalide -isisfish.error.invalid.nullequation=L'\u00E9quation %s n'existe pas \! -isisfish.error.invalid.number=le nombre est invalide -isisfish.error.invalid.range=La gamme possible n'a pas de valeur acceptable -isisfish.error.invalid.values.params=Param\u00E8tre controlable hors valeurs possibles -isisfish.error.invalidate.natural.death=mortalite naturelle invalide -isisfish.error.invoke.method=Can't invoke method '%1$s' for class %2$s -isisfish.error.linkageerror.message=Isis-Fish a d\u00E9tect\u00E9 une erreur d'utilisation des scripts.\nLe dossier de compilation a \u00E9t\u00E9 supprim\u00E9 pour forcer leur recompilation.\n\nMerci de relancer Isis-Fish. -isisfish.error.linkageerror.title=Erreur d'initialisation -isisfish.error.load.class=Can't load class\: %1$s -isisfish.error.load.classloader=Can't create ClassLoader for script, bad directory\: %1$s for reason %2$s -isisfish.error.load.file=could not load file %1$s -isisfish.error.log.closeAppender=n'a pas pu ferme l'appender %1$s et la categorie %2$s -isisfish.error.log.console.dispose=Une erreur est survenue pendant la fermeture de la console %1$s de log, raison %2$s -isisfish.error.log.createAppender=n'a pas pu creer l'appender [%1$s] \: %2$s pour la raison %3$s -isisfish.error.log.foundAppender=n'a pas trouve l'appender %1$s pour la categorie %2$s -isisfish.error.matrix.more.2d=Matrice de plus de 2 dimensions\!\!\nS\u00E9lectionnez moins d'\u00E9l\u00E9ments ou utilisez l'op\u00E9rateur somme. -isisfish.error.migration.negative=Migration negative -isisfish.error.no.matrix=Pas de matrice pour \: %s -isisfish.error.no.null.time.step=Error, the time step should not be null -isisfish.error.no.sector=il n'y a pas de secteur de d\u00E9finit -isisfish.error.no.select.simulation=could not select simulation -isisfish.error.no.target.species=no target species in %1$s for %2$s -isisfish.error.not.found.code=could not found codeclass for %1$s -isisfish.error.not.found.description=could not found description for %1$s -isisfish.error.not.found.field=could not found field %1$s doc for %2$s -isisfish.error.not.found.field.class=could not found field %1$s for class %2$s -isisfish.error.not.null.class.grown=classe mature vaut nul -isisfish.error.not.null.mean.weight=poids moyen nul -isisfish.error.not.null.natural.death=mortalite naturelle nulle -isisfish.error.not.possible.metier=Pas de m\u00E9tier possible -isisfish.error.not.support.class=La classe %s ne supporte pas les descritions -isisfish.error.number.classes.upper.zero=Error, the number of classes must be upper than 0 -isisfish.error.out.memory=Out of memory try with more memory (option -mx) -isisfish.error.overlap.season=Cette saison chevauche une autre saison -isisfish.error.parse.date=Can't parse date %1$s -isisfish.error.parse.long=Can't parse long %1$s -isisfish.error.plan.parameter=Can't get plan parameter from compiled class -isisfish.error.prepare.data=Can't prepare data -isisfish.error.prepare.information.simulation=Can't prepare information for simulation -isisfish.error.read.simulation=Can't read simulation information %1$s -isisfish.error.read.simulation.parameters=Impossible de lire les param\u00E8tres du fichier \: %1$s -isisfish.error.region.addmap=Impossible d'ajouter une carte -isisfish.error.region.already.exists=Cette r\u00E9gion existe d\u00E9j\u00E0 -isisfish.error.region.cancel= -isisfish.error.region.check=Impossible de v\u00E9rifier la r\u00E9gion -isisfish.error.region.commit=Impossible de committer la r\u00E9gion -isisfish.error.region.copy=Impossible de copier la r\u00E9gion -isisfish.error.region.create=Impossible de cr\u00E9er une nouvelle r\u00E9gion -isisfish.error.region.export=Impossible d'exporter la r\u00E9gion -isisfish.error.region.import=Impossible d'importer la r\u00E9gion -isisfish.error.region.load=Impossible de charger la r\u00E9gion -isisfish.error.region.name.empty=Le nom de la R\u00E9gion est vide -isisfish.error.region.new= -isisfish.error.region.remove=Impossible de supprimer la r\u00E9gion -isisfish.error.region.removemap=Impossible de supprimer une carte de la r\u00E9gion -isisfish.error.region.save=Impossible de sauver la r\u00E9gion -isisfish.error.remove.directory=Can't remove directory %1$s -isisfish.error.rename.region=Can't rename region to %1$s -isisfish.error.save.checkSum.compilation=Can't save checkSum to compilation\: %1$s -isisfish.error.save.script.compilation=Can't save script to compilation\: %1$s -isisfish.error.save.simulation.parameters=Can't save simulation parameters in file %1$s -isisfish.error.script.create=isisfish.error.script.create -isisfish.error.script.delete=N'a pas pu supprimer le fichier %1$s pour la raison suivante %2$s -isisfish.error.script.import=N'a pas pu importer pour la raison suivante %1$s -isisfish.error.script.load=N'a pas pu charger le fichier %1$s pour la raison suivante %2$s -isisfish.error.script.save=N'a pas pu sauver le fichier %1$s pour la raison suivante %2$s -isisfish.error.sensitivity.export=Error lors de l'export des facteurs de la r\u00E9gion -isisfish.error.simulation.addanalyseplan=Impossible d'ajouter un plan d'analyze -isisfish.error.simulation.addrule=Impossible d'ajouter une r\u00E8gle -isisfish.error.simulation.getparametervalue=Impossible d'obtenir la valeur du param\u00E8tre -isisfish.error.simulation.getresultname=Impossible d'obtenir la liste des r\u00E9sultat -isisfish.error.simulation.importparameter=Impossible d'importer les param\u00E8tres de simulation -isisfish.error.simulation.initsimulaction=Impossible d'initialiser la simulation -isisfish.error.simulation.launchsimulation=Impossible de lancer la simulation -isisfish.error.simulation.listoldsimulation=Impossible de lister les anciennes simulations -isisfish.error.simulation.listpopulation=Impossible d'obtenir la liste des populations -isisfish.error.simulation.liststrategies=Impossible d'obtenir la liste des stat\u00E9gies -isisfish.error.simulation.loadoldsimulation=Impossible de charger une ancienne simulation -isisfish.error.simulation.log.openAppender=n'a pas pu ouvrir l'appender de la simulation %1$s pour la raison %2$s -isisfish.error.simulation.openregion=Impossible d'ouvrir la r\u00E9gion -isisfish.error.simulation.remote.global=Impossible de lancer une simulation sur serveur distant -isisfish.error.simulation.remote.wrongportvalue=Le port de connexion a une valeur incorrecte \: %s -isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s -isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s -isisfish.error.simulation.resultXml.write=Can't write simulation result XML for reason %1$s -isisfish.error.simulation.savesimulation=Impossible de sauver les param\u00E8tres de simulation -isisfish.error.simulation.setparametervalue=Impossible d'affecter la valeur du param\u00E8tre -isisfish.error.source.parameter=Can't get parameter from source -isisfish.error.strategy.order=Strategy %1$s don't have 12 StrategyMonthInfo but %2$s. Recreate them -isisfish.error.undefined.classes=pas de classes d\u00E9finies -isisfish.error.undefined.correspondence.zones.reproduction.recruitment=pas de correspondance entre les zones de reproduction et les zones de recrutement -isisfish.error.undefined.gear=l'engin n'est pas d\u00E9fini -isisfish.error.undefined.mesh=aucune maille de d\u00E9fini -isisfish.error.undefined.mesh.sector=aucune maille dans le secteur -isisfish.error.undefined.meta.population=aucune meta population de d\u00E9fini -isisfish.error.undefined.natural.death=pas de mortalit\u00E9 naturelle sur les classes naissantes -isisfish.error.undefined.sector=aucun secteur de d\u00E9fini -isisfish.error.undefined.stategy=aucune strat\u00E9gie de d\u00E9fini -isisfish.error.undefined.stategy.months=La strat\u00E9gie n'est pas d\u00E9finie pour certain mois -isisfish.error.undefined.zone.population=il n'y a pas de zone de population de d\u00E9finie -isisfish.error.undefined.zone.recruitment=il n'y a pas de zone de recrutement de d\u00E9finie -isisfish.error.undefined.zone.reproduction=il n'y a pas de zone de reproduction de d\u00E9finie -isisfish.error.unsupported.equation.langage=unsupported langage '%1$s' for equation\: %2$s -isisfish.error.wait.simThread=Can't wait SimThread -isisfish.error.warning.title=Attention -isisfish.error.write.simulation=Can't write information %1$s -isisfish.export.saved=Exports des r\u00E9sultats sauvegard\u00E9s -isisfish.export.title=Export des r\u00E9sultats -isisfish.filter=Filtrer -isisfish.filter.apply=Appliquer le filtre -isisfish.filter.cancel=Annuler -isisfish.filter.log.levelDebug=debug -isisfish.filter.log.levelError=erreur -isisfish.filter.log.levelFatal=fatal -isisfish.filter.log.levelInfo=info -isisfish.filter.log.levelTrace=trace -isisfish.filter.log.levelWarn=warning -isisfish.filter.log.tooltip.levelDebug=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.levelError=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.levelFatal=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.levelInfo=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.levelTrace=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.levelWarn=s\u00E9lectionner pour filtrer ce niveau -isisfish.filter.log.tooltip.message=Entrer un terme \u00E0 rechercher et appuyer sur Entr\u00E9e -isisfish.filter.reset=R\u00E9initialiser -isisfish.filter.result=R\u00E9sultats -isisfish.filter.result.found=R\u00E9sultats (%d/%d) -isisfish.filter.select=S\u00E9lectionner -isisfish.filter.select.simulation=S\u00E9lectionner une simulation -isisfish.filter.simulation=Filtrer les simulations -isisfish.filter.simulation.analysePlanNumber=num\u00E9ro d'analyse -isisfish.filter.simulation.description=description -isisfish.filter.simulation.local=locale -isisfish.filter.simulation.numberOfYear=nombre d'ann\u00E9e(s) -isisfish.filter.simulation.regionName=nom de r\u00E9gion -isisfish.filter.simulation.simulationEnd=date de fin (dd/MM/yyyy) -isisfish.filter.simulation.simulationName=nom de simulation -isisfish.filter.simulation.simulationStart=date de d\u00E9but (dd/MM/yyyy) -isisfish.filter.simulation.simulatorName=nom du simulateur -isisfish.filter.simulation.tooltip.analysePlanNumber=filter sur le num\u00E9ro d'analyse (uniquement pour les simulations avec plan d'analyse) -isisfish.filter.simulation.tooltip.description=filtrer sur la description (format regex) -isisfish.filter.simulation.tooltip.local=filter uniquement les simulations locales -isisfish.filter.simulation.tooltip.numberOfYear=filter sur le nombre d'ann\u00E9e(s) (recherche exacte) -isisfish.filter.simulation.tooltip.regionName=filtrer sur le nom de la r\u00E9gion (format regex) -isisfish.filter.simulation.tooltip.simulationEnd=filtrer sur la date de fin de simulation (format dd/MM/yyyy) -isisfish.filter.simulation.tooltip.simulationName=filtrer sur le nom de simulation (format regex) -isisfish.filter.simulation.tooltip.simulationStart=filtrer sur la date de d\u00E9but de simulation (format dd/MM/yyyy) -isisfish.filter.simulation.tooltip.simulatorName=filter sur le nom du simulateur utilis\u00E9 (format regex) -isisfish.filter.simulation.tooltip.useAnalysePlan=filter uniquement les simulations avec plan d'analyse -isisfish.filter.simulation.tooltip.useOptimization=filter uniquement les simulations avec optimisation -isisfish.filter.simulation.tooltip.usePreScript=filter uniquement les simulations avec Prescript -isisfish.filter.simulation.tooltip.useStatistic=filter uniquement les simulations avec statistiques -isisfish.filter.simulation.useAnalysePlan=plan d'analyse -isisfish.filter.simulation.useOptimization=optimisation -isisfish.filter.simulation.usePreScript=prescript -isisfish.filter.simulation.useStatistic=statistiques -isisfish.fisheryRegion.addMap=Ajouter une carte -isisfish.fisheryRegion.area=Extr\u00E9mit\u00E9s de la zone de p\u00EAche -isisfish.fisheryRegion.comments=Commentaires -isisfish.fisheryRegion.delMap=Supprimer la carte -isisfish.fisheryRegion.latitude=Lat. -isisfish.fisheryRegion.latitude.max=Lat. max. -isisfish.fisheryRegion.latitude.min=Lat. min. -isisfish.fisheryRegion.longitude=Long. -isisfish.fisheryRegion.longitude.max=Long. max. -isisfish.fisheryRegion.longitude.min=Long. min. -isisfish.fisheryRegion.name=Nom de la r\u00E9gion -isisfish.fisheryRegion.ofCells=de mailles (option) -isisfish.fisheryRegion.selectFile=S\u00E9lectionnez un fichier -isisfish.fisheryRegion.spatial=R\u00E9solution spatiale -isisfish.gear.comments=Commentaires -isisfish.gear.effortUnit=Unit\u00E9 d'effort -isisfish.gear.name=Nom -isisfish.gear.rangeValues=Gamme de valeurs -isisfish.gear.standardisationFactor=Facteur de standardisation -isisfish.gear.technicalParameter=Param\u00E8tre technique -isisfish.gear.title=Engin -isisfish.graphBean.graph.render=Choisir un rendu de graphe -isisfish.graphCombo.render.bar=Rendu en barres verticales -isisfish.graphCombo.render.bar.3d=Rendu en barres verticales 3D -isisfish.graphCombo.render.bar.stacked=Rendu en barres verticales empil\u00E9es -isisfish.graphCombo.render.line=Rendu en ligne -isisfish.graphCombo.render.line.3d=Rendu en ligne 3D -isisfish.graphCombo.render.min.max=Rendu en MinMax -isisfish.graphCombo.render.surface=Rendu en aire -isisfish.graphCombo.render.surface.stacked=Rendu en aires empil\u00E9es -isisfish.infoItem.label=defaultToolTip-fr.ifremer.resultat.InfoItem.label -isisfish.infoItem.sum=Somme de tous les \u00E9l\u00E9ments -isisfish.infoItem.sum.year=Somme des \u00E9l\u00E9ments par ann\u00E9e -isisfish.input.continueCells=Continuer vers les mailles -isisfish.input.continueGears=Continuer vers les engins -isisfish.input.continueMetiers=Continuer vers les metiers -isisfish.input.continuePopulations=Continuer vers les populations -isisfish.input.continuePorts=Continuer vers les ports -isisfish.input.continueSetOfVessels=Continuer vers les flottilles -isisfish.input.continueSpecies=Continuer vers les esp\u00E8ces -isisfish.input.continueStrategies=Continuer vers les strat\u00E9gies -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.map.copytoclicboard=Copier vers de presse-papiers -isisfish.input.menu.addRegion=Ajouter une r\u00E9gion -isisfish.input.menu.commit=Sauvegarder les changements -isisfish.input.menu.copyRegion=Copier r\u00E9gion -isisfish.input.menu.exportRegion=Exporter la r\u00E9gion -isisfish.input.menu.importRegion=Importer une r\u00E9gion -isisfish.input.menu.importRegionSimulation=Importer la r\u00E9gion d'une simulation -isisfish.input.menu.importRegionV2=Importer une r\u00E9gion de la v2 d'IsisFish -isisfish.input.menu.importRenameRegion=Importer une r\u00E9gion et la renommer -isisfish.input.menu.removeLocaly=Supprimer localement -isisfish.input.menu.removeLocalyRemotely=Supprimer localement et \u00E0 distance -isisfish.input.menu.sensitivity=Mexico -isisfish.input.menu.sensitivity.export=Exporter les facteurs -isisfish.input.menu.server=Serveur -isisfish.input.newRegion=Nouvelle r\u00E9gion -isisfish.input.selectRegion=S\u00E9lectionnez une r\u00E9gion -isisfish.input.sensitivity.export.cancel=Export des facteurs annul\u00E9 -isisfish.input.sensitivity.export.complete=Export des facteurs r\u00E9ussit -isisfish.input.sensitivity.export.running=Export des facteurs en cours... -isisfish.input.sensitivity.export.title=Exporter les facteurs -isisfish.input.title=Saisie de la p\u00EAcherie -isisfish.input.tree.cells=Mailles -isisfish.input.tree.gears=Engins -isisfish.input.tree.metiers=M\u00E9tiers -isisfish.input.tree.populations=Populations -isisfish.input.tree.ports=Ports -isisfish.input.tree.setofvessels=Flottilles -isisfish.input.tree.species=Esp\u00E8ces -isisfish.input.tree.strategies=Strat\u00E9gies -isisfish.input.tree.triptypes=Types de mar\u00E9e -isisfish.input.tree.vesseltypes=Types de navire -isisfish.input.tree.zones=Zones -isisfish.launch.anonymous=lecture seule -isisfish.launch.email=courriel -isisfish.launch.firstname=nom -isisfish.launch.init.done=init done in %1$s. -isisfish.launch.lasstname=pr\u00E9nom -isisfish.launch.server.authenticationMethod=droit d'acc\u00E8s au serveur -isisfish.launch.server.login=nom utilisateur -isisfish.launch.server.ssh.confirm.passphrase=confirmer la passphrase -isisfish.launch.server.ssh.key.change=Changer la clef ssh -isisfish.launch.server.ssh.key.generate=G\u00E9n\u00E9rer la clef ssh -isisfish.launch.server.ssh.no.passphrase=pas de passphrase -isisfish.launch.server.ssh.passphrase=passphrase -isisfish.launch.server.ssh.privateKeyFile=clef priv\u00E9e ssh -isisfish.launch.server.ssh.publicKeyFile=clef publique ssh -isisfish.launch.ssh=lecture-\u00E9criture (ssh) -isisfish.launch.stop=Arr\u00EAt de la simulation... -isisfish.launching=after init done in %1$s. -isisfish.log.addAppender=ajoute un appender [%1$s] -isisfish.log.body=Message \u00E0 joindre -isisfish.log.closeAppender=ferme l'appender [%1$s] pour la categorie %2$s -isisfish.log.mail.failed=Impossible d'envoyer le rapport par courriel. Le serveur smtp fonctionne ? (J'essaye de contacter < %1$s > smtp server) -isisfish.log.mail.send=Un rapport a \u00E9t\u00E9 envoy\u00E9 \u00E0 %1$s -isisfish.log.mail.send.title=Envoi de la simulation %1$s par email -isisfish.log.mailTo=Adresse du destinataire -isisfish.log.removeAppender=supprime l'appender [%1$s] -isisfish.log.restoreLogLevel=repositionne le niveau du logger %1$s du niveau %2$s au niveau %3$s -isisfish.log.sendAll=Envoyer la simulation complete -isisfish.log.sendMail=Envoyer par email -isisfish.log.simulation.name=IsisFish simulation %1$s -isisfish.log.swapLogLevel=permute le niveau du logger %1$s du niveau %2$s au niveau %3$s -isisfish.log.tooltip.body=Le message saisi sera joint au courriel envoy\u00E9 -isisfish.log.tooltip.mailTo=Entrer l'adresse du destinataire du courriel -isisfish.log.tooltip.sendAll=Envoyer toute la simulation, ou uniquement le fichier de log -isisfish.log.tooltip.sendMail=Cliquer pour envoyer le courriel contentant les fichiers -isisfish.message.add.objets.simulation=Ajout des nouveaux objets cr\u00E9\u00E9s durant la simulation -isisfish.message.backup.database.finished=backup database termin\u00E9 -isisfish.message.backup.database.progress=backup database en cours -isisfish.message.cancel.finished=Annulation termin\u00E9e -isisfish.message.check.finished=V\u00E9rification termin\u00E9e -isisfish.message.checking.cell= -isisfish.message.choose.archive=choose archive file or directory -isisfish.message.commit.cancelled=commit annul\u00E9 -isisfish.message.commit.finished=commit termin\u00E9 -isisfish.message.commit.region.canceled=Commit de la r\u00E9gion annul\u00E9 -isisfish.message.commiting.region=En train de commiter la r\u00E9gion %1$s ... -isisfish.message.compilation.time=Temps de compilation %1$ss -isisfish.message.confirm.delete.object=Voulez-vous vraiment supprimer l'objet %1$s -isisfish.message.confirm.remove.region=Voulez-vous vraiment supprimer la r\u00E9gion %1$s ? -isisfish.message.confirm.remove.script=Voulez-vous vraiment supprimer le script '%1$s' ? -isisfish.message.copy.finished=Copie termin\u00E9e -isisfish.message.copy.region=Copier la r\u00E9gion -isisfish.message.creating.region=En train de cr\u00E9er la r\u00E9gion %1$s -isisfish.message.creation.finished=Cr\u00E9ation termin\u00E9e -isisfish.message.delete.canceled=Suppression annul\u00E9e -isisfish.message.delete.entities=Supprimer les entit\u00E9s -isisfish.message.delete.entity=Supprimer l'entit\u00E9 -isisfish.message.delete.finished=Suppression termin\u00E9e -isisfish.message.delete.object=Pour supprimer l'objet %1$s, tous les objets suivants seront aussi supprim\u00E9s \n\n -isisfish.message.directory.not.exists= -isisfish.message.evaluation.finished=\u00E9valuation termin\u00E9e -isisfish.message.export.done=Export termin\u00E9 -isisfish.message.export.zip=Exporter dans le fichier zip %1$s -isisfish.message.file.already.exists=Le fichier %s existe, voulez-vous l'\u00E9craser ? -isisfish.message.file.overwrite=Le fichier existe, voulez-vous l'\u00E9craser ? -isisfish.message.import=Importer %1$s -isisfish.message.import.equation.convert=Conversion manuelle de l'\u00E9quation -isisfish.message.import.finished=Import termin\u00E9 -isisfish.message.import.region.name=Entre le nom de la r\u00E9egion \u00E0 importer -isisfish.message.import.region.xml=R\u00E9gion XML (Isis-Fish V2.x) -isisfish.message.import.region.zipped=Zipped Region -isisfish.message.import.scripts.file=Importer des scripts depuis une archive zip -isisfish.message.import.scripts.file.cancelled=Importation des scripts annul\u00E9 -isisfish.message.import.scripts.file.done=Scripts import\u00E9s -isisfish.message.import.scripts.zipped=Archive de script (*.zip) -isisfish.message.import.xml.v2.file=Import xml v2 file -isisfish.message.import.zip=Import zip file -isisfish.message.launchui.notlaunch=Interface utilisateur non lanc\u00E9e -isisfish.message.load.finished=Chargement termin\u00E9 -isisfish.message.load.map=Chargement de la carte \: %1$s -isisfish.message.loading.old.simulation=Chargement d'une ancienne simulation... -isisfish.message.loading.region=Chargement de la r\u00E9gion -isisfish.message.name.imported.region=Entrez le nom de la r\u00E9gion \u00E0 importer -isisfish.message.new.filename=Entrez le nom du nouveau du fichier.\n\t (utiliser uniquemment des caract\u00E8res et _ en commencant avec une majuscule) -isisfish.message.new.formule.category=Choisissez le cat\u00E9gorie de la formule -isisfish.message.new.formule.title=Nouvelle formule -isisfish.message.new.region.name=Entrer le nom de la nouvelle r\u00E9gion -isisfish.message.old.simulation.loaded=Ancienne simulation charg\u00E9e -isisfish.message.page.modified=Cette page a \u00E9t\u00E9 modifi\u00E9, voulez-vous la sauvegarder ? -isisfish.message.presimulation.script.execution=Ex\u00E9cution des scripts de Presimulation -isisfish.message.recruitment.number.month=Entrez le nombre de mois de recrutement -isisfish.message.region.commited=R\u00E9gion commit\u00E9e -isisfish.message.region.loaded=R\u00E9gion charg\u00E9e -isisfish.message.region.remove.canceled=Suppression de r\u00E9gion annul\u00E9 -isisfish.message.region.removed=R\u00E9gion supprim\u00E9e -isisfish.message.remove.canceled=Suppression annul\u00E9e -isisfish.message.remove.finished=Suppresison termin\u00E9 -isisfish.message.removing.region=Suppression de la r\u00E9gion %1$s... -isisfish.message.result.verif.region=R\u00E9sultat de la v\u00E9rification de la r\u00E9gion -isisfish.message.save.finished=Sauvegarde termin\u00E9e -isisfish.message.saveModel.dialog=Entrez le nom du mod\u00E8le d'\u00E9quation -isisfish.message.saveModel.finished=Sauvegarde du mod\u00E8le termin\u00E9e -isisfish.message.script.commit=Indiquez un message pour committer les modifications fa\u00EEtes sur %s -isisfish.message.setting.cache.aspects=Mise en place des aspects Cache -isisfish.message.setting.trace.aspects=Mise en place des aspects Trace -isisfish.message.simulation.ended=Simulation termin\u00E9e -isisfish.message.simulation.execution=Simulation execution -isisfish.message.simulation.prepare=Pr\u00E9paration de la simulation -isisfish.message.tray.disabled=Icone de notification d\u00E9sactiv\u00E9e -isisfish.metier.comments=Commentaires -isisfish.metier.name=Nom -isisfish.metier.rangeValues=Param\u00E8tre d'engin -isisfish.metier.title=M\u00E9tier -isisfish.metierMonitor.metiers=M\u00E9tiers -isisfish.metierMonitor.strategies=Strat\u00E9gies -isisfish.metierSeasonInfo.toString=%1$s saison %2$s-%3$s -isisfish.metierSeasonInfoSpecies.mainSpecies=Esp\u00E8ces principales pour le m\u00E9tier -isisfish.metierSeasonInfoSpecies.selectSeason=S\u00E9lectionnez une saison -isisfish.metierSeasonInfoSpecies.selectSpecies=Choix de l'esp\u00E8ce -isisfish.metierSeasonInfoSpecies.species=Esp\u00E8ce -isisfish.metierSeasonInfoSpecies.targetFactor=Facteur cible -isisfish.metierSeasonInfoSpecies.title=Esp\u00E8ces capturables -isisfish.metierSeasonInfoZone.comments=Commentaires -isisfish.metierSeasonInfoZone.season=Saison -isisfish.metierSeasonInfoZone.selectSeason=S\u00E9lectionnez une saison -isisfish.metierSeasonInfoZone.title=Saison / Zones -isisfish.misc.databasemigration.question=La base de donn\u00E9e est en version \: %s.\n\nUne migration en version %s est n\u00E9cessaire.\nVoulez vous migrer la base de donn\u00E9es ? -isisfish.misc.databasemigration.title=Migration de base de donn\u00E9es -isisfish.misc.nuitonmigration=IsisFish a d\u00E9tect\u00E9 l'utilisation de librairies CodeLutin dans les scripts suivants.\nVoulez vous migrer ces scripts vers les nouvelles librairies nuiton ? -isisfish.monitor.title=Moniteur de l'application -isisfish.month.april=avril -isisfish.month.august=ao\u00FBt -isisfish.month.december=d\u00E9cembre -isisfish.month.february=f\u00E9vrier -isisfish.month.january=janvier -isisfish.month.july=juillet -isisfish.month.june=juin -isisfish.month.march=mars -isisfish.month.may=mai -isisfish.month.november=novembre -isisfish.month.october=octobre -isisfish.month.september=septembre -isisfish.params.changeLogLev=Passe du niveau '%1$s' au niveau '%2$s' -isisfish.params.clearFilter=Remise \u00E0 z\u00E9ro du filtre -isisfish.params.description=Description -isisfish.params.filter=Filtrer -isisfish.params.lblLauncher=Lanceur de simulation -isisfish.params.loadOldSimulation=Charger une ancienne simulation -isisfish.params.numberYear=Nombre d'ann\u00E9es -isisfish.params.populationNumbers=Donn\u00E9es de population -isisfish.params.ruleParameters=Param\u00E8tres des r\u00E8gles -isisfish.params.sensitivityName=Nom de l'analyse de sensibilit\u00E9 -isisfish.params.simulationName=Nom de la simulation -isisfish.params.title=Param\u00E8tres -isisfish.params.toString.fishery=P\u00EAcherie\: %1$s\n\n -isisfish.params.toString.lib.logger.level=niveau du logger de librairies \: %1$s -isisfish.params.toString.number.years=Nombre d'ann\u00E9es \: %1$s\n\n -isisfish.params.toString.plan=Plan\: %1$s -isisfish.params.toString.plan.number=Num\u00E9ro de s\u00E9quence dans le plan \: %1$s\n\n -isisfish.params.toString.populations=Populations \: -isisfish.params.toString.rule=R\u00E8gle\: %1$s -isisfish.params.toString.script.logger.level=niveau du logger de scripts \: %1$s -isisfish.params.toString.script.presimulation=Script de presimulation -isisfish.params.toString.simul.logger.level=niveau du logger de simulateur \: %1$s -isisfish.params.toString.simulation.done=Simulation r\u00E9alis\u00E9e avec \: %1$s -isisfish.params.toString.strategies=Strat\u00E9gies d'exploitation \: -isisfish.params.useAnalysePlan=Utiliser le plan de simulation -isisfish.params.usePreSimulationScript=Utiliser un script de pr\u00E9-simulation -isisfish.population.capturability=Capturabilit\u0E009e -isisfish.population.comments=Commentaires -isisfish.population.group=Groupe -isisfish.population.groups=Groupes -isisfish.population.mappingZoneReproZoneRecru=MappingZoneReproZoneRecru -isisfish.population.matrixAbundance=Matrice d'abondance -isisfish.population.matrixAbundance1D=matrixAbundance1D -isisfish.population.recruitment=Recrutement -isisfish.population.reproduction=Reproduction -isisfish.population.season=Saison -isisfish.population.zones=Zones -isisfish.populationBasics.confirmCreateGroups=Attention, la re-cr\u00E9ation des groupes supprimera les groupes existants et tous les objets qui en d\u00E9pendent.\n\u00CAtes vous sur de vouloir re-cr\u00E9er les groupes ? -isisfish.populationBasics.geographicID=Identifiant g\u00E9ographique -isisfish.populationBasics.growth=Croissance -isisfish.populationBasics.growthReverse=Croissance inverse -isisfish.populationBasics.maturityGroup=Groupe de maturit\u00E9 -isisfish.populationBasics.name=Nom -isisfish.populationBasics.numberGroup=Nombre de groupes -isisfish.populationBasics.plusGroup=Groupe plus -isisfish.populationBasics.recreateClasses=Reconstruire les groupes -isisfish.populationBasics.title=Saisie des populations -isisfish.populationCapturability.comments=Commentaires -isisfish.populationCapturability.selectCoefficient=S\u00E9lectionnez un coefficient par saison et par classe -isisfish.populationCapturability.title=Saisie de la capturabilit\u00E9 -isisfish.populationEquation.meanWeight=Poids moyen -isisfish.populationEquation.naturalDeathRate=Taux de mortalit\u00E9 naturelle -isisfish.populationEquation.price=Prix -isisfish.populationEquation.title=Saisie des \u00E9quations -isisfish.populationGroup.age=Age -isisfish.populationGroup.comments=Commentaires -isisfish.populationGroup.length=Longueur -isisfish.populationGroup.maximumLength=Longueur maximale -isisfish.populationGroup.meanWeigth=Poids principal -isisfish.populationGroup.minimumLength=Longueur minimale -isisfish.populationGroup.naturalDeathRate=Taux de mortalit\u00E9 naturelle -isisfish.populationGroup.price=Prix -isisfish.populationGroup.reproductionRate=Taux de reproduction -isisfish.populationGroup.title=Saisie des groupes de population -isisfish.populationGroup.toString=%1$s Groupe %2$s -isisfish.populationMigration.comments=Commentaires -isisfish.populationMigration.selectSeason=S\u00E9lectionnez une saison -isisfish.populationMigration.title=Migration -isisfish.populationMigration.useEquation=Utiliser l'\u00E9quation -isisfish.populationMigrationEmigration.coefficient=Coefficient -isisfish.populationMigrationEmigration.departureZone=Zone de d\u00E9part -isisfish.populationMigrationEmigration.title=Emmigration -isisfish.populationMigrationImmigration.arrivalZone=Zone d'arriv\u00E9e -isisfish.populationMigrationImmigration.coefficient=Coefficient -isisfish.populationMigrationImmigration.title=Immigration -isisfish.populationMigrationMigration.arrivalZone=Zone d'arriv\u00E9e -isisfish.populationMigrationMigration.coefficient=Coefficient -isisfish.populationMigrationMigration.departureZone=Zone de d\u00E9part -isisfish.populationMigrationMigration.title=Migration de population -isisfish.populationRecruitment.comments=Commentaires -isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Nombre de mois entre ponte et recrutement -isisfish.populationRecruitment.recruitmentDistribution=Distribution du recrutement -isisfish.populationRecruitment.reproductionEquation=Equation de reproduction -isisfish.populationRecruitment.title=Saisie des reproductions -isisfish.populationSeasonInfo.arrival=Arriv\u00E9e -isisfish.populationSeasonInfo.departure=D\u00E9part -isisfish.populationSeasonInfo.distributionSpawing=Distribution de la reproduction -isisfish.populationSeasonInfo.emigration=Emigration -isisfish.populationSeasonInfo.group=Groupe -isisfish.populationSeasonInfo.immigration=Immigration -isisfish.populationSeasonInfo.migration=Migration -isisfish.populationSeasonInfo.months=Mois -isisfish.populationSeasonInfo.toString=%1$s saison %2$s-%3$s -isisfish.populationSeasons.Reproduction=Reproduction -isisfish.populationSeasons.changeGroup=Changement de groupe -isisfish.populationSeasons.comments=Commentaires -isisfish.populationSeasons.computeCoefficient=Calculer le coefficient -isisfish.populationSeasons.distributionSpawning=Distribution de la reproduction -isisfish.populationSeasons.noSpacialized=Non spatialis\u00E9 -isisfish.populationSeasons.selectSeason=S\u00E9lectionnez une saison -isisfish.populationSeasons.showSpacialized=Voir les coefficients spatialis\u00E9s -isisfish.populationSeasons.spacialized=spatialis\u00E9 -isisfish.populationSeasons.spacialized.visualisation=Coefficients spatialis\u00E9s -isisfish.populationSeasons.title=Saisons -isisfish.populationZones.betweenSpawningRecruitmentAreas=Correspondance entre les zones de reproduction et de recrutement -isisfish.populationZones.selectPopulationAreas=S\u00E9lectionnez les zones des populations -isisfish.populationZones.selectRecruitmentAreas=S\u00E9lectionnez les zones de recrutement -isisfish.populationZones.selectSpawningAreas=S\u00E9lectionnez les zones de reproduction -isisfish.populationZones.title=Zones -isisfish.port.cell=Maille du port -isisfish.port.comments=Commentaires -isisfish.port.name=Nom -isisfish.preScript.backParameter=Retour aux param\u00E8tres -isisfish.preScript.title=Script de pr\u00E9-simulation -isisfish.queue.clearDone=Retirer les simulations termin\u00E9es -isisfish.queue.id=Identifiant -isisfish.queue.launcher=Lanceur de simulation -isisfish.queue.masterplan=Plan de simulation -isisfish.queue.notstarted=Non d\u00E9marr\u00E9 -isisfish.queue.plan=Plan -isisfish.queue.progression=Progression -isisfish.queue.restartSimulation=Red\u00E9marrer -isisfish.queue.showLog=Voir les logs de la simulation -isisfish.queue.simulationLaunch=Lanceur de la queue des simulations -isisfish.queue.status=\u00C9tat -isisfish.queue.stopSimulation=Arr\u00EAter la simulation -isisfish.queue.title=Queue -isisfish.result.abundance=Abondance -isisfish.result.add=Ajouter un r\u00E9sultat -isisfish.result.begin.simulation=En d\u00E9but de simulation \: -isisfish.result.capture=Capturer -isisfish.result.capture.metier=Capturer par m\u00E9tier -isisfish.result.choose.simulation=Choisir une simulation -isisfish.result.datas=Donn\u00E9es -isisfish.result.dimension=Dimension -isisfish.result.end.simulation=En fin de Simulation\: -isisfish.result.export=Export -isisfish.result.export.file=Exporter un fichier texte -isisfish.result.file=Fichier -isisfish.result.graph=Graphe -isisfish.result.map=Carte -isisfish.result.new.window=Ouvrir une nouvelle fen\u00EAtre -isisfish.result.quit=Quitter -isisfish.result.reject.metier=Rejet par metier -isisfish.result.remove.simulation=Supprimer Simulation -isisfish.result.show.simulation.log=Voir les logs -isisfish.result.statusBar=\ -isisfish.result.stress.metier=Effort par metier -isisfish.result.summary=R\u00E9sum\u00E9 -isisfish.result.title=R\u00E9sultat -isisfish.result.unload.metier=Debarquement par metier -isisfish.resultChoice.save=R\u00E9sultats \u00E0 sauvegarder -isisfish.resultChoice.saved=R\u00E9sultats sauvegard\u00E9 -isisfish.resultChoice.title=Choix de r\u00E9sultats -isisfish.script.check=V\u00E9rifier -isisfish.script.check.tooltip=V\u00E9rifie la synthaxe du script -isisfish.script.commit=Commit -isisfish.script.commit.tooltip=Committer le script sur le serveur SVN -isisfish.script.compilation.failed=%s -isisfish.script.compilation.ok=Compilation r\u00E9ussie.\n--------------------\n\n%s -isisfish.script.copy=Copier -isisfish.script.copy.tooltip=Copier la s\u00E9lection courante (Ctrl-c) -isisfish.script.cut=Couper -isisfish.script.cut.tooltip=Couper la s\u00E9lection courante (Ctrl-x) -isisfish.script.evaluate=\u00C9valuer -isisfish.script.evaluate.tooltip=Lance le script (doit contenir une methode main() pour fonctionner) -isisfish.script.export=Exporter -isisfish.script.export.checkAll=Tout (d\u00E9-)s\u00E9lectionner -isisfish.script.export.chooseDir=... -isisfish.script.export.tooltip=Exporter les scripts s\u00E9lectionn\u00E9s vers une archive zip -isisfish.script.export.tooltip.checkAll=(D\u00E9-)S\u00E9lectionner tous les scripts \u00E0 exporter -isisfish.script.export.tooltip.chooseDir=Choisir le r\u00E9pertoire o\u00F9 exporter les scripts -isisfish.script.import=Importer des scripts depuis une archive zip -isisfish.script.import.cancel=Annuler -isisfish.script.import.checkAll=Tout (d\u00E9-)s\u00E9lectionner -isisfish.script.import.import=Importer -isisfish.script.import.labelAdd=Le(s) fichier(s) suivant(s) sera(ont) ajout\u00E9(s), Confirmer l'ajout -isisfish.script.import.labelOverwrite=Le(s) fichier(s) suivant(s) existe(nt) d\u00E9j\u00E0, Confirmer pour l'\u00E9crasement -isisfish.script.import.tooltip.checkAll=(D\u00E9-)S\u00E9lectionner tous les scripts \u00E0 importer -isisfish.script.javadoc.ok=Javadoc g\u00E9n\u00E9r\u00E9e avec succ\u00E8s\n---------------------------\n\n%s -isisfish.script.menu.checkSyntax=V\u00E9rifier la syntaxe -isisfish.script.menu.code=Code -isisfish.script.menu.commit=Commiter des scripts sur le serveur -isisfish.script.menu.copy=Copier -isisfish.script.menu.cut=Couper -isisfish.script.menu.deleteLocaly=Supprimer localement -isisfish.script.menu.deleteLocalyServer=Supprimer localement et sur le serveur -isisfish.script.menu.diff=Voir les diff\u00E9rences avec la version du serveur -isisfish.script.menu.edit=\u00C9dition -isisfish.script.menu.evaluate=Evaluer -isisfish.script.menu.file=Fichier -isisfish.script.menu.javadocgenerate=G\u00E9n\u00E9rer la javadoc -isisfish.script.menu.javadocgenerated=Javadoc g\u00E9n\u00E9r\u00E9e dans %s -isisfish.script.menu.javadocgenerating=Javadoc en cours de g\u00E9n\u00E9ration dans %s... -isisfish.script.menu.javadocshow=Afficher la javadoc -isisfish.script.menu.new=Nouveau -isisfish.script.menu.paste=Coller -isisfish.script.menu.save=Sauver -isisfish.script.menu.txtExport=Exporter -isisfish.script.menu.txtImport=Importer -isisfish.script.menu.txtNewAnalysePlan=Nouveau plan d'analyse -isisfish.script.menu.txtNewEquationModel=Nouvelle formule -isisfish.script.menu.txtNewExport=Nouveau script d'export -isisfish.script.menu.txtNewRule=Nouvelle r\u00E8gle -isisfish.script.menu.txtNewScript=Nouveau script -isisfish.script.menu.txtNewSensitivity=Nouveau calculateur de sensibilit\u00E9 -isisfish.script.menu.txtNewSensitivityExport=Nouvel export de sensibilit\u00E9 -isisfish.script.menu.txtNewSimulator=Nouveau simulateur -isisfish.script.menu.txtVCS=Serveur -isisfish.script.menu.update=Synchronisation -isisfish.script.new=Nouveau -isisfish.script.new.tooltip=Cr\u00E9e un nouveau script -isisfish.script.paste=Coller -isisfish.script.paste.tooltip=Colle la s\u00E9lection courante (Ctrl-v) -isisfish.script.save=Sauver -isisfish.script.save.tooltip=Sauve le script -isisfish.script.title=Editeur de scripts -isisfish.season.toString=saison %1$s-%2$s -isisfish.selectivity.equation=Equation -isisfish.selectivity.selectPopulation=S\u00E9lectionnez une population -isisfish.selectivity.title=S\u00E9lectivit\u00E9 -isisfish.sens.backParameter=Retour aux param\u00E8tres -isisfish.sens.title=Plan de simulation -isisfish.sensitivity.coefficient=Coefficient (en %) -isisfish.sensitivity.comment=Commentaires -isisfish.sensitivity.continue=Facteur continu -isisfish.sensitivity.discret=Facteur discret -isisfish.sensitivity.displaysecondpass=Afficher les r\u00E9sultats -isisfish.sensitivity.equation.variable.action=Action -isisfish.sensitivity.equation.variable.coefficient=Coef (en %) -isisfish.sensitivity.equation.variable.name=Nom -isisfish.sensitivity.equation.variable.operator=Op\u00E9rateur -isisfish.sensitivity.equation.variable.value=Valeur -isisfish.sensitivity.export=Export -isisfish.sensitivity.factor=Facteur -isisfish.sensitivity.factors=Facteurs -isisfish.sensitivity.firstValue=Premi\u00E8re valeur -isisfish.sensitivity.increment=Cardinalit\u00E9 -isisfish.sensitivity.lastValue=Derni\u00E8re valeur -isisfish.sensitivity.name=Nom du facteur -isisfish.sensitivity.operator=Op\u00E9rateur -isisfish.sensitivity.secondpass=Analyse des r\u00E9sultats -isisfish.sensitivity.secondpass.title=Analyse des r\u00E9sultats -isisfish.sensitivity.select=M\u00E9thode -isisfish.sensitivity.selectDiscretNumber=Nombre de facteurs -isisfish.sensitivity.title=Analyse de sensibilit\u00E9 -isisfish.sensitivity.validDiscretNumber=Valider -isisfish.sensitivity.value=Valeur -isisfish.sensitivityChooser.title=M\u00E9thode de la sensibilit\u00E9 -isisfish.server.ssh.generateKey.title=G\u00E9n\u00E9rer une cl\u00E9 SSH -isisfish.setOfVessels.comments=Commentaires -isisfish.setOfVessels.fixedCosts=Co\u00FBts fixes -isisfish.setOfVessels.name=Nom -isisfish.setOfVessels.numberOfVessels=Nombre de navires -isisfish.setOfVessels.technicalEfficiency=\u00C9fficacit\u00E9 technique -isisfish.setOfVessels.title=Caract\u00E9ristiques -isisfish.setOfVessels.vesselType=Type de navire -isisfish.simpleResult.more.information=Cliquer sur une cellule pour plus d'informations... -isisfish.simulation.log.console.title=Console de log simulation '%1$s' -isisfish.simulation.log.showConsole=affichage de la console de log pour la simulation %1$s -isisfish.simulation.menu.import=Restaurer les param\u00E8tres d'une simulation -isisfish.simulation.menu.save=Sauver les param\u00E8tres de la simulation -isisfish.simulation.menu.simulation=Simulation -isisfish.simulation.name=Nom de la simulation -isisfish.simulation.remote.message.connection=Connexion \u00E0 Caparmor -isisfish.simulation.remote.message.deletingfiles=Suppression des fichiers de simulation -isisfish.simulation.remote.message.downloadresults=T\u00E9l\u00E9chargement des r\u00E9sultats -isisfish.simulation.remote.message.upload=Upload de la simulation -isisfish.simulation.remote.message.waitingstart=Attente du d\u00E9marrage de la simulation -isisfish.simulation.restarting=Red\u00E9marrage... -isisfish.simulation.title=Lanceur de simulation -isisfish.simulator.launcher.inprocess=dans le m\u00EAme processus -isisfish.simulator.launcher.remote=sur le serveur Caparmor -isisfish.simulator.launcher.subprocess=dans un sous processus -isisfish.simulator.simulaction.badid=Impossible de lancer la simulation '%s' \: l'identifiant existe d\u00E9j\u00E0 \! -isisfish.simulator.ssh.configuration.connecting=Connexion en cours -isisfish.simulator.ssh.configuration.connectingpk=Connexion en cours (avec cl\u00E9 publique) -isisfish.simulator.ssh.configuration.connection=Information de connexion -isisfish.simulator.ssh.configuration.connectionerror=Connexion impossible (%s) -isisfish.simulator.ssh.configuration.connectionok=Connect\u00E9 avec succ\u00E8s -isisfish.simulator.ssh.configuration.environment=Configuration sur Caparmor -isisfish.simulator.ssh.configuration.freespace=Espace disque utilis\u00E9 \: -isisfish.simulator.ssh.configuration.freespace.confirmdelete=Attention, la suppression du dossier '%s' est irr\u00E9versible.\nConfirmez-vous la suppression de son contenu ? -isisfish.simulator.ssh.configuration.freespace.label=Taille de %s \: %s -isisfish.simulator.ssh.configuration.invalidpassphrase=Passphrase invalide -isisfish.simulator.ssh.configuration.keygenerate=G\u00E9n\u00E9rer -isisfish.simulator.ssh.configuration.status=Statut -isisfish.simulator.ssh.configuration.test=Tester la configuration -isisfish.simulator.ssh.configuration.title=Configuration du lanceur Caparmor -isisfish.simulator.subprocess.readoutput.error= -isisfish.species.age=Age -isisfish.species.cee=CEE -isisfish.species.comments=Commentaires -isisfish.species.length=Longueur -isisfish.species.name=Nom des esp\u00E8ces -isisfish.species.rubbinCode=Code Rubbin -isisfish.species.scientificName=Nom scientifique -isisfish.species.structured=Structur\u00E9 -isisfish.ssh.askpassphrase.message=Entrez la passphrase pour la cl\u00E9 '%s' \: -isisfish.ssh.askpassphrase.title=D\u00E9verrouillage de cl\u00E9 SSH -isisfish.ssh.askpassphrase.wrongpassphrase=Mauvaise cl\u00E9, entrez une nouvelle passphrase '%s' \: -isisfish.strategy.comments=Commentaires -isisfish.strategy.inactivity=Equation d'inactivit\u00E9 -isisfish.strategy.inactivityEquationUsed=Utiliser une \u00E9quation d'inactivit\u00E9 -isisfish.strategy.name=Nom -isisfish.strategy.proportionSetOfVessels=Proportion de la flottille -isisfish.strategy.title=Caract\u00E9ristiques -isisfish.strategyMonthInfo.metier=M\u00E9tier -isisfish.strategyMonthInfo.minInactivityDays=Jour minimums d'inactivit\u00E9 -isisfish.strategyMonthInfo.numberOfTrips=Nombre de trajets -isisfish.strategyMonthInfo.proportion=Proportion -isisfish.strategyMonthInfo.title=Saisie des mois -isisfish.strategyMonthInfo.toString=%1$s %2$s -isisfish.timeUnit.day=Jour -isisfish.timeUnit.hours=Heures -isisfish.tray.simulation=Isis-fish - %1$s \: %2$s/%3$s -isisfish.tray.simulation.multi=Isis-fish - %s / %s -isisfish.tray.simulation.no=Isis-fish - Pas de simulation -isisfish.tripType.comments=Commentaires -isisfish.tripType.duration=Dur\u00E9e -isisfish.tripType.minTime=Temps minimal entre deux voyages -isisfish.tripType.name=Nom -isisfish.vcs.ask.passphrase=Entrez votre passphrase (si votre clef ssh en contient une). -isisfish.vcs.ask.passphrase.title=Demande de passe phrase -isisfish.vcs.commit=Message de sauvegarde -isisfish.vcs.commit.cancel=annuler -isisfish.vcs.commit.label=Entrer quelques mots concernant la modification des scripts -isisfish.vcs.commit.ok=confirmer -isisfish.vcs.factory.cantinstanciate=Can't instanciate wanted VCS (%s), use default -isisfish.vcs.howto.save.key=Comment enregister sa clef publique ssh aupr\u00E8s du labs -isisfish.vcs.init.notfoundcantdownload=La base de donn\u00E9es pour la version %s n'a ni pu \u00EAtre trouv\u00E9e, ni t\u00E9l\u00E9charg\u00E9e.\nVous devez la t\u00E9l\u00E9charger manullement \u00E0 partir du site d'Isis-Fish. -isisfish.vcs.init.wrongprotocol=Votre base de donn\u00E9es locale \: %s n'utilise pas un protocole correct.\nVoulez-vous faire une sauvegarde de cette base et r\u00E9cup\u00E9rer une meilleure version ? -isisfish.vcs.save.key=Acc\u00E9der au labs pour enregister votre clef publique ssh -isisfish.vcs.switchprotocol.confirm=Le protocole d'acc\u00E8s au d\u00E9p\u00F4t des scripts a chang\u00E9.\nVoulez-vous changer vers le nouveau d\u00E9p\u00F4t ? -isisfish.vcs.switchtag.warningconflict=Votre base de donn\u00E9es a \u00E9t\u00E9 mise \u00E0 jour mais les fichiers suivants sont en conflit, merci de les v\u00E9rifier \: -isisfish.vcs.switchversion.confirm=Vous n'utilisez pas le d\u00E9p\u00F4t correct pour votre version d'Isis-Fish \: %s.\nVoulez-vous changer de d\u00E9p\u00F4t ? -isisfish.vcs.update=R\u00E9sultats de la synchronisation avec le serveur -isisfish.vcs.update.cancel=annuler -isisfish.vcs.update.checkAll=(de)-select tout -isisfish.vcs.update.local=Systeme local -isisfish.vcs.update.local.modified=Fichiers modifi\u00E9s -isisfish.vcs.update.local.outofdateAndModified=Fichiers localement modifi\u00E9s en conflit avec le serveur -isisfish.vcs.update.local.tooltip.modified=Fichiers localement modifi\u00E9s \n(confirmer pour revenir \u00E0 la version avant modification ou soum\u00EAtre au serveur) -isisfish.vcs.update.local.tooltip.outofdateAndModified=Fichiers localement modifi\u00E9s mais ayant une version plus r\u00E9cente sur le serveur\n (confirmer pour revenir \u00E0 la version avant modification ou r\u00E9cup\u00E9rer la nouvelle version du serveur) -isisfish.vcs.update.local.tooltip.unversionned=Fichiers uniquement pr\u00E9sents sur votre systeme \n(confirmer pour les enregister sur le serveur) -isisfish.vcs.update.local.unversionned=Nouveaux fichiers -isisfish.vcs.update.ok=continuer -isisfish.vcs.update.remote=Serveur distant -isisfish.vcs.update.remote.missing=Nouveaux fichiers -isisfish.vcs.update.remote.outofdate=Fichiers plus r\u00E9cents sur le serveur -isisfish.vcs.update.remote.tooltip.missing=Nouveaux fichiers uniquement pr\u00E9sents sur le serveur \n(confirmer pour les r\u00E9cup\u00E9rer) -isisfish.vcs.update.remote.tooltip.outofdate=Fichiers dont il existe une version plus r\u00E9cente sur le serveur \n(confirmer pour les r\u00E9cup\u00E9rer) -isisfish.vcs.update.tooltip.checkAll=(D\u00E9-)S\u00E9lectionner tous les fichiers (\u00E0 action unique) que vous voulez traiter -isisfish.vcs.update.tooltip.local=vcs.update.tooltip.local -isisfish.vcs.update.tooltip.remote=vcs.update.tooltip.remote -isisfish.vcs.update.warningconflict=Votre base de donn\u00E9es a \u00E9t\u00E9 mise \u00E0 jour\nmais les fichiers suivants sont en conflit, merci de les v\u00E9rifier \:\n -isisfish.vcs.updateconfirm=Confirmation des ope\u00E9rations de synchronisation avec le serveur -isisfish.vcs.updateconfirm.cancel=annuler -isisfish.vcs.updateconfirm.checkAll=(de)-select tout -isisfish.vcs.updateconfirm.label=Confirmer les op\u00E9rations qui pourraient \u00E9craser vos fichiers -isisfish.vcs.updateconfirm.label2='Etes vous sur de vouloir effectuer ces op\u00E9rations ?' -isisfish.vcs.updateconfirm.ok=confirmer -isisfish.vcs.updateconfirm.tooltip.checkAll=(D\u00E9-)S\u00E9lectionner tous les scripts que vous voulez traiter -isisfish.vcs.updaterepository.confirm=Votre d\u00E9p\u00F4t des scripts n'est pas \u00E0 jour. Voulez-vous mettre \u00E0 jour les fichiers suivants ? -isisfish.vcs.vcssvn.add.error=Impossible d'ajouter un fichier -isisfish.vcs.vcssvn.add.errorreadonly=Vous ne pouver pas ajouter de fichier, ce d\u00E9p\u00F4t est en lecture seule \! -isisfish.vcs.vcssvn.checkProtocol.error=Impossible d'obtenir l'adresse correspondant au d\u00E9p\u00F4t local -isisfish.vcs.vcssvn.checkProtocol.relocate=Transfert du d\u00E9p\u00F4t %s de %s vers %s -isisfish.vcs.vcssvn.checkout.error=Impossible de mettre \u00E0 jour -isisfish.vcs.vcssvn.cleanup.error=Impossible de d\u00E9verrouiller la copie locale -isisfish.vcs.vcssvn.commit.error=Impossible de commiter -isisfish.vcs.vcssvn.commit.errorreadonly=Vous ne pouvez pas commiter, le d\u00E9p\u00F4t est en lecture seule -isisfish.vcs.vcssvn.delete.error=Impossible de supprimer des fichiers -isisfish.vcs.vcssvn.delete.errorreadonly=Vous ne pouvez pas supprimer ce fichier, le d\u00E9p\u00F4t est en lecture seule -isisfish.vcs.vcssvn.diff.error=Impossible d'obtenir le diff -isisfish.vcs.vcssvn.gettag.error=Erreur lors de la r\u00E9cup\u00E9ration de l'adresse du d\u00E9p\u00F4t local -isisfish.vcs.vcssvn.getupdate.error=Impossible d'obtenir le statut des fichiers -isisfish.vcs.vcssvn.global.filelocalandremotestatus=Le statut du fichier %s est (l\:%s/d\:%s) -isisfish.vcs.vcssvn.global.filestatus=Le statut de %s est %s -isisfish.vcs.vcssvn.global.foundUpdatedFile=Ajout de %s comme fichier mis \u00E0 jour -isisfish.vcs.vcssvn.global.torevision=\u00C0 la r\u00E9vision \: %d -isisfish.vcs.vcssvn.isconnected.switchoff=Impossible de se connecter au serveur, passage en mode d\u00E9connect\u00E9 \: %s -isisfish.vcs.vcssvn.isconnected.switchto=Connexion au serveur disponible, passage en mode connect\u00E9 \: %s -isisfish.vcs.vcssvn.isonremote.error=Le fichier %s n'est pas sur le serveur -isisfish.vcs.vcssvn.istag.notexist=Le tag %s n'existe pas -isisfish.vcs.vcssvn.isuptodate.error=Impossible d'obtenir le statut de fichier -isisfish.vcs.vcssvn.list.error=Impossible de lister -isisfish.vcs.vcssvn.localstatus.error=Impossible d'obtenir le statut local de fichier -isisfish.vcs.vcssvn.remotestatus.error=Impossible d'obtenir le statut distant de fichier -isisfish.vcs.vcssvn.setTag.error=Erreur lors de la r\u00E9cup\u00E9ration de l'adresse du d\u00E9p\u00F4t local -isisfish.vcs.vcssvn.settag.switchfromto=Switch du tag du d\u00E9p\u00F4t de %s \u00E0 %s -isisfish.vcs.vcssvn.update.error=Impossible de mettre \u00E0 jour -isisfish.vcs.vcssvn.update.notinlocal=Impossible de mettre \u00E0 jour des fichiers qui ne sont pas pas dans le d\u00E9p\u00F4t -isisfish.versionStorage.removed=Supprim\u00E9 -isisfish.vesselType.activityRange=Intervalle d'activit\u00E9 -isisfish.vesselType.comments=Commentaires -isisfish.vesselType.fuelCost=Co\u00FBt d'un trajet en fuel -isisfish.vesselType.length=Longueur -isisfish.vesselType.maxDuration=Dur\u00E9e maximale du trajet -isisfish.vesselType.miniCrew=Taille minimale d'\u00E9quipage -isisfish.vesselType.name=Nom -isisfish.vesselType.speed=Vitesse -isisfish.welcome.menu.about=\u00C0 propos -isisfish.welcome.menu.api=API -isisfish.welcome.menu.close=Fermer -isisfish.welcome.menu.configuration=Configuration -isisfish.welcome.menu.configuration.sshlauncher=Configuration Caparmor -isisfish.welcome.menu.configuration.vcs=Configuration vcs -isisfish.welcome.menu.file=Fichier -isisfish.welcome.menu.frame=Fen\u00EAtre -isisfish.welcome.menu.help=Aide -isisfish.welcome.menu.help.isisfish=Site d'Isis-Fish -isisfish.welcome.menu.help.isisfishapi=API Isis-Fish -isisfish.welcome.menu.help.javaapi=API Java -isisfish.welcome.menu.help.matrixapi=API NuitonMatrix -isisfish.welcome.menu.help.topiaapi=API ToPIA -isisfish.welcome.menu.input=Saisie -isisfish.welcome.menu.monitor=Fen\u00EAtre de logs -isisfish.welcome.menu.queue=Liste des simulations -isisfish.welcome.menu.result=R\u00E9sultat -isisfish.welcome.menu.script=Script -isisfish.welcome.menu.simulation=Lanceur de simulations -isisfish.welcome.menu.synchro=Synchronisation Serveur -isisfish.welcome.title=Simulation Ifremer -isisfish.wizardGroupCreation.allGroupsSameSize=Tous les groupes ont la m\u00EAme taille -isisfish.wizardGroupCreation.allValues=Entrer toutes les valeurs -isisfish.wizardGroupCreation.computedGrowthCurve=Calcul\u00E9 par une courbe de croissance -isisfish.wizardGroupCreation.firstAge=Premier age -isisfish.wizardGroupCreation.firstAgeHelp=Premier age \= age minimal -isisfish.wizardGroupCreation.firstGroup=Premier groupe -isisfish.wizardGroupCreation.firstLength=Taille min premi\u00E8re classe -isisfish.wizardGroupCreation.firstLengthHelp=Taille min premi\u00E8re classe \= taille minimale du premier groupe -isisfish.wizardGroupCreation.gapBetweenGroupsHelp=L'interval entre chaque groupe est de 1 an -isisfish.wizardGroupCreation.groupWidth=Longueur du groupe -isisfish.wizardGroupCreation.groupWidthHelp=Longueur du groupe \= Longueur du groupe -isisfish.wizardGroupCreation.lastAge=Dernier age -isisfish.wizardGroupCreation.lastAgeHelp=Dernier age \= age maximal -isisfish.wizardGroupCreation.maxGroupsLength=Taille maximale de groupes -isisfish.wizardGroupCreation.maxGroupsLengthHelp=Un point-virgule ';' doit s\u00E9parer les tailles maximales de chaque groupe -isisfish.wizardGroupCreation.numberGroup=Nombre de groupe -isisfish.wizardGroupCreation.numberGroupHelp=Nombre de groupe \= Nombre de groupe voulu -isisfish.wizardGroupCreation.numberGroups=Nombre de groupes -isisfish.wizardGroupCreation.populationCharacteristics=Entrez les caract\u00E9ristiques de la population -isisfish.wizardGroupCreation.selectGroupLengthType=Choisir la longueur du groupe -isisfish.wizardGroupCreation.timeStep=Pas de temps (en mois) -isisfish.wizardGroupCreation.title=Cr\u00E9ation du groupe -isisfish.wizardGroupCreation.undefinedGrowthEquation=L'\u00E9quation utilis\u00E9e est la courbe de croissance de la population. Elle doit \u00EAtre pr\u00E9alablement d\u00E9finie. -isisfish.zone.cells=Cellules de la zone -isisfish.zone.comments=Commentaires -isisfish.zone.name=Nom -region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= -simulate\ %s\ with\ file\ %s= Copied: isis-fish/trunk/src/main/resources/i18n/isis-fish_en_GB.properties (from rev 3392, isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties) =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish_en_GB.properties (rev 0) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish_en_GB.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,1100 @@ += +Add\ to\ default\ queue= +Analyse\ plan\ error,\ too\ many\ simulation\ for\ %s\ \:\ %s= +Can't\ add\ result\ '%1$s'\ at\ date\ %2$s=Can't add result '%1$s' at date %2$s +Can't\ add\ simulation\:\ %s= +Can't\ create\ simulation\ logger=Can't create simulation logger +Can't\ delete\ simulation\ %s\ = +Can't\ do\ post\ action\ %s= +Can't\ do\ simulation\ %s= +Can't\ download\ archive\ \:\ %s= +Can't\ download\ file= +Can't\ evaluate\ simulation\ prescript= +Can't\ export\ simulation\ %s= +Can't\ get\ changlog= +Can't\ get\ result\:\ %1$s=Can't get result\: %1$s +Can't\ instanciate\ export\ %1$s=Can't instanciate export %1$s +Can't\ instantiate\ %s= +Can't\ open\ log\ for\ %s= +Can't\ read\ ssh\ key\ \:\ %s= +Can't\ simulate\ %s= +Check\ state\ of\ local\ repository\:\ %s= +Command\ '%s'\ fail\ to\ execute= +Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s= +Error\ during\ vcs\ initialisation= +Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys= +Generate\ next\ simulation= +Import\ one\ java\ file\ script\ source= +Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s= +Import\ zipped\ file\ containing\ all\ scripts\ directory\ structure= +Info=Info +Jobs\ submited\ is\ not\ ItemSimulation\ but\ was\ %s= +Last\ entry\ was\ %s\ extract\ name\ %s= +Launcher\ %s\ will\ be\ stopped\ because\ there\ are\ too\ many\ error\ (%s)= +Local\ repository\ don't\ exist= +Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s= +Normal\ stop\ thread,\ this\ is\ not\ an\ error= +Not\ start\ simulation\ %s\ because\ user\ ask\ stop= +Process\ template\ error= +Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import= +Region\ %s\ already\ inited= +Remote\ control\ file\ doesn't\ exists\ %s= +Remote\ information\ file\ doesn't\ exists\ %s= +Rename\ data\ directory\ to\ %s= +Show\ help= +Show\ version= +SimulationExecutor\ started\ with\ %s\ thread\ for\ %s= +Skip\ data\ migration\ (disabled)= +Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to= +Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s= +SubProcess\ start\:\ %s\ %s= +Switch\ repository\ type\ to\ none= +Try\ to\ log\ on\ %s@%s\:%d= +Use\ branches,\ switch\ not\ needed= +User\ restart\ simulation\ %s= +User\ stop\ simulation\ %s= +could\ not\ close\ reader\ %1$s=could not close reader %1$s +could\ not\ found\ %s= +could\ not\ found\ log\ file\ %1$s=could not found log file %1$s +could\ not\ found\ region\ %s= +could\ not\ found\ simulation\ %s= +could\ not\ read\ at\ offset\ %1$s\ for\ reason\ %2$s=could not read at offset %1$s for reason %2$s +destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= +destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= +directory\ %s\ must\ be\ a\ directory= +filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. +isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Please, report any bug you can found.<html> +isisfish.about.licensetext=You can modify and redistribute the program under the conditions of the GNU General Public License (version 2 or later). A copy of the GPL is in the file "LICENSE.txt" provided with Isis-Fish. All rights reserved. No guarantees are provided for use of this program. +isisfish.about.title=About Isis-Fish... +isisfish.advancedParameters.title=Advanced parameters +isisfish.advancedParams.freeParameters=Free parameters +isisfish.advancedParams.libLevelLogger=Library log level +isisfish.advancedParams.scriptLevelLogger=Script log level +isisfish.advancedParams.simulLevelLogger=Simulator log level +isisfish.advancedParams.simulationCache=Simulation cache +isisfish.advancedParams.simulationStatistique=Simulation statistics +isisfish.advancedParams.simulatorUse=Simulator to Use +isisfish.cell.comments=Comments +isisfish.cell.land=Land +isisfish.cell.latitude=Latitude +isisfish.cell.longitude=Longitude +isisfish.cell.name=Name +isisfish.change.equation=Can't change equation +isisfish.commit.message=Enter commit message +isisfish.common.add=Add +isisfish.common.apply=Apply +isisfish.common.cancel=Cancel +isisfish.common.check=Check +isisfish.common.clear=Clear +isisfish.common.close=Close +isisfish.common.confirm=Confirm +isisfish.common.date=Date +isisfish.common.debug=debug +isisfish.common.delete=Delete +isisfish.common.duration.inhours=in hours +isisfish.common.ellipsis=... +isisfish.common.emigration=Emigration +isisfish.common.equation=Equation +isisfish.common.error=error +isisfish.common.file=File +isisfish.common.finish=Finish +isisfish.common.gear=Gear +isisfish.common.immigration=immigration +isisfish.common.info=info +isisfish.common.migration=migration +isisfish.common.module=Module +isisfish.common.month=month %1$s +isisfish.common.name=Name +isisfish.common.new=New +isisfish.common.newMatrix=New matrix +isisfish.common.next=Next +isisfish.common.ok=Ok +isisfish.common.openEditor=Open editor +isisfish.common.population=Population +isisfish.common.populationGroup=Population group +isisfish.common.populations=Populations +isisfish.common.port=Port +isisfish.common.prev=Previous +isisfish.common.region=Region +isisfish.common.remove=Remove +isisfish.common.reset=Reset +isisfish.common.save=Save +isisfish.common.saveModel=Save as model +isisfish.common.saveNextSimulation=Save for next simulation +isisfish.common.season=Season +isisfish.common.setOfVessels=Set of vessels +isisfish.common.simulate=Simulate +isisfish.common.strategies=Strategies +isisfish.common.sum=Sum +isisfish.common.tag=Tag +isisfish.common.tripType=Trip type +isisfish.common.valid=Valid +isisfish.common.value=Value +isisfish.common.warn=warn +isisfish.common.year=year +isisfish.common.zone=Zone +isisfish.config.category.communityvcs=Community VCS +isisfish.config.category.communityvcs.description=Community VCS repository +isisfish.config.category.main=Main +isisfish.config.category.main.description=Main configuration +isisfish.config.category.misc=Misc +isisfish.config.category.misc.description=Miscealenous +isisfish.config.category.officialvcs=Official VCS +isisfish.config.category.officialvcs.description=Official VCS repository +isisfish.config.category.versioning= +isisfish.config.category.versioning.description= +isisfish.config.database.lockmode.description=Database lock mode +isisfish.config.main.compileDirectory.description=Script compilation directory +isisfish.config.main.configFileName.description=Configuration filename +isisfish.config.main.defaultBackupDirectory.description=Backup directory +isisfish.config.main.defaultExportNames.description=Exports to do after simulation +isisfish.config.main.defaultMapFile.description=Default map file to use for map without custom maps +isisfish.config.main.defaultResultNames.description=Result names to manage during a simulation +isisfish.config.main.defaultSimulator.description=Default simulator to use to simulate +isisfish.config.main.defaultTagValue.description= +isisfish.config.main.encoding.description=encoding used on system +isisfish.config.main.javadocDirectory.description=Javadoc generation directory +isisfish.config.main.javadocURL.description=Javadoc url +isisfish.config.main.launchUI.description=Display user interface +isisfish.config.main.localSimulator.description=Local simulator launcher name (same process) +isisfish.config.main.locale.description=user locale +isisfish.config.main.monitoringDirectory.description=Folder containing all necessary information needed to restart simulation +isisfish.config.main.performcron.description=Perform all task registered in cron service +isisfish.config.main.performmigration.description=Perform data migration +isisfish.config.main.performvcsupdate.description=Perform vcs update +isisfish.config.main.remoteCaparmor.description=Remote simulator launcher name +isisfish.config.main.simulation.ssh.control.check.interval=Control check interval (seconds) +isisfish.config.main.simulation.ssh.control.check.interval.description=Control check interval (seconds) +isisfish.config.main.simulation.ssh.datapath=Isis-Fish database +isisfish.config.main.simulation.ssh.datapath.description=Isis-Fish database path +isisfish.config.main.simulation.ssh.isis.home=Isis-Fish home +isisfish.config.main.simulation.ssh.isis.home.description=Isis-Fish installation directory +isisfish.config.main.simulation.ssh.javapath=Java path +isisfish.config.main.simulation.ssh.javapath.description=Java location on remote server (full path or relative to $PATH, by default value is caparmor configuration) +isisfish.config.main.simulation.ssh.max.threads=SSH threads count +isisfish.config.main.simulation.ssh.max.threads.description=Number of simultaneous simulations to do through SSH. Might only be usefull for dependent analysis plans. Otherwise keep value at '1'. +isisfish.config.main.simulation.ssh.pbsbinpath=PBS executables directory +isisfish.config.main.simulation.ssh.pbsbinpath.description=PBS executables (qsub, qdel...) directory +isisfish.config.main.simulation.ssh.pbsqsuboptions=Qsub arguments +isisfish.config.main.simulation.ssh.pbsqsuboptions.description=Arguments used at qsub job sumbit. Default to '-m n' don't send mail. +isisfish.config.main.simulation.ssh.server=Simulation server +isisfish.config.main.simulation.ssh.server.description=Simulation server address +isisfish.config.main.simulation.ssh.tmppath=Server temp directory +isisfish.config.main.simulation.ssh.tmppath.description=Server temp directory +isisfish.config.main.simulation.ssh.userhome=User home directory +isisfish.config.main.simulation.ssh.userhome.description=User home directory +isisfish.config.main.simulation.ssh.username=SSH identifier +isisfish.config.main.simulation.ssh.username.description=SSH identifier +isisfish.config.main.simulationShowOnlyError.description= +isisfish.config.main.smtpServer.description=Smtp server address +isisfish.config.main.subSimulator.description=Sub process simulator launcher name +isisfish.config.main.userMail.description=User email address +isisfish.config.main.userName.description=User name +isisfish.config.ssh.key.file=SSH key +isisfish.config.ssh.key.file.description=Private SSH key path +isisfish.config.title=Preferences +isisfish.config.vcs.community.hostname.description=Community VCS host name +isisfish.config.vcs.community.password.description=Community VCS password +isisfish.config.vcs.community.protocol.description=Community VCS protocol +isisfish.config.vcs.community.remotepath.description=Community VCS remote path +isisfish.config.vcs.community.type.description=Community VCS type +isisfish.config.vcs.community.username.description=Community VCS user name +isisfish.config.vcs.hostName.description=Official VCS host name +isisfish.config.vcs.localCommunityDatabasePath.description=Community VCS local storage directory +isisfish.config.vcs.localDatabasePath.description=Official VCS local storage directory +isisfish.config.vcs.noPassPhrase.description= +isisfish.config.vcs.passphrase.description= +isisfish.config.vcs.protocol.description=Official VCS protocol +isisfish.config.vcs.remotePath.description=Official VCS remote path +isisfish.config.vcs.type.description=Official VCS type +isisfish.config.vcs.useSshConnexion.description= +isisfish.config.vcs.userName.description=Official VCS user name +isisfish.config.vcs.userPassword.description=Official VCS password +isisfish.date.toString=%1$s %2$s +isisfish.editor.parametersnameandtypes=Parameters (name and type) +isisfish.effortDescription.crewFoodCost=Crew food cost +isisfish.effortDescription.crewShareRate=Crew share rate +isisfish.effortDescription.crewSize=Crew size +isisfish.effortDescription.economicTitle=Economics parameters +isisfish.effortDescription.effortTitle=Fishing effort parameters +isisfish.effortDescription.fishingOperation=Fishing operation +isisfish.effortDescription.fishingOperationDuration=Fishing operation duration +isisfish.effortDescription.fishingOperationDuration.tooltip=In hours +isisfish.effortDescription.fixedCrewSalary=Fixed crew salary +isisfish.effortDescription.gearsNumberPerOperation=Gears number per operation +isisfish.effortDescription.landingCosts=Landing costs +isisfish.effortDescription.otherRunningCost=Other running cost +isisfish.effortDescription.parametersTitle=Metiers parameters +isisfish.effortDescription.repairAndMaintenanceGearCost=Repair and maintenance gear cost +isisfish.effortDescription.title=Practiced metier +isisfish.effortDescription.toString=EffortDescription for %1$s with %2$s +isisfish.effortDescription.unitCostOfFishing=Fishing unit cost +isisfish.equation.editor.title=Equation Editor +isisfish.error.acceptable.population=New value isn't acceptable value for this population +isisfish.error.add.logger.simulation=isisfish.error.add.logger.simulation +isisfish.error.add.tray=Can't add system tray icon +isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s +isisfish.error.change.equation=Can't change equation +isisfish.error.compile.fileerror=File %s can't be compiled \! +isisfish.error.compile.script=Can't compile script\: %1$s +isisfish.error.compiled.parameter=Can't get rule parameter from compiled class +isisfish.error.conversion.data=Erreur lors de la conversion du fichier de données +isisfish.error.create.equation=Can't create equation +isisfish.error.delete.database=Can't delete database +isisfish.error.delete.file=could not delete file %1$s +isisfish.error.delete.vcs.files=Can't delete vcs files +isisfish.error.during.simulation=Error during simulation +isisfish.error.emigration.negative=emigration negative +isisfish.error.empty.code.rubbin=rubbin's code is empty +isisfish.error.empty.emigration=emigration empty +isisfish.error.empty.id.geographic=goegraphic identifier is empty +isisfish.error.empty.immigration=immigration empty +isisfish.error.empty.migration=Migration empty +isisfish.error.empty.name=The name is empty +isisfish.error.empty.params.name=Parameter name is empty +isisfish.error.empty.population=Population is empty +isisfish.error.empty.scientific.name=scentific name is empty +isisfish.error.empty.season=info season empty +isisfish.error.empty.selectivity=selectivity is empty +isisfish.error.empty.species=specie capturable empty +isisfish.error.empty.species.name=specie's name is empty +isisfish.error.empty.unit=measure unit is empty +isisfish.error.equation.openeditor=Can't open equation editor +isisfish.error.equation.return.number=EquationImpl must return a number\: %1$s +isisfish.error.equation.savemodel=Can't save equation as model +isisfish.error.errorpane.htmlmessage=<html><b>IsisFish has handled \:</b><br />%s</b></html> +isisfish.error.errorpane.title=Error +isisfish.error.evaluate.equation=Can't evaluate equation\: %1$s +isisfish.error.evaluate.preplan.script= +isisfish.error.evalute.plan.script=Can't evaluate plan script +isisfish.error.factor.invalid= +isisfish.error.file.already.exists=The file %1$s already exist +isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population +isisfish.error.immigration.negative=immigration negative +isisfish.error.import.convertible=Erreur lors de l'import, la version du fichier que vous souhaitez importer n'est pas transformable en une version importable. +isisfish.error.import.file=Can't import file %1$s +isisfish.error.import.recent.files=Erreur lors de l'import, la version du fichier que vous souhaitez importer est plus récente que la version souhaitée. +isisfish.error.init.map=Can't init map. +isisfish.error.input.addentity=Can't add entity "%s" +isisfish.error.input.cancelentity=Can't cancel modification on entity +isisfish.error.input.createentity=Can't create entity +isisfish.error.input.removeentity=Can't remove entity "%s" +isisfish.error.input.save=Can't save modifications +isisfish.error.input.saveentity=Can't save entity +isisfish.error.input.spacializematrix= +isisfish.error.instanciate=Can't instanciate %1$s +isisfish.error.instanciate.export=Can't instanciate export %1$s +isisfish.error.invalid.costs.fix=cost are not valid +isisfish.error.invalid.distribution.recruitment=distribution de recrutement invalide +isisfish.error.invalid.equation=Invalid equation +isisfish.error.invalid.equation.name=Invalid equation name +isisfish.error.invalid.file.name=The script name %1$s is not valid. +isisfish.error.invalid.interval.reproduction.recruitment=interval entre la reproduction et le recrutement invalide +isisfish.error.invalid.mean.weight=Invalid mean weight +isisfish.error.invalid.nullequation=Equation %s doesn't exist \! +isisfish.error.invalid.number=The number is invalid +isisfish.error.invalid.range=La gamme possible n'a pas de valeur acceptable +isisfish.error.invalid.values.params=Parametre controlable hors valeurs possibles +isisfish.error.invoke.method=Can't invoke method '%1$s' for class %2$s +isisfish.error.linkageerror.message=Isis-Fish has detected a script use error.\nCompilation directory has been deleted to force recompilation.\n\nPlease, restart Isis-Fish. +isisfish.error.load.class=Can't load class\: %1$s +isisfish.error.load.classloader=Can't create ClassLoader for script, bad directory\: %1$s for reason %2$s +isisfish.error.load.file=could not load file %1$s +isisfish.error.log.closeAppender=could not close appender %1$s for category %2$s +isisfish.error.log.console.dispose=Une erreur est survenue pendant la fermeture de la console %1$s de log, raison %2$s +isisfish.error.log.createAppender=could not create appender [%1$s] \: %2$s for reason %3$s +isisfish.error.log.foundAppender=\=could not found log appender %1$s for category %2$s +isisfish.error.migration.negative=Migration negative +isisfish.error.no.matrix=No matrix for \: %s +isisfish.error.no.null.time.step=Error, the time step should not be null +isisfish.error.no.sector=No sector defined +isisfish.error.no.select.simulation=Could not select simulation +isisfish.error.no.target.species=No target species in %1$s for %2$s +isisfish.error.not.found.code=Could not found codeclass for %1$s +isisfish.error.not.found.description=Could not found description for %1$s +isisfish.error.not.found.field=Could not found field %1$s doc for %2$s +isisfish.error.not.found.field.class=Could not found field %1$s for class %2$s +isisfish.error.not.null.class.grown=Null value for grown class +isisfish.error.not.null.mean.weight=Null mean weight +isisfish.error.not.possible.metier=No metier available +isisfish.error.not.support.class=this class does not support +isisfish.error.null.semantics=Null semantics for %s +isisfish.error.number.classes.upper.zero=Error, the number of classes must be upper than 0 +isisfish.error.out.memory=Out of memory try with more memory (option -mx) +isisfish.error.overlap.season=Cette saison chevauche une autre saison +isisfish.error.parse.date=Can't parse date %1$s +isisfish.error.parse.long=Can't parse long %1$s +isisfish.error.plan.parameter=Can't get plan parameter from compiled class +isisfish.error.prepare.data=Can't prepare data +isisfish.error.prepare.information.simulation=Can't prepare information for simulation +isisfish.error.read.simulation=Can't read simulation information %1$s +isisfish.error.read.simulation.parameters=Can't read simulation parameters from file %1$s +isisfish.error.region.addmap=Can't add map in region +isisfish.error.region.already.exists=This region already exists +isisfish.error.region.cancel= +isisfish.error.region.check=Can't check region +isisfish.error.region.import=Can't import region +isisfish.error.region.new= +isisfish.error.region.removemap=Can't remove map in region +isisfish.error.region.save=Can't save modification on region +isisfish.error.remove.directory=Can't remove directory %1$s +isisfish.error.rename.region=Can't rename region to %1$s +isisfish.error.save.checkSum.compilation=Can't save checkSum to compilation\: %1$s +isisfish.error.save.script.compilation=Can't save script to compilation\: %1$s +isisfish.error.save.simulation.parameters=Can't save simulation parameters in file %1$s +isisfish.error.script.create=isisfish.error.script.create +isisfish.error.script.delete=Can't delete file %1$s for reason %2$s +isisfish.error.script.import=Can't import file for reason %1$s +isisfish.error.script.load=Can't load file %1$s for reason %2$s +isisfish.error.script.save=Can't save file %1$s for reason %2$s +isisfish.error.simulation.addanalyseplan=Can't add analyze plan +isisfish.error.simulation.getparametervalue=Can't get parameter value +isisfish.error.simulation.getresultname=Can't get result names list +isisfish.error.simulation.importparameter=Can't import simulation parameters +isisfish.error.simulation.initsimulaction=Can't init simulation +isisfish.error.simulation.launchsimulation=Can't launch simulation +isisfish.error.simulation.listoldsimulation=Can't get old simulation list +isisfish.error.simulation.listpopulation=Can't get population list +isisfish.error.simulation.liststrategies=Can't get strategies list +isisfish.error.simulation.loadoldsimulation=Can't load old simulation +isisfish.error.simulation.remote.global=Can't launch a simulation on remote server +isisfish.error.simulation.remote.wrongportvalue=Connection port value is incorrect \: %s +isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s +isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s +isisfish.error.simulation.resultXml.write=Can't write simulation result XML for reason %1$s +isisfish.error.simulation.savesimulation=Can't save simulation parameters +isisfish.error.simulation.setparametervalue=Can't set parameter value +isisfish.error.source.parameter=Can't get parameter from source +isisfish.error.strategy.order=Strategy %1$s don't have 12 StrategyMonthInfo but %2$s. Recreate them +isisfish.error.undefined.classes=No classes defined +isisfish.error.undefined.correspondence.zones.reproduction.recruitment=pas de correspondance entre les zones de reproduction et les zones de recrutement +isisfish.error.undefined.gear=The engin is not defined +isisfish.error.undefined.mesh=No mesh defined +isisfish.error.undefined.mesh.sector=No mesh defined in sector +isisfish.error.undefined.meta.population=No population defined +isisfish.error.undefined.sector=No sector defined +isisfish.error.undefined.stategy=No strategy defined +isisfish.error.undefined.stategy.months=The strategy is not defined for some mounths +isisfish.error.undefined.zone.population=No population's zone defined +isisfish.error.undefined.zone.recruitment=No recrutment's zone defined +isisfish.error.undefined.zone.reproduction=No reprodution's zone defined +isisfish.error.unsupported.equation.langage=Unsupported language '%1$s' for equation\: %2$s +isisfish.error.wait.simThread=Can't wait SimThread +isisfish.error.warning.title=Warning +isisfish.error.write.simulation=Can't write information %1$s +isisfish.export.saved=Export saved +isisfish.export.title=Results export +isisfish.filter.apply=Apply filter +isisfish.filter.cancel=Cancel +isisfish.filter.log.levelDebug=Debug +isisfish.filter.log.levelError=Error +isisfish.filter.log.levelFatal=Fatal +isisfish.filter.log.levelInfo=Info +isisfish.filter.log.levelTrace=Trace +isisfish.filter.log.levelWarn=Warn +isisfish.filter.log.tooltip.levelDebug=Debug +isisfish.filter.log.tooltip.levelError=Error +isisfish.filter.log.tooltip.levelFatal=Fatal +isisfish.filter.log.tooltip.levelInfo=Info +isisfish.filter.log.tooltip.levelTrace=Trace +isisfish.filter.log.tooltip.levelWarn=Warn +isisfish.filter.log.tooltip.message=Enter a term to search and press Enter +isisfish.filter.reset=Reset +isisfish.filter.result=Results +isisfish.filter.result.found=Results (%d/%d) +isisfish.filter.select=Select +isisfish.filter.select.simulation=Select a simulation +isisfish.filter.simulation=Filter simulations +isisfish.filter.simulation.analysePlanNumber=Analyse plan number +isisfish.filter.simulation.description=Description +isisfish.filter.simulation.local=Local +isisfish.filter.simulation.numberOfYear=Number of year +isisfish.filter.simulation.regionName=Region name +isisfish.filter.simulation.simulationEnd=Simulation end date (dd/MM/yyyy) +isisfish.filter.simulation.simulationName=Simulation name +isisfish.filter.simulation.simulationStart=Simulation start date (dd/MM/yyyy) +isisfish.filter.simulation.simulatorName=Simulator name +isisfish.filter.simulation.tooltip.analysePlanNumber=Filter on analyse number +isisfish.filter.simulation.tooltip.description=Filter on description (regex) +isisfish.filter.simulation.tooltip.local=Filter only local simulations +isisfish.filter.simulation.tooltip.numberOfYear=Filter on number of year (exact sequence) +isisfish.filter.simulation.tooltip.regionName=Filter on region name (regex) +isisfish.filter.simulation.tooltip.simulationEnd=Filter on region end date (format dd/MM/yyyy) +isisfish.filter.simulation.tooltip.simulationName=Filter on simulation name +isisfish.filter.simulation.tooltip.simulationStart=Filter on simulation start date (format dd/MM/yyyy) +isisfish.filter.simulation.tooltip.simulatorName=Filter on simulator name +isisfish.filter.simulation.tooltip.useAnalysePlan=Filter on simulations with analyse plan +isisfish.filter.simulation.tooltip.useOptimization=Filter on simulations with optimization +isisfish.filter.simulation.tooltip.usePreScript=Filter on simulations with pre-script +isisfish.filter.simulation.tooltip.useStatistic=Filter on simulations with statistic +isisfish.filter.simulation.useAnalysePlan=analyse plan +isisfish.filter.simulation.useOptimization=optimization +isisfish.filter.simulation.usePreScript=pre-script +isisfish.filter.simulation.useStatistic=statistic +isisfish.fisheryRegion.addMap=Add map +isisfish.fisheryRegion.area=Fishery area boundaries +isisfish.fisheryRegion.comments=Comments +isisfish.fisheryRegion.delMap=Delete map +isisfish.fisheryRegion.latitude=Lat. +isisfish.fisheryRegion.latitude.max=Lat. max. +isisfish.fisheryRegion.latitude.min=Lat. min. +isisfish.fisheryRegion.longitude=Long. +isisfish.fisheryRegion.longitude.max=Long. max. +isisfish.fisheryRegion.longitude.min=Long. min. +isisfish.fisheryRegion.name=Region name +isisfish.fisheryRegion.selectFile=Select a file +isisfish.fisheryRegion.spatial=Spatial resolution +isisfish.gear.comments=Comments +isisfish.gear.effortUnit=Effort Unit +isisfish.gear.name=Name +isisfish.gear.rangeValues=Range of values +isisfish.gear.standardisationFactor=Standardisation factor +isisfish.gear.technicalParameter=Technical parameter +isisfish.gear.title=Gear +isisfish.input.continueCells=Continue to cells +isisfish.input.continueGears=Continue to gears +isisfish.input.continueMetiers=Continue to metiers +isisfish.input.continuePopulations=Continue to populations +isisfish.input.continuePorts=Continue to ports +isisfish.input.continueSetOfVessels=Continue to set of vessels +isisfish.input.continueSpecies=Continue to species +isisfish.input.continueStrategies=Continue to strategies +isisfish.input.continueTripTypes=Continue to trip types +isisfish.input.continueVesselTypes=Continue to vessel types +isisfish.input.continueZones=Continue to zones +isisfish.input.map.copytoclicboard=Copy to clipboard +isisfish.input.menu.addRegion=Add region +isisfish.input.menu.commit=Commit change +isisfish.input.menu.copyRegion=Copy region +isisfish.input.menu.exportRegion=Export region +isisfish.input.menu.importRegion=Import region +isisfish.input.menu.importRegionSimulation=Import region from simulation +isisfish.input.menu.importRegionV2=Import region from v2 +isisfish.input.menu.importRenameRegion=Import region and rename +isisfish.input.menu.removeLocaly=Remove localy +isisfish.input.menu.removeLocalyRemotely=Remove localy and remotely +isisfish.input.menu.sensitivity=Mexico +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.sensitivity.export.cancel=Factor export canceled +isisfish.input.sensitivity.export.complete=Factor export complete +isisfish.input.sensitivity.export.running=Exporting factors... +isisfish.input.sensitivity.export.title=Export factors +isisfish.input.title=Fishery input +isisfish.input.tree.cells=Cells +isisfish.input.tree.gears=Gears +isisfish.input.tree.metiers=Metiers +isisfish.input.tree.populations=Populations +isisfish.input.tree.ports=Ports +isisfish.input.tree.setofvessels=Set of vessels +isisfish.input.tree.species=Species +isisfish.input.tree.strategies=Strategies +isisfish.input.tree.triptypes=Trip types +isisfish.input.tree.vesseltypes=Vessel types +isisfish.input.tree.zones=Zones +isisfish.launch.anonymous=read only +isisfish.launch.email=email +isisfish.launch.firstname=firstname +isisfish.launch.init.done=init done in %1$s. +isisfish.launch.lasstname=lasstname +isisfish.launch.server.authenticationMethod=server access +isisfish.launch.server.login=server login +isisfish.launch.server.ssh.confirm.passphrase=confirm passphrase +isisfish.launch.server.ssh.key.change=Change your ssh key +isisfish.launch.server.ssh.key.generate=Generate ssh key +isisfish.launch.server.ssh.no.passphrase=no passphrase +isisfish.launch.server.ssh.passphrase=passphrase +isisfish.launch.server.ssh.privateKeyFile=private ssh key +isisfish.launch.server.ssh.publicKeyFile=public ssh key +isisfish.launch.ssh=read-write (ssh) +isisfish.launch.stop=Stopping simulation... +isisfish.launching=after init done in %1$s. +isisfish.log.addAppender=add appender [%1$s] +isisfish.log.body=Message to add +isisfish.log.closeAppender=closing appender %1$s for category %2$s +isisfish.log.mail.failed=Can't send report by mail. Is your mail server up ? (I'm trying to contact the < %1$s > smtp server) +isisfish.log.mail.send=A report has been sent to %1$s +isisfish.log.mail.send.title=Send simulation %1$s by email +isisfish.log.mailTo=Destination adress +isisfish.log.removeAppender=remove appender [%1$s] +isisfish.log.restoreLogLevel=swap back level for logger %1$s from level %2$s to level %3$s +isisfish.log.sendAll=Send the complete simulation archive +isisfish.log.sendMail=Send by email +isisfish.log.simulation.name=IsisFish simulation %1$s +isisfish.log.swapLogLevel=swap level for logger %1$s from level %2$s to level%3$s +isisfish.log.tooltip.body=The message will be join to email +isisfish.log.tooltip.mailTo=Enter destination adress +isisfish.log.tooltip.sendAll=Send the complete simulation archive, or just the log file +isisfish.log.tooltip.sendMail=Click here to send the email with files +isisfish.message.add.objets.simulation=Add new objets simulation +isisfish.message.backup.database.finished=backup database finished +isisfish.message.backup.database.progress=backup database in progress +isisfish.message.cancel.finished=Cancel finished +isisfish.message.check.finished=Check finished +isisfish.message.check.inprogress=Checking in process... +isisfish.message.checking.cell= +isisfish.message.choose.archive=choose archive file or directory +isisfish.message.commit.cancelled=commit cancelled +isisfish.message.commit.finished=commit finished +isisfish.message.commit.region.canceled=Commit region canceled +isisfish.message.commiting.region=Commiting region %1$s ... +isisfish.message.compilation.time=Compilation time %1$ss +isisfish.message.confirm.delete.object=Do you really want delete object %1$s +isisfish.message.confirm.remove.region=Do you really want to remove the region %1$s ? +isisfish.message.confirm.remove.script=Do you want to remove script '%1$s' ? +isisfish.message.creating.region=Creating region %1$s +isisfish.message.creation.finished=Creation finished +isisfish.message.delete.canceled=delete canceled +isisfish.message.delete.entities=Delete entities +isisfish.message.delete.entity=Delete entity +isisfish.message.delete.finished=delete finished +isisfish.message.delete.object=To delete object %1$s, all next object will be deleted\n\n +isisfish.message.directory.not.exists= +isisfish.message.evaluation.finished=evaluation finished +isisfish.message.export.done=export done +isisfish.message.file.already.exists=File %s already exists, do you want overwrite it ? +isisfish.message.file.overwrite=File exists, do you want overwrite it ? +isisfish.message.import=Import %1$s +isisfish.message.import.equation.convert=Manual equation convertion +isisfish.message.import.finished=Import finished +isisfish.message.import.region.name=Enter name for imported region +isisfish.message.import.region.xml=XMLed Region +isisfish.message.import.region.zipped=Zipped Region +isisfish.message.import.scripts.file=Import scripts from a zipped archive +isisfish.message.import.scripts.file.cancelled=Import scripts cancelled +isisfish.message.import.scripts.file.done=Scripts imported +isisfish.message.import.scripts.zipped=Zipped script (*.zip) +isisfish.message.import.xml.v2.file=Import xml v2 file +isisfish.message.import.zip=Import zip file +isisfish.message.launchui.notlaunch=User interface not started +isisfish.message.load.finished=Load finished +isisfish.message.load.map=Try to load map file\: %1$s +isisfish.message.loading.old.simulation=Loading old simulation... +isisfish.message.loading.region=Loading region... +isisfish.message.name.imported.region=Enter name for imported region +isisfish.message.new.filename=Enter the name of the new file. (use only chars and _ and start with uppercase) +isisfish.message.new.formule.category=Select the equation model's category +isisfish.message.new.formule.title=New equation model +isisfish.message.new.region.name=Enter new region name +isisfish.message.old.simulation.loaded=Old simulation loaded +isisfish.message.page.modified=This page has been modified, do you want to save it ? +isisfish.message.presimulation.script.execution=Presimulation Script execution +isisfish.message.recruitment.number.month=Input the number of month of recruitment +isisfish.message.region.commited=Region commited +isisfish.message.region.loaded=Region loaded +isisfish.message.remove.canceled=Remove canceled +isisfish.message.remove.finished=Remove finished +isisfish.message.result.verif.region=Region check result +isisfish.message.save.finished=Save finished +isisfish.message.saveModel.dialog=Input equation model name +isisfish.message.saveModel.finished=Save model finished +isisfish.message.script.commit=Enter commit message for modification on %s +isisfish.message.setting.cache.aspects=Setting Cache aspects +isisfish.message.setting.trace.aspects=Setting Trace aspects +isisfish.message.simulation.ended=Simulation ended +isisfish.message.simulation.execution=Simulation execution +isisfish.message.simulation.prepare=Preparing simulation +isisfish.message.tray.disabled=SystemTray disabled +isisfish.metier.comments=Comments +isisfish.metier.name=Name +isisfish.metier.rangeValues=Range of values +isisfish.metier.title=Metier +isisfish.metierMonitor.metiers=Metiers +isisfish.metierMonitor.strategies=Strategies +isisfish.metierSeasonInfo.toString=%1$s season %2$s-%3$s +isisfish.metierSeasonInfoSpecies.mainSpecies=Main species for the metier +isisfish.metierSeasonInfoSpecies.selectSeason=Select a season +isisfish.metierSeasonInfoSpecies.selectSpecies=Select a species +isisfish.metierSeasonInfoSpecies.species=Species +isisfish.metierSeasonInfoSpecies.targetFactor=Target factor +isisfish.metierSeasonInfoSpecies.title=Catchable species +isisfish.metierSeasonInfoZone.comments=Comments +isisfish.metierSeasonInfoZone.season=Season +isisfish.metierSeasonInfoZone.selectSeason=Select a season +isisfish.metierSeasonInfoZone.title=Seasons / Zones +isisfish.misc.databasemigration.question=Database version is \: %s.\n\nA migration to version %s is needed.\nDo you want to migrate database ? +isisfish.misc.databasemigration.title=Database migration +isisfish.misc.nuitonmigration=IsisFish has detected some code based on CodeLutin libraries in following user scripts.\nDo you want to migrate those script on new nuiton libraries ? +isisfish.month.april=april +isisfish.month.august=august +isisfish.month.december=december +isisfish.month.february=february +isisfish.month.january=january +isisfish.month.july=july +isisfish.month.june=june +isisfish.month.march=march +isisfish.month.may=may +isisfish.month.november=november +isisfish.month.october=october +isisfish.month.september=september +isisfish.params.changeLogLev=Change from level '%1$s' to level '%2$s' +isisfish.params.clearFilter=Clear filter +isisfish.params.description=Description +isisfish.params.filter=Filter +isisfish.params.loadOldSimulation=Load old simulation +isisfish.params.nopopulation=No selected population +isisfish.params.numberYear=Number of year +isisfish.params.populationEffectives=%s's effectives +isisfish.params.rules=Rules +isisfish.params.rules.availables=Available rules +isisfish.params.rules.selected=Selected rules +isisfish.params.sensitivityName=Sensitivity name +isisfish.params.simulationLauncher=Simulation launcher +isisfish.params.simulationName=Simulation name +isisfish.params.stategiesAndPopulations=Strategies and populations +isisfish.params.title=Parameters +isisfish.params.toString.fishery=Fishery\: %1$s\n\n +isisfish.params.toString.lib.logger.level=Level of libraries' logger \: %1$s +isisfish.params.toString.number.years=Number of years\: %1$s\n\n +isisfish.params.toString.plan=Plan\: %1$s +isisfish.params.toString.plan.number=Analyse plan sequence number\: %1$s\n\n +isisfish.params.toString.populations=Populations \: +isisfish.params.toString.rule=Rule\: %1$s +isisfish.params.toString.script.logger.level=Level of scripts' logger \: %1$s +isisfish.params.toString.script.presimulation=Script de presimulation +isisfish.params.toString.simul.logger.level=Level of simulator's logger \: %1$s +isisfish.params.toString.simulation.done=Simulation done with \: %1$s +isisfish.params.toString.strategies=Strategies \: +isisfish.params.useAnalysePlan=Use simulation plan +isisfish.params.usePreSimulationScript=Use pre simulation script +isisfish.population.capturability=Capturability +isisfish.population.comments=Comments +isisfish.population.group=Group +isisfish.population.groups=Groups +isisfish.population.mappingZoneReproZoneRecru=MappingZoneReproZoneRecru +isisfish.population.matrixAbundance=Abundance matrix +isisfish.population.matrixAbundance1D=matrixAbundance1D +isisfish.population.recruitment=Recruitment +isisfish.population.reproduction=Reproduction +isisfish.population.season=Season +isisfish.population.zones=Zones +isisfish.populationBasics.confirmCreateGroups=Warning, running groups creation wizard will delete all existing groups and objects which depend on it.\nDo you want to re-create groups ? +isisfish.populationBasics.geographicID=Geographic identifier +isisfish.populationBasics.growth=Growth +isisfish.populationBasics.growthReverse=Reverse growth +isisfish.populationBasics.maturityGroup=Maturity group +isisfish.populationBasics.name=Name +isisfish.populationBasics.numberGroup=Number of group +isisfish.populationBasics.plusGroup=Plus group +isisfish.populationBasics.recreateClasses=Recreate classes +isisfish.populationBasics.title=Population input +isisfish.populationCapturability.comments=Comments +isisfish.populationCapturability.selectCoefficient=Select a coefficient per season and per class +isisfish.populationCapturability.title=Capturability input +isisfish.populationEquation.meanWeight=Mean weight +isisfish.populationEquation.naturalDeathRate=Natural death rate +isisfish.populationEquation.price=Price +isisfish.populationEquation.title=Equations input +isisfish.populationGroup.age=Age +isisfish.populationGroup.comments=Comments +isisfish.populationGroup.length=Length +isisfish.populationGroup.maximumLength=Maximum length +isisfish.populationGroup.meanWeigth=Mean Weigth +isisfish.populationGroup.minimumLength=Minimum length +isisfish.populationGroup.naturalDeathRate=Natural death rate +isisfish.populationGroup.price=Price +isisfish.populationGroup.reproductionRate=Reproduction rate +isisfish.populationGroup.title=Population group input +isisfish.populationGroup.toString=%1$s Group %2$s +isisfish.populationMigration.comments=Comments +isisfish.populationMigration.selectSeason=Select a season +isisfish.populationMigration.title=Migration +isisfish.populationMigration.useEquation=Use equation +isisfish.populationMigrationEmigration.coefficient=Coefficient +isisfish.populationMigrationEmigration.departureZone=Departure Zone +isisfish.populationMigrationEmigration.title=Population emigration +isisfish.populationMigrationImmigration.arrivalZone=Arrival Zone +isisfish.populationMigrationImmigration.coefficient=Coefficient +isisfish.populationMigrationImmigration.title=Population immigration +isisfish.populationMigrationMigration.arrivalZone=Arrival zone +isisfish.populationMigrationMigration.coefficient=Coefficient +isisfish.populationMigrationMigration.departureZone=Departure zone +isisfish.populationMigrationMigration.title=Population migration +isisfish.populationRecruitment.comments=Comments +isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Month gap between repro and recruitment +isisfish.populationRecruitment.recruitmentDistribution=Recruitment distribution +isisfish.populationRecruitment.reproductionEquation=Reproduction equation +isisfish.populationRecruitment.title=Recruitment input +isisfish.populationSeasonInfo.arrival=Arrival +isisfish.populationSeasonInfo.departure=Departure +isisfish.populationSeasonInfo.distributionSpawing=Distribution of spawing +isisfish.populationSeasonInfo.emigration=Emigration +isisfish.populationSeasonInfo.group=Group +isisfish.populationSeasonInfo.immigration=Immigration +isisfish.populationSeasonInfo.migration=Migration +isisfish.populationSeasonInfo.months=Months +isisfish.populationSeasonInfo.toString=%1$s season %2$s-%3$s +isisfish.populationSeasons.Reproduction=Reproduction +isisfish.populationSeasons.changeGroup=Change of group +isisfish.populationSeasons.comments=Comments +isisfish.populationSeasons.computeCoefficient=Calculate coefficient +isisfish.populationSeasons.distributionSpawning=Distribution of spawning +isisfish.populationSeasons.noSpacialized=Not spacialized +isisfish.populationSeasons.selectSeason=Select a season +isisfish.populationSeasons.showSpacialized=Show the spacialized +isisfish.populationSeasons.spacialized=Spacialized +isisfish.populationSeasons.spacialized.visualisation=Spacialized +isisfish.populationSeasons.title=Saisons +isisfish.populationZones.betweenSpawningRecruitmentAreas=Match between spawning and recruitment areas +isisfish.populationZones.selectPopulationAreas=Select the population areas +isisfish.populationZones.selectRecruitmentAreas=Select the recruitment areas +isisfish.populationZones.selectSpawningAreas=Select the spawning areas +isisfish.populationZones.title=Zones +isisfish.port.cell=Port cell +isisfish.port.comments=Comments +isisfish.port.name=Name +isisfish.preScript.backParameter=Back to parameter tab +isisfish.preScript.title=Pre simulation script +isisfish.queue.clearDone=Clear done jobs +isisfish.queue.id=Id +isisfish.queue.launcher=Simulation launcher +isisfish.queue.masterplan=Master plan +isisfish.queue.notstarted=Not started +isisfish.queue.plan=Plan +isisfish.queue.progression=Progress +isisfish.queue.restartSimulation=Restart +isisfish.queue.showLog=Show simulation log +isisfish.queue.simulationLaunch=Simulation queue launch +isisfish.queue.status=Status +isisfish.queue.stopSimulation=Stop simulation +isisfish.queue.title=Queue +isisfish.result.begin.simulation=Simulation start \: +isisfish.result.choose.simulation=Choose a Simulation +isisfish.result.end.simulation=Simuation end \: +isisfish.result.export=Export +isisfish.result.export.file=Export text file +isisfish.result.map=Map +isisfish.result.new.window=Open a new window +isisfish.result.remove.simulation=Remove simulation +isisfish.result.selectResult=Result \: +isisfish.result.show.simulation.log=Show logs +isisfish.result.summary=Summary +isisfish.result.title=Results +isisfish.resultChoice.save=Results to save +isisfish.resultChoice.saved=Results saved +isisfish.resultChoice.title=Result choice +isisfish.script.check=Check +isisfish.script.check.tooltip=Check syntax of the current script +isisfish.script.commit=Commit +isisfish.script.commit.tooltip=Commit script to SVN server +isisfish.script.compilation.failed=%s +isisfish.script.compilation.ok=Compilation complete.\n---------------------\n\n%s +isisfish.script.compilingfile=Compiling %s... +isisfish.script.copy=Copy +isisfish.script.copy.tooltip=Copy current selection (Ctrl-c) +isisfish.script.cut=Cut +isisfish.script.cut.tooltip=Cut current selection (Ctrl-x) +isisfish.script.evaluate=Evaluate +isisfish.script.evaluate.tooltip=Try to eval current script (must be have main() method) +isisfish.script.export=Export +isisfish.script.export.checkAll=(Un)Check all scripts +isisfish.script.export.chooseDir=... +isisfish.script.export.tooltip=Export selected script(s) to zip archive +isisfish.script.export.tooltip.checkAll=(Un)Check all scripts to export +isisfish.script.export.tooltip.chooseDir=Choose directory to export script to +isisfish.script.import=Import scripts from archive +isisfish.script.import.cancel=Cancel +isisfish.script.import.checkAll=(Un)Check all script to import +isisfish.script.import.import=Import +isisfish.script.import.labelAdd=Following files will be added. Confirm adding. +isisfish.script.import.labelOverwrite=Following files already exists. Confirm overridding. +isisfish.script.import.tooltip.checkAll=(Un)Check all scripts +isisfish.script.javadoc.ok=Javadoc generated-----------------\n\n%s +isisfish.script.menu.checkAllSyntax=Check all scripts +isisfish.script.menu.checkSyntax=Check syntax +isisfish.script.menu.code=Code +isisfish.script.menu.commit=Commit script to server +isisfish.script.menu.copy=Copy +isisfish.script.menu.cut=Cut +isisfish.script.menu.deleteLocaly=Delete localy +isisfish.script.menu.deleteLocalyServer=Delete localy and on server +isisfish.script.menu.diff=Display diff with server version +isisfish.script.menu.edit=Edit +isisfish.script.menu.evaluate=Evaluate +isisfish.script.menu.file=File +isisfish.script.menu.javadocgenerate=Generate script javadoc +isisfish.script.menu.javadocgenerated=Javadoc generated in %s +isisfish.script.menu.javadocgenerating=Generating javadoc in %s... +isisfish.script.menu.javadocshow=Show script javadoc +isisfish.script.menu.new=New +isisfish.script.menu.paste=Paste +isisfish.script.menu.save=Save +isisfish.script.menu.txtExport=Export +isisfish.script.menu.txtImport=Import +isisfish.script.menu.txtNewAnalysePlan=New analyse plan +isisfish.script.menu.txtNewEquationModel=New equation model +isisfish.script.menu.txtNewExport=New export +isisfish.script.menu.txtNewRule=New rule +isisfish.script.menu.txtNewScript=New script +isisfish.script.menu.txtNewSensitivity=New sensitivity calculator +isisfish.script.menu.txtNewSensitivityExport=New sensitivity export +isisfish.script.menu.txtNewSimulator=New simulator +isisfish.script.menu.txtVCS=Server +isisfish.script.menu.update=Update from server +isisfish.script.new=New +isisfish.script.new.tooltip=Create new script +isisfish.script.paste=Paste +isisfish.script.paste.tooltip=Paste current selection (Ctrl-v) +isisfish.script.save=Save +isisfish.script.save.tooltip=Save script +isisfish.script.title=Script Editor +isisfish.season.toString=season %1$s-%2$s +isisfish.selectivity.equation=Equation +isisfish.selectivity.selectPopulation=Select a population +isisfish.selectivity.title=Selectivity +isisfish.sens.backParameter=Back to parameter tab +isisfish.sens.title=Simulation plan +isisfish.sensitivity.coefficient=Coefficient (in %) +isisfish.sensitivity.comment=Comment +isisfish.sensitivity.continue=Continuous factor +isisfish.sensitivity.continuousminmaxtype=Mix/Max type +isisfish.sensitivity.continuouspercentagetype=Percentage type +isisfish.sensitivity.discret=Discret factor +isisfish.sensitivity.discretevaluelabel=Value %d +isisfish.sensitivity.displaysecondpass=Display results +isisfish.sensitivity.equation.valid=Valid variable +isisfish.sensitivity.equation.variablename=Varaible name \: +isisfish.sensitivity.export=Export +isisfish.sensitivity.factor=Factor +isisfish.sensitivity.factor.notvalid=Factor not valid \! +isisfish.sensitivity.factors=Factors +isisfish.sensitivity.firstValue=First value +isisfish.sensitivity.increment=Cardinality +isisfish.sensitivity.lastValue=Last value +isisfish.sensitivity.methodfactorsupported=The selected sensitivity method handles factors cardinalities +isisfish.sensitivity.moveillegal=Can't compose a factor group with mixed discrete and continuous factors \! +isisfish.sensitivity.name=Factor name +isisfish.sensitivity.newfactorgroup.tip=Add new factor group +isisfish.sensitivity.newfactorname=Factor group name +isisfish.sensitivity.populationfactorname=Population %s +isisfish.sensitivity.referencevalue=Reference value +isisfish.sensitivity.ruleparameterfactorname=Param rule %s.%s +isisfish.sensitivity.rulesfactorname=Rule set +isisfish.sensitivity.secondpass=Analyze results +isisfish.sensitivity.secondpass.title=Analyze results +isisfish.sensitivity.select=Method +isisfish.sensitivity.selectDiscretNumber=Number of factors +isisfish.sensitivity.title=Sensitivity analysis +isisfish.sensitivity.validDiscretNumber=Ok +isisfish.sensitivityChooser.title=Sensitivity method +isisfish.server.ssh.generateKey.title=Generate Ssh key +isisfish.setOfVessels.comments=Comments +isisfish.setOfVessels.fixedCosts=Fixed costs +isisfish.setOfVessels.name=Name +isisfish.setOfVessels.numberOfVessels=Number of vessels +isisfish.setOfVessels.technicalEfficiency=Technical efficiency +isisfish.setOfVessels.title=Caracteristics +isisfish.setOfVessels.vesselType=Vessel type +isisfish.simpleResult.more.information=Click a cell for more information... +isisfish.simulation.log.console.title=Log console for simulation '%1$s' +isisfish.simulation.log.showConsole=Display log console for simulation %1$s +isisfish.simulation.menu.import=Restore simulation parameters +isisfish.simulation.menu.save=Save simulation parameters +isisfish.simulation.menu.simulation=Simulation +isisfish.simulation.remote.message.connection=Connecting to Caparmor +isisfish.simulation.remote.message.deletingfiles=Deleting simulation files +isisfish.simulation.remote.message.downloadresults=Downloading results +isisfish.simulation.remote.message.upload=Uploading simulation +isisfish.simulation.remote.message.waitingstart=Waiting for simulation start +isisfish.simulation.restarting=Restarting... +isisfish.simulation.title=Simulation launcher +isisfish.simulator.configuration.r.cantinit=Can't init R \: %s +isisfish.simulator.configuration.r.details=This window display current system R configuration and can be used to test if R is successfully installed. +isisfish.simulator.configuration.r.launchtest=Test +isisfish.simulator.configuration.r.lhsnotinstalled=LHS library not installed \! +isisfish.simulator.configuration.r.rhome=R_HOME +isisfish.simulator.configuration.r.rtype=R.type +isisfish.simulator.configuration.r.sensitivitynotinstalled=Sensitivity library not installed \! +isisfish.simulator.configuration.r.systempath=PATH +isisfish.simulator.configuration.r.systempathnok=Path doesn't contains R bin directory (%s) +isisfish.simulator.configuration.r.systempathok=Path contains R bin directory (%s) +isisfish.simulator.configuration.r.testok=R successfully tested \! +isisfish.simulator.configuration.r.title=R Configuration +isisfish.simulator.launcher.inprocess=in current process +isisfish.simulator.launcher.remote=on Caparmor server +isisfish.simulator.launcher.subprocess=in subprocess +isisfish.simulator.simulaction.badid=Can't start simulation, bad id\: %s +isisfish.simulator.ssh.configuration.connecting=Connection... +isisfish.simulator.ssh.configuration.connectingpk=Connection with public key... +isisfish.simulator.ssh.configuration.connection=Connection information +isisfish.simulator.ssh.configuration.connectionerror=Can't connect +isisfish.simulator.ssh.configuration.connectionok=Connection successfull +isisfish.simulator.ssh.configuration.environment=Caparmor configuration +isisfish.simulator.ssh.configuration.freespace=Used space disk \: +isisfish.simulator.ssh.configuration.freespace.confirmdelete=Warning, deleting folder '%s' is irreversible.\nDo you confirm the deletion of contents ? +isisfish.simulator.ssh.configuration.freespace.label=Size of %s \: %s +isisfish.simulator.ssh.configuration.invalidpassphrase=Invalid passphrase +isisfish.simulator.ssh.configuration.keygenerate=Generate +isisfish.simulator.ssh.configuration.status=Status +isisfish.simulator.ssh.configuration.test=Test configuration +isisfish.simulator.ssh.configuration.title=Caparmor launcher configuration +isisfish.simulator.subprocess.readoutput.error= +isisfish.species.age=Age +isisfish.species.cee=CEE +isisfish.species.comments=Comments +isisfish.species.length=Length +isisfish.species.name=Species name +isisfish.species.rubbinCode=Rubbin code +isisfish.species.scientificName=Scientific name +isisfish.species.structured=Structured +isisfish.ssh.askpassphrase.message=Enter passphrase for key '%s' \: +isisfish.ssh.askpassphrase.title=SSH key unlocking +isisfish.ssh.askpassphrase.wrongpassphrase=Wrong passphrase, enter a new one for key '%s' \: +isisfish.strategy.comments=Comments +isisfish.strategy.inactivity=Inactivity equation +isisfish.strategy.inactivityEquationUsed=Use inactivity equation +isisfish.strategy.name=Name +isisfish.strategy.proportionSetOfVessels=Set of vessels proportion +isisfish.strategy.title=Caracteristics +isisfish.strategyMonthInfo.metier=Metier +isisfish.strategyMonthInfo.minInactivityDays=Min inactivity days +isisfish.strategyMonthInfo.numberOfTrips=Number of trips +isisfish.strategyMonthInfo.proportion=Proportion +isisfish.strategyMonthInfo.title=StrategyMonthInfo +isisfish.strategyMonthInfo.toString=%1$s %2$s +isisfish.timeUnit.day=Day +isisfish.timeUnit.hours=Hours +isisfish.tray.simulation=Isis-fish - %1$s \: %2$s/%3$s +isisfish.tray.simulation.multi=Isis-fish - %s / %s +isisfish.tray.simulation.no=Isis-fish - No simulation +isisfish.tripType.comments=Comments +isisfish.tripType.duration=Duration +isisfish.tripType.minTime=Minimum time between trips +isisfish.tripType.name=Name +isisfish.ui.script.communityvcs=Community VCS +isisfish.ui.script.officialvcs=Official VCS +isisfish.vcs.ask.passphrase=Enter your pass phrase (if your private key have one). +isisfish.vcs.ask.passphrase.title=Ask your pass phrase +isisfish.vcs.commit=vcs.commit +isisfish.vcs.commit.cancel=vcs.commit.cancel +isisfish.vcs.commit.label=vcs.commit.label +isisfish.vcs.commit.ok=vcs.commit.ok +isisfish.vcs.factory.cantinstanciate=Can't instanciate wanted VCS (%s), use default +isisfish.vcs.howto.save.key=How to register my public key on labs forge +isisfish.vcs.init.notfoundcantdownload=No database version %s found and can't get it.\nYou must go to ISIS-Fish web site and download database manually. +isisfish.vcs.init.wrongprotocol=Your database repository\: %s\n don't use correct protocol.\nDo you want to make backup of your database and take the correct one ? +isisfish.vcs.save.key=Go to labs forge to register my public key +isisfish.vcs.switchprotocol.confirm=Protocol to access repository script has changed.\nDo you want to switch your repository ? +isisfish.vcs.switchtag.warningconflict=Your repository is now up-to-date, but following files are conflicted, you may check them \: +isisfish.vcs.switchversion.confirm=You don't use correct repository script for your application version %s.\nDo you want to switch your repository ? +isisfish.vcs.update=vcs.update +isisfish.vcs.update.cancel=cancel +isisfish.vcs.update.checkAll=checkAll +isisfish.vcs.update.local=local +isisfish.vcs.update.local.modified=modified +isisfish.vcs.update.local.outofdateAndModified=outofdateAndModified +isisfish.vcs.update.local.tooltip.modified= +isisfish.vcs.update.local.tooltip.outofdateAndModified= +isisfish.vcs.update.local.tooltip.unversionned= +isisfish.vcs.update.local.unversionned=unversionned +isisfish.vcs.update.ok=ok +isisfish.vcs.update.remote=remote +isisfish.vcs.update.remote.missing=missing +isisfish.vcs.update.remote.outofdate=outofdate +isisfish.vcs.update.remote.tooltip.missing= +isisfish.vcs.update.remote.tooltip.outofdate= +isisfish.vcs.update.tooltip.checkAll=checkAll +isisfish.vcs.update.tooltip.local= +isisfish.vcs.update.tooltip.remote= +isisfish.vcs.update.warningconflict=Your repository is now up-to-date, but following files are conflicted, you may check them \:\n +isisfish.vcs.updateconfirm=updateconfirm +isisfish.vcs.updateconfirm.cancel=cancel +isisfish.vcs.updateconfirm.checkAll=checkAll +isisfish.vcs.updateconfirm.label= +isisfish.vcs.updateconfirm.label2= +isisfish.vcs.updateconfirm.ok=ok +isisfish.vcs.updateconfirm.tooltip.checkAll= +isisfish.vcs.updaterepository.confirm=Your repository is not up to date.\nDo you want to update following files ? +isisfish.vcs.vcssvn.add.error=Can't add file +isisfish.vcs.vcssvn.add.errorreadonly=You can't add file, this repository is readonly +isisfish.vcs.vcssvn.checkProtocol.error=Can't get address on serveur of local repository +isisfish.vcs.vcssvn.checkProtocol.relocate=Relocate repository %s from %s to %s +isisfish.vcs.vcssvn.checkout.error=Can't checkout +isisfish.vcs.vcssvn.cleanup.error=Can't cleanup working copy +isisfish.vcs.vcssvn.commit.error=Can't commit files +isisfish.vcs.vcssvn.commit.errorreadonly=You can't commit file, this repository is readonly +isisfish.vcs.vcssvn.delete.error=Can't delete file +isisfish.vcs.vcssvn.delete.errorreadonly=You can't delete file, this repository is readonly +isisfish.vcs.vcssvn.diff.error=Can't get diff +isisfish.vcs.vcssvn.gettag.error=Can't get address on serveur of local repository +isisfish.vcs.vcssvn.getupdate.error=Can't status file +isisfish.vcs.vcssvn.global.filelocalandremotestatus=file %s status is (l\:%s/r\:%s) +isisfish.vcs.vcssvn.global.filestatus=status for %s is %s +isisfish.vcs.vcssvn.global.foundUpdatedFile=add %s as updated file +isisfish.vcs.vcssvn.global.torevision=At revision \: %d +isisfish.vcs.vcssvn.isconnected.switchoff=Can't connect to serveur, switch to off line\: %s +isisfish.vcs.vcssvn.isconnected.switchto=Connection to serveur available, switch on line\: %s +isisfish.vcs.vcssvn.isonremote.error=file %s is not on server +isisfish.vcs.vcssvn.istag.notexist=Tag %s don't exist +isisfish.vcs.vcssvn.isuptodate.error=Can't get file status +isisfish.vcs.vcssvn.list.error=Can't list files +isisfish.vcs.vcssvn.localstatus.error=Can't status file +isisfish.vcs.vcssvn.remotestatus.error=Can't status file +isisfish.vcs.vcssvn.setTag.error=Can't get address on server of local repository +isisfish.vcs.vcssvn.settag.switchfromto=Switch repository tag from %s to %s +isisfish.vcs.vcssvn.update.error=Can't update files +isisfish.vcs.vcssvn.update.notinlocal=Can't update file that not in local repository +isisfish.versionStorage.removed=Removed +isisfish.vesselType.activityRange=Activity range +isisfish.vesselType.comments=Comments +isisfish.vesselType.fuelCost=Travel fuel cost +isisfish.vesselType.length=Length +isisfish.vesselType.maxDuration=Maximum trip duration +isisfish.vesselType.miniCrew=Minimum crew size +isisfish.vesselType.name=Name +isisfish.vesselType.speed=Speed +isisfish.welcome.menu.about=About +isisfish.welcome.menu.api=API +isisfish.welcome.menu.close=Close +isisfish.welcome.menu.configuration=Configuration +isisfish.welcome.menu.configuration.r=R configuration +isisfish.welcome.menu.configuration.sshlauncher=Caparmor configuration +isisfish.welcome.menu.configuration.vcs=VCS configuration +isisfish.welcome.menu.file=File +isisfish.welcome.menu.frame=Window +isisfish.welcome.menu.help=Help +isisfish.welcome.menu.help.isisfish=Isis-Fish Website +isisfish.welcome.menu.help.isisfishapi=Isis-Fish API +isisfish.welcome.menu.help.javaapi=Java API +isisfish.welcome.menu.help.matrixapi=NuitonMatrix API +isisfish.welcome.menu.help.topiaapi=ToPIA API +isisfish.welcome.menu.input=Input +isisfish.welcome.menu.queue=Simulation queue +isisfish.welcome.menu.result=Result +isisfish.welcome.menu.script=Script +isisfish.welcome.menu.simulation=Simulation launcher +isisfish.welcome.menu.synchro=Server synchronization +isisfish.welcome.title=Ifremer Simulation +isisfish.wizardGroupCreation.allGroupsSameSize=All groups have the same size +isisfish.wizardGroupCreation.allValues=Input all the values +isisfish.wizardGroupCreation.computedGrowthCurve=Computed by a growth curve +isisfish.wizardGroupCreation.firstAge=First age +isisfish.wizardGroupCreation.firstAgeHelp=First age \= minimal age +isisfish.wizardGroupCreation.firstGroup=First group +isisfish.wizardGroupCreation.firstLength=First min length +isisfish.wizardGroupCreation.firstLengthHelp=First min length \= minimal length of first group +isisfish.wizardGroupCreation.gapBetweenGroupsHelp=gap between to group is 1 year. +isisfish.wizardGroupCreation.groupWidth=Group width +isisfish.wizardGroupCreation.groupWidthHelp=Group width \= width of group +isisfish.wizardGroupCreation.lastAge=Last age +isisfish.wizardGroupCreation.lastAgeHelp=Last age \= maximal age +isisfish.wizardGroupCreation.maxGroupsLength=Maximal groups length +isisfish.wizardGroupCreation.maxGroupsLengthHelp=A semicolon ';' must separe maximal length of each group +isisfish.wizardGroupCreation.numberGroup=Number of group +isisfish.wizardGroupCreation.numberGroupHelp=number of Group \= number of group wanted +isisfish.wizardGroupCreation.numberGroups=Number of groups +isisfish.wizardGroupCreation.populationCharacteristics=Input the population characteristics +isisfish.wizardGroupCreation.selectGroupLengthType=Select group length type +isisfish.wizardGroupCreation.timeStep=Time step (in month) +isisfish.wizardGroupCreation.title=Group creation +isisfish.wizardGroupCreation.undefinedGrowthEquation=The equation used is the population's growth curve, it needs to be defined first. +isisfish.zone.cells=Zone cells +isisfish.zone.comments=Comments +isisfish.zone.name=Name +matrixAbundance= +matrixCatchPerStrategyMetPerZoneMet= +matrixDiscardsPerStrMetPerZonePop= +region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= +simulate\ %s\ with\ file\ %s= Copied: isis-fish/trunk/src/main/resources/i18n/isis-fish_fr_FR.properties (from rev 3392, isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties) =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish_fr_FR.properties (rev 0) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish_fr_FR.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,1100 @@ += +Add\ to\ default\ queue= +Analyse\ plan\ error,\ too\ many\ simulation\ for\ %s\ \:\ %s= +Can't\ add\ result\ '%1$s'\ at\ date\ %2$s=Can't add result '%1$s' at date %2$s +Can't\ add\ simulation\:\ %s= +Can't\ create\ simulation\ logger=Can't create simulation logger +Can't\ delete\ simulation\ %s\ = +Can't\ do\ post\ action\ %s= +Can't\ do\ simulation\ %s= +Can't\ download\ archive\ \:\ %s= +Can't\ download\ file= +Can't\ evaluate\ simulation\ prescript= +Can't\ export\ simulation\ %s= +Can't\ get\ changlog=Impossible d'obtenir de changelog +Can't\ get\ result\:\ %1$s=Can't get result\: %1$s +Can't\ instanciate\ export\ %1$s=Can't instanciate export %1$s +Can't\ instantiate\ %s= +Can't\ open\ log\ for\ %s= +Can't\ read\ ssh\ key\ \:\ %s= +Can't\ simulate\ %s= +Check\ state\ of\ local\ repository\:\ %s= +Command\ '%s'\ fail\ to\ execute= +Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s= +Error\ during\ vcs\ initialisation= +Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys= +Generate\ next\ simulation= +Import\ one\ java\ file\ script\ source= +Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s= +Import\ zipped\ file\ containing\ all\ scripts\ directory\ structure= +Info=Info +Jobs\ submited\ is\ not\ ItemSimulation\ but\ was\ %s= +Last\ entry\ was\ %s\ extract\ name\ %s= +Launcher\ %s\ will\ be\ stopped\ because\ there\ are\ too\ many\ error\ (%s)= +Local\ repository\ don't\ exist= +Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s= +Normal\ stop\ thread,\ this\ is\ not\ an\ error= +Not\ start\ simulation\ %s\ because\ user\ ask\ stop= +Process\ template\ error= +Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import= +Region\ %s\ already\ inited=La région %s a déjà été initialisée +Remote\ control\ file\ doesn't\ exists\ %s= +Remote\ information\ file\ doesn't\ exists\ %s= +Rename\ data\ directory\ to\ %s= +Show\ help= +Show\ version= +SimulationExecutor\ started\ with\ %s\ thread\ for\ %s= +Skip\ data\ migration\ (disabled)= +Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to= +Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s= +SubProcess\ start\:\ %s\ %s= +Switch\ repository\ type\ to\ none= +Try\ to\ log\ on\ %s@%s\:%d= +Use\ branches,\ switch\ not\ needed= +User\ restart\ simulation\ %s= +User\ stop\ simulation\ %s= +could\ not\ close\ reader\ %1$s=could not close reader %1$s +could\ not\ found\ %s= +could\ not\ found\ log\ file\ %1$s=could not found log file %1$s +could\ not\ found\ region\ %s= +could\ not\ found\ simulation\ %s= +could\ not\ read\ at\ offset\ %1$s\ for\ reason\ %2$s=could not read at offset %1$s for reason %2$s +destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= +destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= +directory\ %s\ must\ be\ a\ directory= +filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. +isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Merci de rapporter les bugs.<html> +isisfish.about.licensetext=Vous pouvez modifier et redistribuer ce programme sous les conditions énoncées par la licence GNU GPL (version 2 ou ultérieure). Une copie de la licence GPL est dans le fichier « LICENSE.txt » fourni avec Isis-Fish. Tous droits réservés. Aucune garantie n'est fournie pour l'utilisation de ce programme. +isisfish.about.title=À propos de Isis-Fish... +isisfish.advancedParameters.title=Paramètres avancés +isisfish.advancedParams.freeParameters=Paramètres libres +isisfish.advancedParams.libLevelLogger=Niveau de tracage des librairies +isisfish.advancedParams.scriptLevelLogger=Niveau de tracage des scripts +isisfish.advancedParams.simulLevelLogger=Niveau de tracage du simulateur +isisfish.advancedParams.simulationCache=Simulation cache +isisfish.advancedParams.simulationStatistique=Simulation statistique +isisfish.advancedParams.simulatorUse=Simulateur à utiliser +isisfish.cell.comments=Commentaires +isisfish.cell.land=Terre +isisfish.cell.latitude=Latitude +isisfish.cell.longitude=Longitude +isisfish.cell.name=Nom +isisfish.change.equation=Ne peut pas changer l'équation +isisfish.commit.message=Entrer un message de commit +isisfish.common.add=Ajouter +isisfish.common.apply=Appliquer +isisfish.common.cancel=Annuler +isisfish.common.check=Vérifier +isisfish.common.clear=Effacer +isisfish.common.close=Fermer +isisfish.common.confirm=Confirmation +isisfish.common.date=Date +isisfish.common.debug=Debug +isisfish.common.delete=Supprimer +isisfish.common.duration.inhours=En heures +isisfish.common.ellipsis=... +isisfish.common.emigration=émigration +isisfish.common.equation=Equation +isisfish.common.error=Erreur +isisfish.common.file=Fichier +isisfish.common.finish=Terminer +isisfish.common.gear=Engin +isisfish.common.immigration=immigration +isisfish.common.info=Info +isisfish.common.migration=migration +isisfish.common.module=Module +isisfish.common.month=mois %1$s +isisfish.common.name=Nom +isisfish.common.new=Nouveau +isisfish.common.newMatrix=Nouvelle matrice +isisfish.common.next=Suivant +isisfish.common.ok=Ok +isisfish.common.openEditor=Ouvrir l'éditeur +isisfish.common.population=Population +isisfish.common.populationGroup=Groupe de population +isisfish.common.populations=Populations +isisfish.common.port=Port +isisfish.common.prev=Précédent +isisfish.common.region=Région +isisfish.common.remove=Supprimer +isisfish.common.reset=Réinitialiser +isisfish.common.save=Sauver +isisfish.common.saveModel=Sauver comme modèle +isisfish.common.saveNextSimulation=Sauver pour la prochaine simulation +isisfish.common.season=Saison +isisfish.common.setOfVessels=Flottille +isisfish.common.simulate=Simuler +isisfish.common.strategies=Stratégies +isisfish.common.sum=somme +isisfish.common.tag=Tag +isisfish.common.tripType=Type de trajet +isisfish.common.valid=Valider +isisfish.common.value=Valeur +isisfish.common.warn=Warning +isisfish.common.year=année +isisfish.common.zone=Zone +isisfish.config.category.communityvcs=VCS Communauté +isisfish.config.category.communityvcs.description=Dépôt contenant les scripts de la communautés +isisfish.config.category.main=Globale +isisfish.config.category.main.description=Configuration globale +isisfish.config.category.misc=Divers +isisfish.config.category.misc.description=Divers +isisfish.config.category.officialvcs=VCS Officiel +isisfish.config.category.officialvcs.description=Dépôt contenant les scripts officiels +isisfish.config.category.versioning= +isisfish.config.category.versioning.description= +isisfish.config.database.lockmode.description=Méthode de vérouillage à utiliser pour la base de données +isisfish.config.main.compileDirectory.description=le répertoire où sont compilés les scripts +isisfish.config.main.configFileName.description=le fichier de configuration à utiliser +isisfish.config.main.defaultBackupDirectory.description=le répertoire où stocker les backups des données +isisfish.config.main.defaultExportNames.description=les noms des exports à effectuer après une simulation +isisfish.config.main.defaultMapFile.description=noms de la carte par défaut pour une base sans cartes +isisfish.config.main.defaultResultNames.description=les noms des résultats à traiter durant une simulation +isisfish.config.main.defaultSimulator.description=le nom du simulateur par défaut à utiliser lors d'une simulation +isisfish.config.main.defaultTagValue.description= +isisfish.config.main.encoding.description=l'encoding du système +isisfish.config.main.javadocDirectory.description=dossier de génération de la javadoc des scripts +isisfish.config.main.javadocURL.description=l'url de la javadoc des scripts +isisfish.config.main.launchUI.description=Affiche l'interface utilisateur +isisfish.config.main.localSimulator.description=Nom du simulateur local (processus courant) +isisfish.config.main.locale.description=la locale utilisateur +isisfish.config.main.monitoringDirectory.description=Dossier contenant les informations permettant de relancer les simulations +isisfish.config.main.performcron.description=Démarre toutes les tâches définies dans le service cron +isisfish.config.main.performmigration.description=Migre les données +isisfish.config.main.performvcsupdate.description=Met à jour le dépôt VCS +isisfish.config.main.remoteCaparmor.description=Nom du lanceur de simulation distante +isisfish.config.main.simulation.ssh.control.check.interval=Vérification de la progression (secondes) +isisfish.config.main.simulation.ssh.control.check.interval.description=Temps d'attente en secondes entre deux vérifications de progression +isisfish.config.main.simulation.ssh.datapath=Base de données +isisfish.config.main.simulation.ssh.datapath.description=Emplacement de la base de données (isis-database) +isisfish.config.main.simulation.ssh.isis.home=Installation d'Isis-Fish +isisfish.config.main.simulation.ssh.isis.home.description=Emplacement d'installation d'Isis-Fish sur le serveur +isisfish.config.main.simulation.ssh.javapath=Emplacement de java +isisfish.config.main.simulation.ssh.javapath.description=Emplacement de java sur le serveur (chemin total, ou relatif au $PATH, par défaut la valeur est celle de caparmor) +isisfish.config.main.simulation.ssh.max.threads=Nombre de thread SSH +isisfish.config.main.simulation.ssh.max.threads.description=Nombre de simulation simultanée à faire en SSH. Attention, ne doit être utilisé que pour faire plusieurs plans d'analyse dépendants en même temps, sinon laisser '1'. +isisfish.config.main.simulation.ssh.pbsbinpath=Emplacement des executables PBS +isisfish.config.main.simulation.ssh.pbsbinpath.description=Emplacement des commandes PBS (qsub, qdel...) sur le serveur +isisfish.config.main.simulation.ssh.pbsqsuboptions=Arguments qsub +isisfish.config.main.simulation.ssh.pbsqsuboptions.description=Arguments utilisés lors de la soumission des jobs. Par défaut '-m n' pas d'envoi de mails. +isisfish.config.main.simulation.ssh.server=Serveur de simulation +isisfish.config.main.simulation.ssh.server.description=Adresse du serveur de simulation +isisfish.config.main.simulation.ssh.tmppath=Dossier temporaire +isisfish.config.main.simulation.ssh.tmppath.description=Emplacement du dossier temporaire +isisfish.config.main.simulation.ssh.userhome=Répertoire d'accueil +isisfish.config.main.simulation.ssh.userhome.description=Répertoire d'accueil de l'utilisateur +isisfish.config.main.simulation.ssh.username=Identifiant +isisfish.config.main.simulation.ssh.username.description=Identifiant SSH pour se connecter au serveur +isisfish.config.main.simulationShowOnlyError.description=pour indiquer si l'on doit conserver dans l'UI des simulations terminées uniquement celles avec erreur +isisfish.config.main.smtpServer.description=le nom du serveur smtp à utiliser pour envoyer les courriels +isisfish.config.main.subSimulator.description=Nom du simulateur en sous processus +isisfish.config.main.userMail.description=le courriel de l'utilisateur +isisfish.config.main.userName.description=le nom - prénom de l'utilisateur +isisfish.config.ssh.key.file=Clé SSH +isisfish.config.ssh.key.file.description=Emplacement de la clé privée SSH +isisfish.config.title=Préférences +isisfish.config.vcs.community.hostname.description=Adresse du dépôt +isisfish.config.vcs.community.password.description=Mot de passe pour acceder au dépôt +isisfish.config.vcs.community.protocol.description=Protocole du dépôt +isisfish.config.vcs.community.remotepath.description=Chemin du dépôt +isisfish.config.vcs.community.type.description=Type du dépôt +isisfish.config.vcs.community.username.description=Nom d'utilisateur pour acceder au dépôt +isisfish.config.vcs.hostName.description=le nom du serveur vcs à utiliser +isisfish.config.vcs.localCommunityDatabasePath.description=Dossier de stockage local du dépôt communauté +isisfish.config.vcs.localDatabasePath.description=Dossier de stockage local du dépôt officiel +isisfish.config.vcs.noPassPhrase.description= +isisfish.config.vcs.passphrase.description= +isisfish.config.vcs.protocol.description=le protocol pour acceder au serveur vcs +isisfish.config.vcs.remotePath.description=le chemin jusqu'au parent du module de données sur le serveur vcs +isisfish.config.vcs.type.description=le type de communication vcs utilisé +isisfish.config.vcs.useSshConnexion.description= +isisfish.config.vcs.userName.description=le login de l'utilisateur sur le serveur vcs +isisfish.config.vcs.userPassword.description=le mot de passe de l'utilsateur sur le serveur vcs +isisfish.date.toString=%1$s %2$s +isisfish.editor.parametersnameandtypes=Paramètres (nom et type) +isisfish.effortDescription.crewFoodCost=Coût de l'alimentation pour l'équipage +isisfish.effortDescription.crewShareRate=Taux de partage de l'équipage +isisfish.effortDescription.crewSize=Taille de l'équipage +isisfish.effortDescription.economicTitle=Paramètres économiques +isisfish.effortDescription.effortTitle=Paramètres d'effort de pêche +isisfish.effortDescription.fishingOperation=Opération de pêche +isisfish.effortDescription.fishingOperationDuration=Durée de la pêche +isisfish.effortDescription.fishingOperationDuration.tooltip=En heures +isisfish.effortDescription.fixedCrewSalary=Salaire d'équipage fixe +isisfish.effortDescription.gearsNumberPerOperation=Nombre d'engins par opération +isisfish.effortDescription.landingCosts=Coûts d'accastillage +isisfish.effortDescription.otherRunningCost=Autres coûts +isisfish.effortDescription.parametersTitle=Paramètres des métiers +isisfish.effortDescription.repairAndMaintenanceGearCost=Coûts de maintenance +isisfish.effortDescription.title=Métiers pratiqués +isisfish.effortDescription.toString=EffortDescription for %1$s with %2$s +isisfish.effortDescription.unitCostOfFishing=Coût unitaire de la pêche +isisfish.equation.editor.title=Editeur d'équation +isisfish.error.acceptable.population=La nouvelle valeur n'est pas une valeur valide pour cette population +isisfish.error.add.logger.simulation=isisfish.error.add.logger.simulation +isisfish.error.add.tray=Impossible d'ajouter une icone de notification +isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s +isisfish.error.change.equation=Can't change equation +isisfish.error.compile.fileerror=Le fichier %s contient des erreurs \! +isisfish.error.compile.script=Impossible de compiler le script \: %s +isisfish.error.compiled.parameter=Can't get rule parameter from compiled class +isisfish.error.conversion.data=Erreur lors de la conversion du fichier de données +isisfish.error.create.equation=Can't create equation +isisfish.error.delete.database=Can't delete database +isisfish.error.delete.file=could not delete file %1$s +isisfish.error.delete.vcs.files=Can't delete vcs files +isisfish.error.during.simulation=Error during simulation +isisfish.error.emigration.negative=emigration negative +isisfish.error.empty.code.rubbin=le code rubbin est vide +isisfish.error.empty.emigration=emigration vide +isisfish.error.empty.id.geographic=l'identifiant géographique est vide +isisfish.error.empty.immigration=immigration vide +isisfish.error.empty.migration=Migration vide +isisfish.error.empty.name=le nom est vide +isisfish.error.empty.params.name=le nom du paramètre est vide +isisfish.error.empty.population=Population est vide +isisfish.error.empty.scientific.name=le nom scientifique est vide +isisfish.error.empty.season=info saison vide +isisfish.error.empty.selectivity=sélectivité est vide +isisfish.error.empty.species=espece capturable vide +isisfish.error.empty.species.name=le nom d'espece est vide +isisfish.error.empty.unit=l'unité de mesure est vide +isisfish.error.equation.openeditor=Impossible d'ouvrir l'editeur d'équation +isisfish.error.equation.return.number=EquationImpl doit retourner un nombre \: %1$s +isisfish.error.equation.savemodel=Impossible de sauver l'équation en tant que modèle +isisfish.error.errorpane.htmlmessage=<html><b>IsisFish a détecté une erreur \:</b><br />%s</b></html> +isisfish.error.errorpane.title=Erreur +isisfish.error.evaluate.equation=Impossible d'évaluer l'équation\: %1$s +isisfish.error.evaluate.preplan.script= +isisfish.error.evalute.plan.script=Can't evaluate plan script +isisfish.error.factor.invalid= +isisfish.error.file.already.exists=The file %1$s already exist +isisfish.error.growth.equation.before.create.group.population=Error, You must input growth equation before create the group population +isisfish.error.immigration.negative=immigration negative +isisfish.error.import.convertible=Erreur lors de l'import, la version du fichier que vous souhaitez importer n'est pas transformable en une version importable. +isisfish.error.import.file=Can't import file %1$s +isisfish.error.import.recent.files=Erreur lors de l'import, la version du fichier que vous souhaitez importer est plus récente que la version souhaitée. +isisfish.error.init.map=Can't init map. +isisfish.error.input.addentity=Impossible d'ajouter l'entité "%s" +isisfish.error.input.cancelentity=Impossible d'annuler les modifications +isisfish.error.input.createentity=Impossible de créer une nouvelle entité +isisfish.error.input.removeentity=Impossible de supprimer l'entité "%s" +isisfish.error.input.save=Impossible de sauver les modifications +isisfish.error.input.saveentity=Impossible de sauver les modifications +isisfish.error.input.spacializematrix= +isisfish.error.instanciate=Can't instanciate %1$s +isisfish.error.instanciate.export=Can't instanciate export %1$s +isisfish.error.invalid.costs.fix=les coûts fixes sont invalides +isisfish.error.invalid.distribution.recruitment=distribution de recrutement invalide +isisfish.error.invalid.equation=Equation invalide +isisfish.error.invalid.equation.name=Nom d'équation invalide +isisfish.error.invalid.file.name=Le nom du script %1$s n'est pas valide. +isisfish.error.invalid.interval.reproduction.recruitment=interval entre la reproduction et le recrutement invalide +isisfish.error.invalid.mean.weight=poids moyen invalide +isisfish.error.invalid.nullequation=L'équation %s n'existe pas \! +isisfish.error.invalid.number=le nombre est invalide +isisfish.error.invalid.range=La gamme possible n'a pas de valeur acceptable +isisfish.error.invalid.values.params=Paramètre controlable hors valeurs possibles +isisfish.error.invoke.method=Can't invoke method '%1$s' for class %2$s +isisfish.error.linkageerror.message=Isis-Fish a détecté une erreur d'utilisation des scripts.\nLe dossier de compilation a été supprimé pour forcer leur recompilation.\n\nMerci de relancer Isis-Fish. +isisfish.error.load.class=Can't load class\: %1$s +isisfish.error.load.classloader=Can't create ClassLoader for script, bad directory\: %1$s for reason %2$s +isisfish.error.load.file=could not load file %1$s +isisfish.error.log.closeAppender=n'a pas pu ferme l'appender %1$s et la categorie %2$s +isisfish.error.log.console.dispose=Une erreur est survenue pendant la fermeture de la console %1$s de log, raison %2$s +isisfish.error.log.createAppender=n'a pas pu creer l'appender [%1$s] \: %2$s pour la raison %3$s +isisfish.error.log.foundAppender=n'a pas trouve l'appender %1$s pour la categorie %2$s +isisfish.error.migration.negative=Migration negative +isisfish.error.no.matrix=Pas de matrice pour \: %s +isisfish.error.no.null.time.step=Error, the time step should not be null +isisfish.error.no.sector=il n'y a pas de secteur de définit +isisfish.error.no.select.simulation=could not select simulation +isisfish.error.no.target.species=no target species in %1$s for %2$s +isisfish.error.not.found.code=could not found codeclass for %1$s +isisfish.error.not.found.description=could not found description for %1$s +isisfish.error.not.found.field=could not found field %1$s doc for %2$s +isisfish.error.not.found.field.class=could not found field %1$s for class %2$s +isisfish.error.not.null.class.grown=classe mature vaut nul +isisfish.error.not.null.mean.weight=poids moyen nul +isisfish.error.not.possible.metier=Pas de métier possible +isisfish.error.not.support.class=La classe %s ne supporte pas les descritions +isisfish.error.null.semantics=Semantiques nulle pour %s +isisfish.error.number.classes.upper.zero=Error, the number of classes must be upper than 0 +isisfish.error.out.memory=Out of memory try with more memory (option -mx) +isisfish.error.overlap.season=Cette saison chevauche une autre saison +isisfish.error.parse.date=Can't parse date %1$s +isisfish.error.parse.long=Can't parse long %1$s +isisfish.error.plan.parameter=Can't get plan parameter from compiled class +isisfish.error.prepare.data=Can't prepare data +isisfish.error.prepare.information.simulation=Can't prepare information for simulation +isisfish.error.read.simulation=Can't read simulation information %1$s +isisfish.error.read.simulation.parameters=Impossible de lire les paramètres du fichier \: %1$s +isisfish.error.region.addmap=Impossible d'ajouter une carte +isisfish.error.region.already.exists=Cette région existe déjà +isisfish.error.region.cancel= +isisfish.error.region.check=Impossible de vérifier la région +isisfish.error.region.import=Impossible d'importer la région +isisfish.error.region.new= +isisfish.error.region.removemap=Impossible de supprimer une carte de la région +isisfish.error.region.save=Impossible de sauver la région +isisfish.error.remove.directory=Can't remove directory %1$s +isisfish.error.rename.region=Can't rename region to %1$s +isisfish.error.save.checkSum.compilation=Can't save checkSum to compilation\: %1$s +isisfish.error.save.script.compilation=Can't save script to compilation\: %1$s +isisfish.error.save.simulation.parameters=Can't save simulation parameters in file %1$s +isisfish.error.script.create=isisfish.error.script.create +isisfish.error.script.delete=N'a pas pu supprimer le fichier %1$s pour la raison suivante %2$s +isisfish.error.script.import=N'a pas pu importer pour la raison suivante %1$s +isisfish.error.script.load=N'a pas pu charger le fichier %1$s pour la raison suivante %2$s +isisfish.error.script.save=N'a pas pu sauver le fichier %1$s pour la raison suivante %2$s +isisfish.error.simulation.addanalyseplan=Impossible d'ajouter un plan d'analyze +isisfish.error.simulation.getparametervalue=Impossible d'obtenir la valeur du paramètre +isisfish.error.simulation.getresultname=Impossible d'obtenir la liste des résultat +isisfish.error.simulation.importparameter=Impossible d'importer les paramètres de simulation +isisfish.error.simulation.initsimulaction=Impossible d'initialiser la simulation +isisfish.error.simulation.launchsimulation=Impossible de lancer la simulation +isisfish.error.simulation.listoldsimulation=Impossible de lister les anciennes simulations +isisfish.error.simulation.listpopulation=Impossible d'obtenir la liste des populations +isisfish.error.simulation.liststrategies=Impossible d'obtenir la liste des statégies +isisfish.error.simulation.loadoldsimulation=Impossible de charger une ancienne simulation +isisfish.error.simulation.remote.global=Impossible de lancer une simulation sur serveur distant +isisfish.error.simulation.remote.wrongportvalue=Le port de connexion a une valeur incorrecte \: %s +isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s +isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s +isisfish.error.simulation.resultXml.write=Can't write simulation result XML for reason %1$s +isisfish.error.simulation.savesimulation=Impossible de sauver les paramètres de simulation +isisfish.error.simulation.setparametervalue=Impossible d'affecter la valeur du paramètre +isisfish.error.source.parameter=Can't get parameter from source +isisfish.error.strategy.order=Strategy %1$s don't have 12 StrategyMonthInfo but %2$s. Recreate them +isisfish.error.undefined.classes=pas de classes définies +isisfish.error.undefined.correspondence.zones.reproduction.recruitment=pas de correspondance entre les zones de reproduction et les zones de recrutement +isisfish.error.undefined.gear=l'engin n'est pas défini +isisfish.error.undefined.mesh=aucune maille de défini +isisfish.error.undefined.mesh.sector=aucune maille dans le secteur +isisfish.error.undefined.meta.population=aucune meta population de défini +isisfish.error.undefined.sector=aucun secteur de défini +isisfish.error.undefined.stategy=aucune stratégie de défini +isisfish.error.undefined.stategy.months=La stratégie n'est pas définie pour certain mois +isisfish.error.undefined.zone.population=il n'y a pas de zone de population de définie +isisfish.error.undefined.zone.recruitment=il n'y a pas de zone de recrutement de définie +isisfish.error.undefined.zone.reproduction=il n'y a pas de zone de reproduction de définie +isisfish.error.unsupported.equation.langage=unsupported langage '%1$s' for equation\: %2$s +isisfish.error.wait.simThread=Can't wait SimThread +isisfish.error.warning.title=Attention +isisfish.error.write.simulation=Can't write information %1$s +isisfish.export.saved=Exports des résultats sauvegardés +isisfish.export.title=Export des résultats +isisfish.filter.apply=Appliquer le filtre +isisfish.filter.cancel=Annuler +isisfish.filter.log.levelDebug=debug +isisfish.filter.log.levelError=erreur +isisfish.filter.log.levelFatal=fatal +isisfish.filter.log.levelInfo=info +isisfish.filter.log.levelTrace=trace +isisfish.filter.log.levelWarn=warning +isisfish.filter.log.tooltip.levelDebug=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.levelError=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.levelFatal=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.levelInfo=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.levelTrace=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.levelWarn=sélectionner pour filtrer ce niveau +isisfish.filter.log.tooltip.message=Entrer un terme à rechercher et appuyer sur Entrée +isisfish.filter.reset=Réinitialiser +isisfish.filter.result=Résultats +isisfish.filter.result.found=Résultats (%d/%d) +isisfish.filter.select=Sélectionner +isisfish.filter.select.simulation=Sélectionner une simulation +isisfish.filter.simulation=Filtrer les simulations +isisfish.filter.simulation.analysePlanNumber=numéro d'analyse +isisfish.filter.simulation.description=description +isisfish.filter.simulation.local=locale +isisfish.filter.simulation.numberOfYear=nombre d'année(s) +isisfish.filter.simulation.regionName=nom de région +isisfish.filter.simulation.simulationEnd=date de fin (dd/MM/yyyy) +isisfish.filter.simulation.simulationName=nom de simulation +isisfish.filter.simulation.simulationStart=date de début (dd/MM/yyyy) +isisfish.filter.simulation.simulatorName=nom du simulateur +isisfish.filter.simulation.tooltip.analysePlanNumber=filter sur le numéro d'analyse (uniquement pour les simulations avec plan d'analyse) +isisfish.filter.simulation.tooltip.description=filtrer sur la description (format regex) +isisfish.filter.simulation.tooltip.local=filter uniquement les simulations locales +isisfish.filter.simulation.tooltip.numberOfYear=filter sur le nombre d'année(s) (recherche exacte) +isisfish.filter.simulation.tooltip.regionName=filtrer sur le nom de la région (format regex) +isisfish.filter.simulation.tooltip.simulationEnd=filtrer sur la date de fin de simulation (format dd/MM/yyyy) +isisfish.filter.simulation.tooltip.simulationName=filtrer sur le nom de simulation (format regex) +isisfish.filter.simulation.tooltip.simulationStart=filtrer sur la date de début de simulation (format dd/MM/yyyy) +isisfish.filter.simulation.tooltip.simulatorName=filter sur le nom du simulateur utilisé (format regex) +isisfish.filter.simulation.tooltip.useAnalysePlan=filter uniquement les simulations avec plan d'analyse +isisfish.filter.simulation.tooltip.useOptimization=filter uniquement les simulations avec optimisation +isisfish.filter.simulation.tooltip.usePreScript=filter uniquement les simulations avec Prescript +isisfish.filter.simulation.tooltip.useStatistic=filter uniquement les simulations avec statistiques +isisfish.filter.simulation.useAnalysePlan=plan d'analyse +isisfish.filter.simulation.useOptimization=optimisation +isisfish.filter.simulation.usePreScript=prescript +isisfish.filter.simulation.useStatistic=statistiques +isisfish.fisheryRegion.addMap=Ajouter une carte +isisfish.fisheryRegion.area=Extrémités de la zone de pêche +isisfish.fisheryRegion.comments=Commentaires +isisfish.fisheryRegion.delMap=Supprimer la carte +isisfish.fisheryRegion.latitude=Lat. +isisfish.fisheryRegion.latitude.max=Lat. max. +isisfish.fisheryRegion.latitude.min=Lat. min. +isisfish.fisheryRegion.longitude=Long. +isisfish.fisheryRegion.longitude.max=Long. max. +isisfish.fisheryRegion.longitude.min=Long. min. +isisfish.fisheryRegion.name=Nom de la région +isisfish.fisheryRegion.selectFile=Sélectionnez un fichier +isisfish.fisheryRegion.spatial=Résolution spatiale +isisfish.gear.comments=Commentaires +isisfish.gear.effortUnit=Unité d'effort +isisfish.gear.name=Nom +isisfish.gear.rangeValues=Gamme de valeurs +isisfish.gear.standardisationFactor=Facteur de standardisation +isisfish.gear.technicalParameter=Paramètre technique +isisfish.gear.title=Engin +isisfish.input.continueCells=Continuer vers les mailles +isisfish.input.continueGears=Continuer vers les engins +isisfish.input.continueMetiers=Continuer vers les metiers +isisfish.input.continuePopulations=Continuer vers les populations +isisfish.input.continuePorts=Continuer vers les ports +isisfish.input.continueSetOfVessels=Continuer vers les flottilles +isisfish.input.continueSpecies=Continuer vers les espèces +isisfish.input.continueStrategies=Continuer vers les stratégies +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.map.copytoclicboard=Copier vers de presse-papiers +isisfish.input.menu.addRegion=Ajouter une région +isisfish.input.menu.commit=Sauvegarder les changements +isisfish.input.menu.copyRegion=Copier région +isisfish.input.menu.exportRegion=Exporter la région +isisfish.input.menu.importRegion=Importer une région +isisfish.input.menu.importRegionSimulation=Importer la région d'une simulation +isisfish.input.menu.importRegionV2=Importer une région de la v2 d'IsisFish +isisfish.input.menu.importRenameRegion=Importer une région et la renommer +isisfish.input.menu.removeLocaly=Supprimer localement +isisfish.input.menu.removeLocalyRemotely=Supprimer localement et à distance +isisfish.input.menu.sensitivity=Mexico +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.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... +isisfish.input.sensitivity.export.title=Exporter les facteurs +isisfish.input.title=Saisie de la pêcherie +isisfish.input.tree.cells=Mailles +isisfish.input.tree.gears=Engins +isisfish.input.tree.metiers=Métiers +isisfish.input.tree.populations=Populations +isisfish.input.tree.ports=Ports +isisfish.input.tree.setofvessels=Flottilles +isisfish.input.tree.species=Espèces +isisfish.input.tree.strategies=Stratégies +isisfish.input.tree.triptypes=Types de marée +isisfish.input.tree.vesseltypes=Types de navire +isisfish.input.tree.zones=Zones +isisfish.launch.anonymous=lecture seule +isisfish.launch.email=courriel +isisfish.launch.firstname=nom +isisfish.launch.init.done=init done in %1$s. +isisfish.launch.lasstname=prénom +isisfish.launch.server.authenticationMethod=droit d'accès au serveur +isisfish.launch.server.login=nom utilisateur +isisfish.launch.server.ssh.confirm.passphrase=confirmer la passphrase +isisfish.launch.server.ssh.key.change=Changer la clef ssh +isisfish.launch.server.ssh.key.generate=Générer la clef ssh +isisfish.launch.server.ssh.no.passphrase=pas de passphrase +isisfish.launch.server.ssh.passphrase=passphrase +isisfish.launch.server.ssh.privateKeyFile=clef privée ssh +isisfish.launch.server.ssh.publicKeyFile=clef publique ssh +isisfish.launch.ssh=lecture-écriture (ssh) +isisfish.launch.stop=Arrêt de la simulation... +isisfish.launching=after init done in %1$s. +isisfish.log.addAppender=ajoute un appender [%1$s] +isisfish.log.body=Message à joindre +isisfish.log.closeAppender=ferme l'appender [%1$s] pour la categorie %2$s +isisfish.log.mail.failed=Impossible d'envoyer le rapport par courriel. Le serveur smtp fonctionne ? (J'essaye de contacter < %1$s > smtp server) +isisfish.log.mail.send=Un rapport a été envoyé à %1$s +isisfish.log.mail.send.title=Envoi de la simulation %1$s par email +isisfish.log.mailTo=Adresse du destinataire +isisfish.log.removeAppender=supprime l'appender [%1$s] +isisfish.log.restoreLogLevel=repositionne le niveau du logger %1$s du niveau %2$s au niveau %3$s +isisfish.log.sendAll=Envoyer la simulation complete +isisfish.log.sendMail=Envoyer par email +isisfish.log.simulation.name=IsisFish simulation %1$s +isisfish.log.swapLogLevel=permute le niveau du logger %1$s du niveau %2$s au niveau %3$s +isisfish.log.tooltip.body=Le message saisi sera joint au courriel envoyé +isisfish.log.tooltip.mailTo=Entrer l'adresse du destinataire du courriel +isisfish.log.tooltip.sendAll=Envoyer toute la simulation, ou uniquement le fichier de log +isisfish.log.tooltip.sendMail=Cliquer pour envoyer le courriel contentant les fichiers +isisfish.message.add.objets.simulation=Ajout des nouveaux objets créés durant la simulation +isisfish.message.backup.database.finished=backup database terminé +isisfish.message.backup.database.progress=backup database en cours +isisfish.message.cancel.finished=Annulation terminée +isisfish.message.check.finished=Vérification terminée +isisfish.message.check.inprogress=Vérification en cours... +isisfish.message.checking.cell= +isisfish.message.choose.archive=choose archive file or directory +isisfish.message.commit.cancelled=commit annulé +isisfish.message.commit.finished=commit terminé +isisfish.message.commit.region.canceled=Commit de la région annulé +isisfish.message.commiting.region=En train de commiter la région %1$s ... +isisfish.message.compilation.time=Temps de compilation %1$ss +isisfish.message.confirm.delete.object=Voulez-vous vraiment supprimer l'objet %1$s +isisfish.message.confirm.remove.region=Voulez-vous vraiment supprimer la région %1$s ? +isisfish.message.confirm.remove.script=Voulez-vous vraiment supprimer le script '%1$s' ? +isisfish.message.creating.region=En train de créer la région %1$s +isisfish.message.creation.finished=Création terminée +isisfish.message.delete.canceled=Suppression annulée +isisfish.message.delete.entities=Supprimer les entités +isisfish.message.delete.entity=Supprimer l'entité +isisfish.message.delete.finished=Suppression terminée +isisfish.message.delete.object=Pour supprimer l'objet %1$s, tous les objets suivants seront aussi supprimés \n\n +isisfish.message.directory.not.exists= +isisfish.message.evaluation.finished=évaluation terminée +isisfish.message.export.done=Export terminé +isisfish.message.file.already.exists=Le fichier %s existe, voulez-vous l'écraser ? +isisfish.message.file.overwrite=Le fichier existe, voulez-vous l'écraser ? +isisfish.message.import=Importer %1$s +isisfish.message.import.equation.convert=Conversion manuelle de l'équation +isisfish.message.import.finished=Import terminé +isisfish.message.import.region.name=Entre le nom de la réegion à importer +isisfish.message.import.region.xml=Région XML (Isis-Fish V2.x) +isisfish.message.import.region.zipped=Zipped Region +isisfish.message.import.scripts.file=Importer des scripts depuis une archive zip +isisfish.message.import.scripts.file.cancelled=Importation des scripts annulé +isisfish.message.import.scripts.file.done=Scripts importés +isisfish.message.import.scripts.zipped=Archive de script (*.zip) +isisfish.message.import.xml.v2.file=Import xml v2 file +isisfish.message.import.zip=Import zip file +isisfish.message.launchui.notlaunch=Interface utilisateur non lancée +isisfish.message.load.finished=Chargement terminé +isisfish.message.load.map=Chargement de la carte \: %1$s +isisfish.message.loading.old.simulation=Chargement d'une ancienne simulation... +isisfish.message.loading.region=Chargement de la région +isisfish.message.name.imported.region=Entrez le nom de la région à importer +isisfish.message.new.filename=Entrez le nom du nouveau du fichier.\n\t (utiliser uniquemment des caractères et _ en commencant avec une majuscule) +isisfish.message.new.formule.category=Choisissez le catégorie de la formule +isisfish.message.new.formule.title=Nouvelle formule +isisfish.message.new.region.name=Entrer le nom de la nouvelle région +isisfish.message.old.simulation.loaded=Ancienne simulation chargée +isisfish.message.page.modified=Cette page a été modifié, voulez-vous la sauvegarder ? +isisfish.message.presimulation.script.execution=Exécution des scripts de Presimulation +isisfish.message.recruitment.number.month=Entrez le nombre de mois de recrutement +isisfish.message.region.commited=Région commitée +isisfish.message.region.loaded=Région chargée +isisfish.message.remove.canceled=Suppression annulée +isisfish.message.remove.finished=Suppresison terminé +isisfish.message.result.verif.region=Résultat de la vérification de la région +isisfish.message.save.finished=Sauvegarde terminée +isisfish.message.saveModel.dialog=Entrez le nom du modèle d'équation +isisfish.message.saveModel.finished=Sauvegarde du modèle terminée +isisfish.message.script.commit=Indiquez un message pour committer les modifications faîtes sur %s +isisfish.message.setting.cache.aspects=Mise en place des aspects Cache +isisfish.message.setting.trace.aspects=Mise en place des aspects Trace +isisfish.message.simulation.ended=Simulation terminée +isisfish.message.simulation.execution=Simulation execution +isisfish.message.simulation.prepare=Préparation de la simulation +isisfish.message.tray.disabled=Icone de notification désactivée +isisfish.metier.comments=Commentaires +isisfish.metier.name=Nom +isisfish.metier.rangeValues=Paramètre d'engin +isisfish.metier.title=Métier +isisfish.metierMonitor.metiers=Métiers +isisfish.metierMonitor.strategies=Stratégies +isisfish.metierSeasonInfo.toString=%1$s saison %2$s-%3$s +isisfish.metierSeasonInfoSpecies.mainSpecies=Espèces principales pour le métier +isisfish.metierSeasonInfoSpecies.selectSeason=Sélectionnez une saison +isisfish.metierSeasonInfoSpecies.selectSpecies=Choix de l'espèce +isisfish.metierSeasonInfoSpecies.species=Espèce +isisfish.metierSeasonInfoSpecies.targetFactor=Facteur cible +isisfish.metierSeasonInfoSpecies.title=Espèces capturables +isisfish.metierSeasonInfoZone.comments=Commentaires +isisfish.metierSeasonInfoZone.season=Saison +isisfish.metierSeasonInfoZone.selectSeason=Sélectionnez une saison +isisfish.metierSeasonInfoZone.title=Saison / Zones +isisfish.misc.databasemigration.question=La base de donnée est en version \: %s.\n\nUne migration en version %s est nécessaire.\nVoulez vous migrer la base de données ? +isisfish.misc.databasemigration.title=Migration de base de données +isisfish.misc.nuitonmigration=IsisFish a détecté l'utilisation de librairies CodeLutin dans les scripts suivants.\nVoulez vous migrer ces scripts vers les nouvelles librairies nuiton ? +isisfish.month.april=avril +isisfish.month.august=août +isisfish.month.december=décembre +isisfish.month.february=février +isisfish.month.january=janvier +isisfish.month.july=juillet +isisfish.month.june=juin +isisfish.month.march=mars +isisfish.month.may=mai +isisfish.month.november=novembre +isisfish.month.october=octobre +isisfish.month.september=septembre +isisfish.params.changeLogLev=Passe du niveau '%1$s' au niveau '%2$s' +isisfish.params.clearFilter=Remise à zéro du filtre +isisfish.params.description=Description +isisfish.params.filter=Filtrer +isisfish.params.loadOldSimulation=Charger une ancienne simulation +isisfish.params.nopopulation=Aucune population sélectionnée +isisfish.params.numberYear=Nombre d'années +isisfish.params.populationEffectives=Effectifs %s +isisfish.params.rules=Règles +isisfish.params.rules.availables=Règles disponibles +isisfish.params.rules.selected=Règles sélectionnées +isisfish.params.sensitivityName=Nom de l'analyse de sensibilité +isisfish.params.simulationLauncher=Lanceur de simulation +isisfish.params.simulationName=Nom de la simulation +isisfish.params.stategiesAndPopulations=Stratégies et populations +isisfish.params.title=Paramètres +isisfish.params.toString.fishery=Pêcherie\: %1$s\n\n +isisfish.params.toString.lib.logger.level=niveau du logger de librairies \: %1$s +isisfish.params.toString.number.years=Nombre d'années \: %1$s\n\n +isisfish.params.toString.plan=Plan\: %1$s +isisfish.params.toString.plan.number=Numéro de séquence dans le plan \: %1$s\n\n +isisfish.params.toString.populations=Populations \: +isisfish.params.toString.rule=Règle\: %1$s +isisfish.params.toString.script.logger.level=niveau du logger de scripts \: %1$s +isisfish.params.toString.script.presimulation=Script de presimulation +isisfish.params.toString.simul.logger.level=niveau du logger de simulateur \: %1$s +isisfish.params.toString.simulation.done=Simulation réalisée avec \: %1$s +isisfish.params.toString.strategies=Stratégies d'exploitation \: +isisfish.params.useAnalysePlan=Utiliser le plan de simulation +isisfish.params.usePreSimulationScript=Utiliser un script de pré-simulation +isisfish.population.capturability=Capturabilit?9e +isisfish.population.comments=Commentaires +isisfish.population.group=Groupe +isisfish.population.groups=Groupes +isisfish.population.mappingZoneReproZoneRecru=MappingZoneReproZoneRecru +isisfish.population.matrixAbundance=Matrice d'abondance +isisfish.population.matrixAbundance1D=matrixAbundance1D +isisfish.population.recruitment=Recrutement +isisfish.population.reproduction=Reproduction +isisfish.population.season=Saison +isisfish.population.zones=Zones +isisfish.populationBasics.confirmCreateGroups=Attention, la re-création des groupes supprimera les groupes existants et tous les objets qui en dépendent.\nÊtes vous sur de vouloir re-créer les groupes ? +isisfish.populationBasics.geographicID=Identifiant géographique +isisfish.populationBasics.growth=Croissance +isisfish.populationBasics.growthReverse=Croissance inverse +isisfish.populationBasics.maturityGroup=Groupe de maturité +isisfish.populationBasics.name=Nom +isisfish.populationBasics.numberGroup=Nombre de groupes +isisfish.populationBasics.plusGroup=Groupe plus +isisfish.populationBasics.recreateClasses=Reconstruire les groupes +isisfish.populationBasics.title=Saisie des populations +isisfish.populationCapturability.comments=Commentaires +isisfish.populationCapturability.selectCoefficient=Sélectionnez un coefficient par saison et par classe +isisfish.populationCapturability.title=Saisie de la capturabilité +isisfish.populationEquation.meanWeight=Poids moyen +isisfish.populationEquation.naturalDeathRate=Taux de mortalité naturelle +isisfish.populationEquation.price=Prix +isisfish.populationEquation.title=Saisie des équations +isisfish.populationGroup.age=Age +isisfish.populationGroup.comments=Commentaires +isisfish.populationGroup.length=Longueur +isisfish.populationGroup.maximumLength=Longueur maximale +isisfish.populationGroup.meanWeigth=Poids principal +isisfish.populationGroup.minimumLength=Longueur minimale +isisfish.populationGroup.naturalDeathRate=Taux de mortalité naturelle +isisfish.populationGroup.price=Prix +isisfish.populationGroup.reproductionRate=Taux de reproduction +isisfish.populationGroup.title=Saisie des groupes de population +isisfish.populationGroup.toString=%1$s Groupe %2$s +isisfish.populationMigration.comments=Commentaires +isisfish.populationMigration.selectSeason=Sélectionnez une saison +isisfish.populationMigration.title=Migration +isisfish.populationMigration.useEquation=Utiliser l'équation +isisfish.populationMigrationEmigration.coefficient=Coefficient +isisfish.populationMigrationEmigration.departureZone=Zone de départ +isisfish.populationMigrationEmigration.title=Emmigration +isisfish.populationMigrationImmigration.arrivalZone=Zone d'arrivée +isisfish.populationMigrationImmigration.coefficient=Coefficient +isisfish.populationMigrationImmigration.title=Immigration +isisfish.populationMigrationMigration.arrivalZone=Zone d'arrivée +isisfish.populationMigrationMigration.coefficient=Coefficient +isisfish.populationMigrationMigration.departureZone=Zone de départ +isisfish.populationMigrationMigration.title=Migration de population +isisfish.populationRecruitment.comments=Commentaires +isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Nombre de mois entre ponte et recrutement +isisfish.populationRecruitment.recruitmentDistribution=Distribution du recrutement +isisfish.populationRecruitment.reproductionEquation=Equation de reproduction +isisfish.populationRecruitment.title=Saisie des reproductions +isisfish.populationSeasonInfo.arrival=Arrivée +isisfish.populationSeasonInfo.departure=Départ +isisfish.populationSeasonInfo.distributionSpawing=Distribution de la reproduction +isisfish.populationSeasonInfo.emigration=Emigration +isisfish.populationSeasonInfo.group=Groupe +isisfish.populationSeasonInfo.immigration=Immigration +isisfish.populationSeasonInfo.migration=Migration +isisfish.populationSeasonInfo.months=Mois +isisfish.populationSeasonInfo.toString=%1$s saison %2$s-%3$s +isisfish.populationSeasons.Reproduction=Reproduction +isisfish.populationSeasons.changeGroup=Changement de groupe +isisfish.populationSeasons.comments=Commentaires +isisfish.populationSeasons.computeCoefficient=Calculer le coefficient +isisfish.populationSeasons.distributionSpawning=Distribution de la reproduction +isisfish.populationSeasons.noSpacialized=Non spatialisé +isisfish.populationSeasons.selectSeason=Sélectionnez une saison +isisfish.populationSeasons.showSpacialized=Voir les coefficients spatialisés +isisfish.populationSeasons.spacialized=spatialisé +isisfish.populationSeasons.spacialized.visualisation=Coefficients spatialisés +isisfish.populationSeasons.title=Saisons +isisfish.populationZones.betweenSpawningRecruitmentAreas=Correspondance entre les zones de reproduction et de recrutement +isisfish.populationZones.selectPopulationAreas=Sélectionnez les zones des populations +isisfish.populationZones.selectRecruitmentAreas=Sélectionnez les zones de recrutement +isisfish.populationZones.selectSpawningAreas=Sélectionnez les zones de reproduction +isisfish.populationZones.title=Zones +isisfish.port.cell=Maille du port +isisfish.port.comments=Commentaires +isisfish.port.name=Nom +isisfish.preScript.backParameter=Retour aux paramètres +isisfish.preScript.title=Script de pré-simulation +isisfish.queue.clearDone=Retirer les simulations terminées +isisfish.queue.id=Identifiant +isisfish.queue.launcher=Lanceur de simulation +isisfish.queue.masterplan=Plan de simulation +isisfish.queue.notstarted=Non démarré +isisfish.queue.plan=Plan +isisfish.queue.progression=Progression +isisfish.queue.restartSimulation=Redémarrer +isisfish.queue.showLog=Voir les logs de la simulation +isisfish.queue.simulationLaunch=Lanceur de la queue des simulations +isisfish.queue.status=État +isisfish.queue.stopSimulation=Arrêter la simulation +isisfish.queue.title=Queue +isisfish.result.begin.simulation=En début de simulation \: +isisfish.result.choose.simulation=Choisir une simulation +isisfish.result.end.simulation=En fin de Simulation\: +isisfish.result.export=Export +isisfish.result.export.file=Exporter un fichier texte +isisfish.result.map=Carte +isisfish.result.new.window=Ouvrir une nouvelle fenêtre +isisfish.result.remove.simulation=Supprimer Simulation +isisfish.result.selectResult=Résultat \: +isisfish.result.show.simulation.log=Voir les logs +isisfish.result.summary=Résumé +isisfish.result.title=Résultat +isisfish.resultChoice.save=Résultats à sauvegarder +isisfish.resultChoice.saved=Résultats sauvegardé +isisfish.resultChoice.title=Choix de résultats +isisfish.script.check=Vérifier +isisfish.script.check.tooltip=Vérifie la synthaxe du script +isisfish.script.commit=Commit +isisfish.script.commit.tooltip=Committer le script sur le serveur SVN +isisfish.script.compilation.failed=%s +isisfish.script.compilation.ok=Compilation réussie.\n--------------------\n\n%s +isisfish.script.compilingfile=Compilation de %s... +isisfish.script.copy=Copier +isisfish.script.copy.tooltip=Copier la sélection courante (Ctrl-c) +isisfish.script.cut=Couper +isisfish.script.cut.tooltip=Couper la sélection courante (Ctrl-x) +isisfish.script.evaluate=Évaluer +isisfish.script.evaluate.tooltip=Lance le script (doit contenir une methode main() pour fonctionner) +isisfish.script.export=Exporter +isisfish.script.export.checkAll=Tout (dé-)sélectionner +isisfish.script.export.chooseDir=... +isisfish.script.export.tooltip=Exporter les scripts sélectionnés vers une archive zip +isisfish.script.export.tooltip.checkAll=(Dé-)Sélectionner tous les scripts à exporter +isisfish.script.export.tooltip.chooseDir=Choisir le répertoire où exporter les scripts +isisfish.script.import=Importer des scripts depuis une archive zip +isisfish.script.import.cancel=Annuler +isisfish.script.import.checkAll=Tout (dé-)sélectionner +isisfish.script.import.import=Importer +isisfish.script.import.labelAdd=Le(s) fichier(s) suivant(s) sera(ont) ajouté(s), Confirmer l'ajout +isisfish.script.import.labelOverwrite=Le(s) fichier(s) suivant(s) existe(nt) déjà, Confirmer pour l'écrasement +isisfish.script.import.tooltip.checkAll=(Dé-)Sélectionner tous les scripts à importer +isisfish.script.javadoc.ok=Javadoc générée avec succès\n---------------------------\n\n%s +isisfish.script.menu.checkAllSyntax=Vérifier tous les scripts +isisfish.script.menu.checkSyntax=Vérifier la syntaxe +isisfish.script.menu.code=Code +isisfish.script.menu.commit=Commiter des scripts sur le serveur +isisfish.script.menu.copy=Copier +isisfish.script.menu.cut=Couper +isisfish.script.menu.deleteLocaly=Supprimer localement +isisfish.script.menu.deleteLocalyServer=Supprimer localement et sur le serveur +isisfish.script.menu.diff=Voir les différences avec la version du serveur +isisfish.script.menu.edit=Édition +isisfish.script.menu.evaluate=Evaluer +isisfish.script.menu.file=Fichier +isisfish.script.menu.javadocgenerate=Générer la javadoc +isisfish.script.menu.javadocgenerated=Javadoc générée dans %s +isisfish.script.menu.javadocgenerating=Javadoc en cours de génération dans %s... +isisfish.script.menu.javadocshow=Afficher la javadoc +isisfish.script.menu.new=Nouveau +isisfish.script.menu.paste=Coller +isisfish.script.menu.save=Sauver +isisfish.script.menu.txtExport=Exporter +isisfish.script.menu.txtImport=Importer +isisfish.script.menu.txtNewAnalysePlan=Nouveau plan d'analyse +isisfish.script.menu.txtNewEquationModel=Nouvelle formule +isisfish.script.menu.txtNewExport=Nouveau script d'export +isisfish.script.menu.txtNewRule=Nouvelle règle +isisfish.script.menu.txtNewScript=Nouveau script +isisfish.script.menu.txtNewSensitivity=Nouveau calculateur de sensibilité +isisfish.script.menu.txtNewSensitivityExport=Nouvel export de sensibilité +isisfish.script.menu.txtNewSimulator=Nouveau simulateur +isisfish.script.menu.txtVCS=Serveur +isisfish.script.menu.update=Synchronisation +isisfish.script.new=Nouveau +isisfish.script.new.tooltip=Crée un nouveau script +isisfish.script.paste=Coller +isisfish.script.paste.tooltip=Colle la sélection courante (Ctrl-v) +isisfish.script.save=Sauver +isisfish.script.save.tooltip=Sauve le script +isisfish.script.title=Editeur de scripts +isisfish.season.toString=saison %1$s-%2$s +isisfish.selectivity.equation=Equation +isisfish.selectivity.selectPopulation=Sélectionnez une population +isisfish.selectivity.title=Sélectivité +isisfish.sens.backParameter=Retour aux paramètres +isisfish.sens.title=Plan de simulation +isisfish.sensitivity.coefficient=Coefficient (en %) +isisfish.sensitivity.comment=Commentaires +isisfish.sensitivity.continue=Facteur continu +isisfish.sensitivity.continuousminmaxtype=Type min/max +isisfish.sensitivity.continuouspercentagetype=Type pourcentage +isisfish.sensitivity.discret=Facteur discret +isisfish.sensitivity.discretevaluelabel=Valeur %d +isisfish.sensitivity.displaysecondpass=Afficher les résultats +isisfish.sensitivity.equation.valid=Valider la variable +isisfish.sensitivity.equation.variablename=Variable name \: +isisfish.sensitivity.export=Export +isisfish.sensitivity.factor=Facteur +isisfish.sensitivity.factor.notvalid=Facteur non valide \! +isisfish.sensitivity.factors=Facteurs +isisfish.sensitivity.firstValue=Première valeur +isisfish.sensitivity.increment=Cardinalité +isisfish.sensitivity.lastValue=Dernière valeur +isisfish.sensitivity.methodfactorsupported=La méthode de sensibilité choisie gère les cardinalités des facteurs +isisfish.sensitivity.moveillegal=Impossible d'ajouter des facteurs discret et continues dans un même groupe de facteurs \! +isisfish.sensitivity.name=Nom du facteur +isisfish.sensitivity.newfactorgroup.tip=Ajouter un groupe de facteur +isisfish.sensitivity.newfactorname=Nom du groupe de facteurs +isisfish.sensitivity.populationfactorname=Population %s +isisfish.sensitivity.referencevalue=Valeur de référence +isisfish.sensitivity.ruleparameterfactorname=Param règle %s.%s +isisfish.sensitivity.rulesfactorname=Ensemble de règles +isisfish.sensitivity.secondpass=Analyse des résultats +isisfish.sensitivity.secondpass.title=Analyse des résultats +isisfish.sensitivity.select=Méthode +isisfish.sensitivity.selectDiscretNumber=Nombre de facteurs +isisfish.sensitivity.title=Analyse de sensibilité +isisfish.sensitivity.validDiscretNumber=Valider +isisfish.sensitivityChooser.title=Méthode de la sensibilité +isisfish.server.ssh.generateKey.title=Générer une clé SSH +isisfish.setOfVessels.comments=Commentaires +isisfish.setOfVessels.fixedCosts=Coûts fixes +isisfish.setOfVessels.name=Nom +isisfish.setOfVessels.numberOfVessels=Nombre de navires +isisfish.setOfVessels.technicalEfficiency=Éfficacité technique +isisfish.setOfVessels.title=Caractéristiques +isisfish.setOfVessels.vesselType=Type de navire +isisfish.simpleResult.more.information=Cliquer sur une cellule pour plus d'informations... +isisfish.simulation.log.console.title=Console de log simulation '%1$s' +isisfish.simulation.log.showConsole=affichage de la console de log pour la simulation %1$s +isisfish.simulation.menu.import=Restaurer les paramètres d'une simulation +isisfish.simulation.menu.save=Sauver les paramètres de la simulation +isisfish.simulation.menu.simulation=Simulation +isisfish.simulation.remote.message.connection=Connexion à Caparmor +isisfish.simulation.remote.message.deletingfiles=Suppression des fichiers de simulation +isisfish.simulation.remote.message.downloadresults=Téléchargement des résultats +isisfish.simulation.remote.message.upload=Upload de la simulation +isisfish.simulation.remote.message.waitingstart=Attente du démarrage de la simulation +isisfish.simulation.restarting=Redémarrage... +isisfish.simulation.title=Lanceur de simulation +isisfish.simulator.configuration.r.cantinit=Impossible d'initialiser R \: %s +isisfish.simulator.configuration.r.details=Cet écran affiche la configuration système actuelle de R et permet de tester si un appel simple à R fonctionne. +isisfish.simulator.configuration.r.launchtest=Tester +isisfish.simulator.configuration.r.lhsnotinstalled=La librairie 'lhs' n'est pas installée \! +isisfish.simulator.configuration.r.rhome=R_HOME +isisfish.simulator.configuration.r.rtype=R.type +isisfish.simulator.configuration.r.sensitivitynotinstalled=La librairie 'sensitivity' n'est pas installée \! +isisfish.simulator.configuration.r.systempath=PATH +isisfish.simulator.configuration.r.systempathnok=Le path ne contient pas le dossier bin de R (%s) +isisfish.simulator.configuration.r.systempathok=Le path contient le dossier bin de R (%s) +isisfish.simulator.configuration.r.testok=R testé avec succès \! +isisfish.simulator.configuration.r.title=Configuration de R +isisfish.simulator.launcher.inprocess=dans le même processus +isisfish.simulator.launcher.remote=sur le serveur Caparmor +isisfish.simulator.launcher.subprocess=dans un sous processus +isisfish.simulator.simulaction.badid=Impossible de lancer la simulation '%s' \: l'identifiant existe déjà \! +isisfish.simulator.ssh.configuration.connecting=Connexion en cours +isisfish.simulator.ssh.configuration.connectingpk=Connexion en cours (avec clé publique) +isisfish.simulator.ssh.configuration.connection=Information de connexion +isisfish.simulator.ssh.configuration.connectionerror=Connexion impossible (%s) +isisfish.simulator.ssh.configuration.connectionok=Connecté avec succès +isisfish.simulator.ssh.configuration.environment=Configuration sur Caparmor +isisfish.simulator.ssh.configuration.freespace=Espace disque utilisé \: +isisfish.simulator.ssh.configuration.freespace.confirmdelete=Attention, la suppression du dossier '%s' est irréversible.\nConfirmez-vous la suppression de son contenu ? +isisfish.simulator.ssh.configuration.freespace.label=Taille de %s \: %s +isisfish.simulator.ssh.configuration.invalidpassphrase=Passphrase invalide +isisfish.simulator.ssh.configuration.keygenerate=Générer +isisfish.simulator.ssh.configuration.status=Statut +isisfish.simulator.ssh.configuration.test=Tester la configuration +isisfish.simulator.ssh.configuration.title=Configuration du lanceur Caparmor +isisfish.simulator.subprocess.readoutput.error= +isisfish.species.age=Age +isisfish.species.cee=CEE +isisfish.species.comments=Commentaires +isisfish.species.length=Longueur +isisfish.species.name=Nom des espèces +isisfish.species.rubbinCode=Code Rubbin +isisfish.species.scientificName=Nom scientifique +isisfish.species.structured=Structuré +isisfish.ssh.askpassphrase.message=Entrez la passphrase pour la clé '%s' \: +isisfish.ssh.askpassphrase.title=Déverrouillage de clé SSH +isisfish.ssh.askpassphrase.wrongpassphrase=Mauvaise clé, entrez une nouvelle passphrase '%s' \: +isisfish.strategy.comments=Commentaires +isisfish.strategy.inactivity=Equation d'inactivité +isisfish.strategy.inactivityEquationUsed=Utiliser une équation d'inactivité +isisfish.strategy.name=Nom +isisfish.strategy.proportionSetOfVessels=Proportion de la flottille +isisfish.strategy.title=Caractéristiques +isisfish.strategyMonthInfo.metier=Métier +isisfish.strategyMonthInfo.minInactivityDays=Jour minimums d'inactivité +isisfish.strategyMonthInfo.numberOfTrips=Nombre de trajets +isisfish.strategyMonthInfo.proportion=Proportion +isisfish.strategyMonthInfo.title=Saisie des mois +isisfish.strategyMonthInfo.toString=%1$s %2$s +isisfish.timeUnit.day=Jour +isisfish.timeUnit.hours=Heures +isisfish.tray.simulation=Isis-fish - %1$s \: %2$s/%3$s +isisfish.tray.simulation.multi=Isis-fish - %s / %s +isisfish.tray.simulation.no=Isis-fish - Pas de simulation +isisfish.tripType.comments=Commentaires +isisfish.tripType.duration=Durée +isisfish.tripType.minTime=Temps minimal entre deux voyages +isisfish.tripType.name=Nom +isisfish.ui.script.communityvcs=VCS Communauté +isisfish.ui.script.officialvcs=VCS Officiel +isisfish.vcs.ask.passphrase=Entrez votre passphrase (si votre clef ssh en contient une). +isisfish.vcs.ask.passphrase.title=Demande de passe phrase +isisfish.vcs.commit=Message de sauvegarde +isisfish.vcs.commit.cancel=annuler +isisfish.vcs.commit.label=Entrer quelques mots concernant la modification des scripts +isisfish.vcs.commit.ok=confirmer +isisfish.vcs.factory.cantinstanciate=Can't instanciate wanted VCS (%s), use default +isisfish.vcs.howto.save.key=Comment enregister sa clef publique ssh auprès du labs +isisfish.vcs.init.notfoundcantdownload=La base de données pour la version %s n'a ni pu être trouvée, ni téléchargée.\nVous devez la télécharger manullement à partir du site d'Isis-Fish. +isisfish.vcs.init.wrongprotocol=Votre base de données locale \: %s n'utilise pas un protocole correct.\nVoulez-vous faire une sauvegarde de cette base et récupérer une meilleure version ? +isisfish.vcs.save.key=Accéder au labs pour enregister votre clef publique ssh +isisfish.vcs.switchprotocol.confirm=Le protocole d'accès au dépôt des scripts a changé.\nVoulez-vous changer vers le nouveau dépôt ? +isisfish.vcs.switchtag.warningconflict=Votre base de données a été mise à jour mais les fichiers suivants sont en conflit, merci de les vérifier \: +isisfish.vcs.switchversion.confirm=Vous n'utilisez pas le dépôt correct pour votre version d'Isis-Fish \: %s.\nVoulez-vous changer de dépôt ? +isisfish.vcs.update=Résultats de la synchronisation avec le serveur +isisfish.vcs.update.cancel=annuler +isisfish.vcs.update.checkAll=(de)-select tout +isisfish.vcs.update.local=Systeme local +isisfish.vcs.update.local.modified=Fichiers modifiés +isisfish.vcs.update.local.outofdateAndModified=Fichiers localement modifiés en conflit avec le serveur +isisfish.vcs.update.local.tooltip.modified=Fichiers localement modifiés \n(confirmer pour revenir à la version avant modification ou soumêtre au serveur) +isisfish.vcs.update.local.tooltip.outofdateAndModified=Fichiers localement modifiés mais ayant une version plus récente sur le serveur\n (confirmer pour revenir à la version avant modification ou récupérer la nouvelle version du serveur) +isisfish.vcs.update.local.tooltip.unversionned=Fichiers uniquement présents sur votre systeme \n(confirmer pour les enregister sur le serveur) +isisfish.vcs.update.local.unversionned=Nouveaux fichiers +isisfish.vcs.update.ok=continuer +isisfish.vcs.update.remote=Serveur distant +isisfish.vcs.update.remote.missing=Nouveaux fichiers +isisfish.vcs.update.remote.outofdate=Fichiers plus récents sur le serveur +isisfish.vcs.update.remote.tooltip.missing=Nouveaux fichiers uniquement présents sur le serveur \n(confirmer pour les récupérer) +isisfish.vcs.update.remote.tooltip.outofdate=Fichiers dont il existe une version plus récente sur le serveur \n(confirmer pour les récupérer) +isisfish.vcs.update.tooltip.checkAll=(Dé-)Sélectionner tous les fichiers (à action unique) que vous voulez traiter +isisfish.vcs.update.tooltip.local=vcs.update.tooltip.local +isisfish.vcs.update.tooltip.remote=vcs.update.tooltip.remote +isisfish.vcs.update.warningconflict=Votre base de données a été mise à jour\nmais les fichiers suivants sont en conflit, merci de les vérifier \:\n +isisfish.vcs.updateconfirm=Confirmation des opeérations de synchronisation avec le serveur +isisfish.vcs.updateconfirm.cancel=annuler +isisfish.vcs.updateconfirm.checkAll=(de)-select tout +isisfish.vcs.updateconfirm.label=Confirmer les opérations qui pourraient écraser vos fichiers +isisfish.vcs.updateconfirm.label2='Etes vous sur de vouloir effectuer ces opérations ?' +isisfish.vcs.updateconfirm.ok=confirmer +isisfish.vcs.updateconfirm.tooltip.checkAll=(Dé-)Sélectionner tous les scripts que vous voulez traiter +isisfish.vcs.updaterepository.confirm=Votre dépôt des scripts n'est pas à jour. Voulez-vous mettre à jour les fichiers suivants ? +isisfish.vcs.vcssvn.add.error=Impossible d'ajouter un fichier +isisfish.vcs.vcssvn.add.errorreadonly=Vous ne pouver pas ajouter de fichier, ce dépôt est en lecture seule \! +isisfish.vcs.vcssvn.checkProtocol.error=Impossible d'obtenir l'adresse correspondant au dépôt local +isisfish.vcs.vcssvn.checkProtocol.relocate=Transfert du dépôt %s de %s vers %s +isisfish.vcs.vcssvn.checkout.error=Impossible de mettre à jour +isisfish.vcs.vcssvn.cleanup.error=Impossible de déverrouiller la copie locale +isisfish.vcs.vcssvn.commit.error=Impossible de commiter +isisfish.vcs.vcssvn.commit.errorreadonly=Vous ne pouvez pas commiter, le dépôt est en lecture seule +isisfish.vcs.vcssvn.delete.error=Impossible de supprimer des fichiers +isisfish.vcs.vcssvn.delete.errorreadonly=Vous ne pouvez pas supprimer ce fichier, le dépôt est en lecture seule +isisfish.vcs.vcssvn.diff.error=Impossible d'obtenir le diff +isisfish.vcs.vcssvn.gettag.error=Erreur lors de la récupération de l'adresse du dépôt local +isisfish.vcs.vcssvn.getupdate.error=Impossible d'obtenir le statut des fichiers +isisfish.vcs.vcssvn.global.filelocalandremotestatus=Le statut du fichier %s est (l\:%s/d\:%s) +isisfish.vcs.vcssvn.global.filestatus=Le statut de %s est %s +isisfish.vcs.vcssvn.global.foundUpdatedFile=Ajout de %s comme fichier mis à jour +isisfish.vcs.vcssvn.global.torevision=À la révision \: %d +isisfish.vcs.vcssvn.isconnected.switchoff=Impossible de se connecter au serveur, passage en mode déconnecté \: %s +isisfish.vcs.vcssvn.isconnected.switchto=Connexion au serveur disponible, passage en mode connecté \: %s +isisfish.vcs.vcssvn.isonremote.error=Le fichier %s n'est pas sur le serveur +isisfish.vcs.vcssvn.istag.notexist=Le tag %s n'existe pas +isisfish.vcs.vcssvn.isuptodate.error=Impossible d'obtenir le statut de fichier +isisfish.vcs.vcssvn.list.error=Impossible de lister +isisfish.vcs.vcssvn.localstatus.error=Impossible d'obtenir le statut local de fichier +isisfish.vcs.vcssvn.remotestatus.error=Impossible d'obtenir le statut distant de fichier +isisfish.vcs.vcssvn.setTag.error=Erreur lors de la récupération de l'adresse du dépôt local +isisfish.vcs.vcssvn.settag.switchfromto=Switch du tag du dépôt de %s à %s +isisfish.vcs.vcssvn.update.error=Impossible de mettre à jour +isisfish.vcs.vcssvn.update.notinlocal=Impossible de mettre à jour des fichiers qui ne sont pas pas dans le dépôt +isisfish.versionStorage.removed=Supprimé +isisfish.vesselType.activityRange=Intervalle d'activité +isisfish.vesselType.comments=Commentaires +isisfish.vesselType.fuelCost=Coût fuel en route +isisfish.vesselType.length=Longueur +isisfish.vesselType.maxDuration=Durée maximale du trajet +isisfish.vesselType.miniCrew=Taille minimale d'équipage +isisfish.vesselType.name=Nom +isisfish.vesselType.speed=Vitesse +isisfish.welcome.menu.about=À propos +isisfish.welcome.menu.api=API +isisfish.welcome.menu.close=Fermer +isisfish.welcome.menu.configuration=Configuration +isisfish.welcome.menu.configuration.r=Configuration R +isisfish.welcome.menu.configuration.sshlauncher=Configuration Caparmor +isisfish.welcome.menu.configuration.vcs=Configuration vcs +isisfish.welcome.menu.file=Fichier +isisfish.welcome.menu.frame=Fenêtre +isisfish.welcome.menu.help=Aide +isisfish.welcome.menu.help.isisfish=Site d'Isis-Fish +isisfish.welcome.menu.help.isisfishapi=API Isis-Fish +isisfish.welcome.menu.help.javaapi=API Java +isisfish.welcome.menu.help.matrixapi=API NuitonMatrix +isisfish.welcome.menu.help.topiaapi=API ToPIA +isisfish.welcome.menu.input=Saisie +isisfish.welcome.menu.queue=Liste des simulations +isisfish.welcome.menu.result=Résultat +isisfish.welcome.menu.script=Script +isisfish.welcome.menu.simulation=Lanceur de simulations +isisfish.welcome.menu.synchro=Synchronisation Serveur +isisfish.welcome.title=Simulation Ifremer +isisfish.wizardGroupCreation.allGroupsSameSize=Tous les groupes ont la même taille +isisfish.wizardGroupCreation.allValues=Entrer toutes les valeurs +isisfish.wizardGroupCreation.computedGrowthCurve=Calculé par une courbe de croissance +isisfish.wizardGroupCreation.firstAge=Premier age +isisfish.wizardGroupCreation.firstAgeHelp=Premier age \= age minimal +isisfish.wizardGroupCreation.firstGroup=Premier groupe +isisfish.wizardGroupCreation.firstLength=Taille min première classe +isisfish.wizardGroupCreation.firstLengthHelp=Taille min première classe \= taille minimale du premier groupe +isisfish.wizardGroupCreation.gapBetweenGroupsHelp=L'interval entre chaque groupe est de 1 an +isisfish.wizardGroupCreation.groupWidth=Longueur du groupe +isisfish.wizardGroupCreation.groupWidthHelp=Longueur du groupe \= Longueur du groupe +isisfish.wizardGroupCreation.lastAge=Dernier age +isisfish.wizardGroupCreation.lastAgeHelp=Dernier age \= age maximal +isisfish.wizardGroupCreation.maxGroupsLength=Taille maximale de groupes +isisfish.wizardGroupCreation.maxGroupsLengthHelp=Un point-virgule ';' doit séparer les tailles maximales de chaque groupe +isisfish.wizardGroupCreation.numberGroup=Nombre de groupe +isisfish.wizardGroupCreation.numberGroupHelp=Nombre de groupe \= Nombre de groupe voulu +isisfish.wizardGroupCreation.numberGroups=Nombre de groupes +isisfish.wizardGroupCreation.populationCharacteristics=Entrez les caractéristiques de la population +isisfish.wizardGroupCreation.selectGroupLengthType=Choisir la longueur du groupe +isisfish.wizardGroupCreation.timeStep=Pas de temps (en mois) +isisfish.wizardGroupCreation.title=Création du groupe +isisfish.wizardGroupCreation.undefinedGrowthEquation=L'équation utilisée est la courbe de croissance de la population. Elle doit être préalablement définie. +isisfish.zone.cells=Cellules de la zone +isisfish.zone.comments=Commentaires +isisfish.zone.name=Nom +matrixAbundance= +matrixCatchPerStrategyMetPerZoneMet= +matrixDiscardsPerStrMetPerZonePop= +region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= +simulate\ %s\ with\ file\ %s= Copied: isis-fish/trunk/src/main/resources/icons/table.png (from rev 3392, isis-fish/branches/3.3.1/src/main/resources/icons/table.png) =================================================================== (Binary files differ) Copied: isis-fish/trunk/src/main/resources/icons/table_multiple.png (from rev 3392, isis-fish/branches/3.3.1/src/main/resources/icons/table_multiple.png) =================================================================== (Binary files differ) Deleted: isis-fish/trunk/src/main/resources/images/sigma-barre.gif =================================================================== (Binary files differ) Deleted: isis-fish/trunk/src/main/resources/images/sigma.gif =================================================================== (Binary files differ) Deleted: isis-fish/trunk/src/main/resources/interpreter.properties =================================================================== --- isis-fish/trunk/src/main/resources/interpreter.properties 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/resources/interpreter.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,47 +0,0 @@ -### -# #%L -# IsisFish -# -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 1999 - 2010 CodeLutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-2.0.html>. -# #L% -### -# ------------------------------------------------------------------- -# Copyright 2002-2005 Delft University of Technology. -# -# Licensed under the Lesser General Purpose, (the "License"); -# The properties in this file control the interpreter -# ------------------------------------------------------------------- - -# ------------------------------------------------------------------- -# Copyright 2002-2005 Delft University of Technology. -# -# Licensed under the Lesser General Purpose, (the "License"); -# The properties in this file control the interpreter -# ------------------------------------------------------------------- - -# Interpreter Factory------------------------------------------------ -#interpreter.operation.factory=nl.tudelft.simulation.dsol.interpreter.operations.InterpreterFactory -#interpreter.operation.factory=nl.tudelft.simulation.dsol.interpreter.operations.reflection.ReflectionFactory -interpreter.operation.factory=nl.tudelft.simulation.dsol.interpreter.process.ProcessFactory -interpreter.operation.oracle=umontreal.iro.lecuyer.simprocs.dsol.SSJInterpretationOracle - -# Interpreter Log Level---------------------------------------------- -interpreter.logLevel=WARNING - Modified: isis-fish/trunk/src/main/resources/log4j.properties =================================================================== --- isis-fish/trunk/src/main/resources/log4j.properties 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/resources/log4j.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 2005 - 2010 Ifremer, CodeLutin +# Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -31,7 +31,8 @@ # package level log4j.logger.fr.ifremer.isisfish=INFO -log4j.logger.org.nuiton=INFO +log4j.logger.org.nuiton.j2r=DEBUG +log4j.logger.org.nuiton=WARN log4j.logger.analyseplans=INFO log4j.logger.exports=INFO log4j.logger.formules=INFO Modified: isis-fish/trunk/src/main/xmi/isis-fish.properties =================================================================== --- isis-fish/trunk/src/main/xmi/isis-fish.properties 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/main/xmi/isis-fish.properties 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 1999 - 2010 Ifremer, CodeLutin +# Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -22,7 +22,7 @@ # <http://www.gnu.org/licenses/gpl-2.0.html>. # #L% ### -model.tagvalue.copyright=/* Copyright (C) 1999 - 2010 Ifremer - Code Lutin */ +model.tagvalue.copyright=/* Copyright (C) 1999 - 2011 Ifremer - Code Lutin */ model.tagvalue.org.nuiton.math.matrix.MatrixND=fr.ifremer.isisfish.types.hibernate.MatrixType(name,dim,dimNames,semantics,data) model.tagvalue.fr.ifremer.isisfish.types.Month=fr.ifremer.isisfish.types.hibernate.MonthType model.tagvalue.fr.ifremer.isisfish.types.Date=fr.ifremer.isisfish.types.hibernate.DateType @@ -30,4 +30,27 @@ model.tagvalue.fr.ifremer.isisfish.types.RangeOfValues=fr.ifremer.isisfish.types.hibernate.RangeOfValuesType model.tagvalue.java.lang.String=text model.tagvalue.hibernateProxyInterface=none -model.tagvalue.useLegacyDAO=true \ No newline at end of file +model.tagvalue.constantPrefix=PROPERTY_ +fr.ifremer.isisfish.entities.ActiveRule.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Cell.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.EffortDescription.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Equation.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.FisheryRegion.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Gear.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Metier.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.MetierSeasonInfo.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Population.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.PopulationGroup.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.PopulationSeasonInfo.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Port.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Result.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Selectivity.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Season.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.SetOfVessels.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Species.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Strategy.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.StrategyMonthInfo.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.TargetSpecies.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.TripType.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.VesselType.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Zone.class.tagvalue.contextable=true Modified: isis-fish/trunk/src/main/xmi/isis-fish.zargo =================================================================== (Binary files differ) Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/AbstractIsisFishTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/AbstractIsisFishTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/AbstractIsisFishTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -33,7 +33,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -import fr.ifremer.isisfish.datastore.TestIsisH2Config; +import fr.ifremer.isisfish.datastore.AutoMigrationIsisH2Config; import fr.ifremer.isisfish.util.ClasspathTemplateLoader; import freemarker.cache.TemplateLoader; import freemarker.ext.beans.BeansWrapper; @@ -98,7 +98,7 @@ // install a new topia migration service callback // to not ask for user for migration during test - TestIsisH2Config.setTestMigrationCallBack(); + AutoMigrationIsisH2Config.setTestMigrationCallBack(); FileUtils.copyDirectory(new File("src/test/resources/test-database"), dirDatabase, new FileFilter() { @@ -112,8 +112,6 @@ return result; } }); - - IsisFish.doNuitonMigration(); } /** Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/IsisFishMiscTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/IsisFishMiscTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/IsisFishMiscTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,7 +29,6 @@ import java.io.IOException; import org.apache.commons.io.FileUtils; -import org.h2.engine.Constants; import org.junit.Assert; import org.junit.Test; @@ -64,17 +63,4 @@ Assert.assertTrue("File is not valide for Windows on line " + index, lines[index].endsWith("\r")); } } - - /** - * Test that h2 version is < 1.2.129. - * - * Upgrading from < 1.1.x to 1.2.129 doesn't work - * Since page store has been changed in 1.2.x release, and removed since 1.2.129. - */ - @Test - public void testH2Version() { - Assert.assertEquals(1, Constants.VERSION_MAJOR); - Assert.assertEquals(2, Constants.VERSION_MINOR); - Assert.assertTrue("Using H2 >= 1.2.129 will not work", Constants.BUILD_ID < 129); - } } Copied: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java (from rev 3392, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java) =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java (rev 0) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,47 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore; + +import fr.ifremer.isisfish.datastore.migration.AutoDatabaseMigrationClass; + +/** + * Empty class used to access inherited static field. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class AutoMigrationIsisH2Config extends IsisH2Config { + + /** + * Override default migration with test one. + */ + public static void setTestMigrationCallBack() { + databaseMigrationClass = AutoDatabaseMigrationClass.class; + } +} Deleted: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,50 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.datastore; - -import org.junit.Ignore; - -import fr.ifremer.isisfish.datastore.migration.TestMigrationCallbackHandler; - -/** - * Empty class used to access inherited static field. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ - at Ignore -public class TestIsisH2Config extends IsisH2Config { - - /** - * Override default migration with test one. - */ - public static void setTestMigrationCallBack() { - databaseMigrationClass = TestMigrationCallbackHandler.class; - } -} Copied: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java (from rev 3392, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java) =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java (rev 0) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,51 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2007 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.datastore.migration; + +import java.util.List; + +import org.nuiton.util.Version; + +/** + * Test migration callback for topia migration service. + * But for test purpose, don't ask user, always do migration. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author: chatellier $ + */ +public class AutoDatabaseMigrationClass extends DatabaseMigrationClass { + + /* + * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#askUser(org.nuiton.util.Version, java.util.List) + */ + @Override + public boolean askUser(Version dbVersion, List<Version> versions) { + return true; + } +} Deleted: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,55 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2007 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.datastore.migration; - -import org.junit.Ignore; -import org.nuiton.topia.migration.DatabaseManager; - -/** - * Test migration callback for topia migration service. - * But for test purpose, don't ask user, always do migration. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author: chatellier $ - */ - at Ignore -public class TestMigrationCallbackHandler extends SwingMigrationCallbackHandler { - - /* - * @see org.nuiton.topia.migration.callback.MigrationCallbackHandler#doMigration(java.lang.String, java.lang.String) - */ - @Override - public MigrationChoice doMigration(DatabaseManager dbManager, - String dbVersion, String applicationVersion) { - - // test always perform migration without ask user - MigrationChoice result = migrate(dbManager, dbVersion, applicationVersion); - return result; - } -} Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,7 +29,6 @@ import java.awt.HeadlessException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import javax.swing.Box; @@ -61,21 +60,14 @@ public class PopulationSeasonInfoTest extends AbstractIsisFishTest { /** Logger for this class */ - private static final Log log = LogFactory - .getLog(PopulationSeasonInfoTest.class); + private static final Log log = LogFactory.getLog(PopulationSeasonInfoTest.class); - @Test - public void testToString() { - String[] s = new String[] { "toto", "titi", "tutu" }; - System.out.println(Arrays.toString(s)); - } - /* * Test method for 'fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl.getGroupChangeMatrix(Month)' */ @Test public void testGetGroupChangeMatrix() throws InterruptedException { - System.out.println("begin"); + int nbrAge = 3; int nbrZone = 2; boolean groupplus = true; @@ -142,8 +134,6 @@ log.error("No X11 display available", he); } } - - System.out.println("end"); } /** Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Chatellier Eric + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,43 +27,69 @@ import java.io.File; import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.SortedMap; +import java.util.TreeMap; +import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixHelper; import org.nuiton.math.matrix.MatrixND; import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.AbstractIsisFishTest; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.RuleStorage; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.rule.RuleHelper; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; /** * Test for MexicoHelper class. * * @author chatellier - * @version $Revision: 1526 $ + * @version $Revision$ * - * Last update: $Date: 2008-10-07 18:46:13 +0200 (mar 07 oct 2008) $ by : - * $Author: tchemit $ + * Last update: $Date$ by : + * $Author$ */ public class MexicoHelperTest extends AbstractIsisFishTest { /** Commons logging log. */ private static Log log = LogFactory.getLog(MexicoHelperTest.class); + protected TopiaContext regionContext; + + @Before + public void setUpRegion() { + RegionStorage regionStorage = RegionStorage.getRegion("BaseMotosICA"); + regionContext = regionStorage.getStorage(); + } + /** * Get a test design plan composed with all possibles value types. * + * @param useGroupAndRule build design plan with sub factor groups * @return a test design plan + * @throws IsisFishException */ - protected DesignPlan getTestDesignPlan() { + protected DesignPlan getTestDesignPlan(boolean useGroupAndRule) throws IsisFishException { DesignPlan designPlan = new DesignPlan(); // matrix 1 @@ -76,17 +102,30 @@ matrix1.setValue(new int[] { 2, 0 }, 12); matrix1.setValue(new int[] { 2, 1 }, -1); + // rule 1, species = c'est une des especes de la base BaseMotosICA + Rule ruleTacPoids = RuleStorage.getRule("TACpoids").getNewRuleInstance(); + Properties props = new Properties(); + props.setProperty("rule.0.parameter.species", "fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378"); + RuleHelper.populateRule(0, regionContext, ruleTacPoids, props); + + // rule 2, species = c'est une des especes de la base BaseMotosICA + Rule ruleTailleMin = RuleStorage.getRule("TailleMin").getNewRuleInstance(); + props = new Properties(); + props.setProperty("rule.0.parameter.species", "fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378"); + props.setProperty("rule.0.parameter.propSurvie", "42"); + RuleHelper.populateRule(0, regionContext, ruleTailleMin, props); + // factor 1 - Factor<Double, Double> factorContinuous = new Factor<Double, Double>("factor 1 (double continuous)"); - ContinuousDomain<Double, Double> domain1 = new ContinuousDomain<Double, Double>(); + Factor factorContinuous = new Factor("factor 1 (double continuous)"); + ContinuousDomain domain1 = new ContinuousDomain(); domain1.setMinBound(0.0); domain1.setMaxBound(50.0); factorContinuous.setDomain(domain1); factorContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength"); // factor 2 - Factor<Double, Double> factorDiscrete = new Factor<Double, Double>("factor 2 (double discrete)"); - DiscreteDomain<Double, Double> domain2 = new DiscreteDomain<Double, Double>(); + Factor factorDiscrete = new Factor("factor 2 (double discrete)"); + DiscreteDomain domain2 = new DiscreteDomain(); domain2.getValues().put(0.0, 12.3); domain2.getValues().put(1.0, 70.9); domain2.getValues().put(2.0, 21.0); @@ -97,8 +136,8 @@ factorDiscrete.setValue(3.0); // factor 3 - Factor<Integer, Double> factorContinuous2 = new Factor<Integer, Double>("factor 3 (integer discrete)"); - DiscreteDomain<Integer, Double> domain3 = new DiscreteDomain<Integer, Double>(); + Factor factorContinuous2 = new Factor("factor 3 (integer discrete)"); + DiscreteDomain domain3 = new DiscreteDomain(); domain3.getValues().put(0.0, 13); domain3.getValues().put(1.0, 14); domain3.getValues().put(2.0, 45); @@ -106,59 +145,102 @@ factorContinuous2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength"); // factor 4 - Factor<MatrixND, Double> factorMatrixContinuous = new Factor<MatrixND, Double>("factor 4 (MatrixContinuous)"); + Factor factorMatrixContinuous = new Factor("factor 4 (MatrixContinuous)"); MatrixContinuousDomain domain4 = new MatrixContinuousDomain(); domain4.setCoefficient(0.799); - domain4.setMatrix(matrix1); - domain4.setOperator("-"); + domain4.setReferenceValue(matrix1); + domain4.setPercentageType(true); factorMatrixContinuous.setDomain(domain4); factorMatrixContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength"); // factor 5 - Factor<Double, Double> factorEquationContinuous = new Factor<Double, Double>("factor 5 (EquationContinuous)"); + Factor factorEquationContinuous = new Factor("factor 5 (EquationContinuous)"); EquationContinuousDomain domain5 = new EquationContinuousDomain(); domain5.setCoefficient(0.1); domain5.setReferenceValue(45.0); domain5.setVariableName("L1"); - domain5.setOperator("-"); + domain5.setPercentageType(true); factorEquationContinuous.setDomain(domain5); factorEquationContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength"); - designPlan.getFactors().add(factorContinuous); - designPlan.getFactors().add(factorDiscrete); - designPlan.getFactors().add(factorContinuous2); - designPlan.getFactors().add(factorMatrixContinuous); - designPlan.getFactors().add(factorEquationContinuous); + // factor 1 + Factor factorContinuousPercentage = new Factor("factor 6 (double continuous percentage)"); + ContinuousDomain domain6 = new ContinuousDomain(true); + domain6.setCoefficient(5.0); + domain6.setReferenceValue(14.0); + domain6.setCardinality(5); + factorContinuousPercentage.setDomain(domain6); + factorContinuousPercentage.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1142003453434#0.223499349929004#size"); + // 3.4.0.0 + if (useGroupAndRule) { + + // factor 7 : rule factor + Factor factorRuleDiscrete = new Factor("factor 7 (RuleDiscrete)"); + RuleDiscreteDomain domain7 = new RuleDiscreteDomain(); + SortedMap<Object, Object> rules = new TreeMap<Object, Object>(); + rules.put("ruleset1", Arrays.asList(ruleTacPoids, ruleTailleMin)); + rules.put("ruleset2", Arrays.asList(ruleTailleMin)); + domain7.setValues(rules); + factorRuleDiscrete.setDomain(domain7); + factorRuleDiscrete.setPath("parameters.rules"); + + FactorGroup group1 = new FactorGroup("discretegrp"); + group1.addFactor(factorDiscrete); + group1.addFactor(factorRuleDiscrete); + FactorGroup group2 = new FactorGroup("continuousgrp"); + group2.addFactor(factorContinuous); + group2.addFactor(factorMatrixContinuous); + group2.addFactor(factorEquationContinuous); + + designPlan.addFactor(group1); + designPlan.addFactor(group2); + designPlan.addFactor(factorContinuous2); + } + else { + // 3.3.0.0 + designPlan.addFactor(factorContinuous); + designPlan.addFactor(factorDiscrete); + designPlan.addFactor(factorContinuous2); + designPlan.addFactor(factorMatrixContinuous); + designPlan.addFactor(factorEquationContinuous); + designPlan.addFactor(factorContinuousPercentage); + } + return designPlan; } /** * Test method {@link MexicoHelper#getDesignPlanAsXML(DesignPlan)}. * + * Sans groupe de facteur, tel qu'il était en 3.3.0.0. + * * @throws IOException + * @throws IsisFishException */ @Test - public void testGetDesignPlanAsXML() throws IOException { + public void testGetDesignPlanAsXML() throws IOException, IsisFishException { - DesignPlan testDesignPlan = getTestDesignPlan(); + DesignPlan testDesignPlan = getTestDesignPlan(false); // test xml export String xml = MexicoHelper.getDesignPlanAsXML(testDesignPlan); // factor 1 - Assert.assertTrue(xml.indexOf("<range max=\"50.0\" min=\"0.0\"/>") != -1); + Assert.assertTrue(xml.contains("<min>0.0</min>")); + Assert.assertTrue(xml.contains("<max>50.0</max>")); // factor 2 - Assert.assertTrue(xml.indexOf("<factor name=\"factor 2 (double discrete)\"") != -1); - Assert.assertTrue(xml.indexOf("<value>70.9</value>") != -1); + Assert.assertTrue(xml.contains("<factor name=\"factor 2 (double discrete)\"")); + Assert.assertTrue(xml.contains("<value>70.9</value>")); // factor 3 - Assert.assertTrue(xml.indexOf("<value>14</value>") != -1); + Assert.assertTrue(xml.contains("<value>14</value>")); // factor 4 - Assert.assertTrue(xml.indexOf("<d>-14.0</d>") != -1); - Assert.assertTrue(xml.indexOf("0.799") != -1); - Assert.assertTrue(xml.indexOf("<mx name=\"test1\">") != -1); + Assert.assertTrue(xml.contains("<d>-14.0</d>")); + Assert.assertTrue(xml.contains("0.799")); + Assert.assertTrue(xml.contains("<mx name=\"test1\">")); // factor 5 - Assert.assertTrue(xml.indexOf("reference=\"45.0\" variable=\"L1\"") != -1); + Assert.assertTrue(xml.contains("<fixed cardinality=\"0\" variable=\"L1\">")); + Assert.assertTrue(xml.contains("<reference coefficient=\"0.1\">45.0</reference>")); if (log.isDebugEnabled()) { log.debug("testGetDesignPlanAsXML xml = " + xml); @@ -168,6 +250,8 @@ /** * Test method {@link MexicoHelper#getDesignPlanFromXML(File, TopiaContext)}. * + * Sans groupe de facteur. + * * @throws IOException */ @Test @@ -176,25 +260,33 @@ File testFile = new File("src/test/resources/mexico/mexicohelper_designplan.xml"); // topia context can be null in tests DesignPlan plan = MexicoHelper.getDesignPlanFromXML(testFile, null); + List<Factor> factors = plan.getFactors(); - Assert.assertEquals(5, plan.getFactors().size()); + Assert.assertEquals(6, factors.size()); String xml = MexicoHelper.getDesignPlanAsXML(plan); if (log.isDebugEnabled()) { log.debug("testGetDesignPlanFromXML xml = " + xml); } + + // assert on continuous factor (percentage, non percentage) (3.4.0.0) + ContinuousDomain domain1 = (ContinuousDomain)factors.get(0).getDomain(); + Assert.assertNull(domain1.getCoefficient()); + ContinuousDomain domain6 = (ContinuousDomain)factors.get(5).getDomain(); + Assert.assertNotNull(domain6.getCoefficient()); } /** * Test que l'export XML de l'import XML produise le meme xml. * * @throws IOException + * @throws IsisFishException */ @Test - public void testExportImport() throws IOException { + public void testExportImport() throws IOException, IsisFishException { // first export - DesignPlan testDesignPlan = getTestDesignPlan(); + DesignPlan testDesignPlan = getTestDesignPlan(false); String xml1 = MexicoHelper.getDesignPlanAsXML(testDesignPlan); if (log.isDebugEnabled()) { log.debug("xml 1 = " + xml1); @@ -203,11 +295,192 @@ // export File testFile = new File("src/test/resources/mexico/mexicohelper_designplan.xml"); // topia context can be null in tests - DesignPlan plan = MexicoHelper.getDesignPlanFromXML(testFile, null); + DesignPlan plan = MexicoHelper.getDesignPlanFromXML(testFile, regionContext); String xml2 = MexicoHelper.getDesignPlanAsXML(plan); if (log.isDebugEnabled()) { log.debug("xml 2 = " + xml2); } Assert.assertEquals(xml1, xml2); } + + /** + * Test le chargement des groupes de facteurs et des facteurs de type + * regles depuis isis 3.4.0.0. + * + * @throws IOException + * @throws IsisFishException + */ + @Test + public void testFactorGroupAndRule() throws IOException, IsisFishException { + + DesignPlan testDesignPlan = getTestDesignPlan(true); + + // test xml export + String xml = MexicoHelper.getDesignPlanAsXML(testDesignPlan); + + // factor groups + Assert.assertTrue(xml.indexOf("<factors name=\"continuousgrp\">") != -1); + Assert.assertTrue(xml.indexOf("<factors name=\"continuousgrp\">") != -1); + + // factor 6 + Assert.assertTrue(xml.indexOf("<rule name=\"TACpoids\">") != -1); + Assert.assertTrue(xml.indexOf("<rule name=\"TailleMin\">") != -1); + Assert.assertTrue(xml.indexOf("<param key=\"rule.0.parameter.propSurvie\">42.0</param>") != -1); + Assert.assertTrue(xml.indexOf("<param key=\"rule.0.parameter.species\">fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378</param>") != -1); + + if (log.isDebugEnabled()) { + log.debug("testFactorGroupAndRule xml = " + xml); + } + } + + /** + * Test que l'export XML de l'import XML produise le meme xml. + * + * @throws IOException + * @throws IsisFishException + */ + @Test + public void testExportImportWithGroup() throws IOException, IsisFishException { + + // first export + DesignPlan testDesignPlan = getTestDesignPlan(true); + String xml1 = MexicoHelper.getDesignPlanAsXML(testDesignPlan); + if (log.isDebugEnabled()) { + log.debug("xml 1 = " + xml1); + } + + // export + File testFile = new File("src/test/resources/mexico/mexicohelper_factorgroupdp.xml"); + // topia context can be null in tests + DesignPlan plan = MexicoHelper.getDesignPlanFromXML(testFile, regionContext); + String xml2 = MexicoHelper.getDesignPlanAsXML(plan); + if (log.isDebugEnabled()) { + log.debug("xml 2 = " + xml2); + } + Assert.assertEquals(xml1, xml2); + } + + /** + * Test l'ajout des nouveaux type de facteurs, min/max et pourcentage. + * + * @throws IOException + * @throws IsisFishException + */ + @Test + public void testPercentageMinMaxFactor() throws IOException, IsisFishException { + + // get test plan and add some STRANGES factors + DesignPlan testDesignPlan = getTestDesignPlan(false); + + // matrix 1 + MatrixND matrix1 = MatrixFactory.getInstance().create("test1", + new int[] { 3, 2 }, new String[] { "col1", "col2" }); + matrix1 = MatrixHelper.convertToId(matrix1); + + // factor x1 + Factor factorContinuous = new Factor("factor x1"); + ContinuousDomain domain1 = new ContinuousDomain(true); + domain1.setReferenceValue(42.0); + domain1.setCoefficient(0.05); + factorContinuous.setDomain(domain1); + factorContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength"); + + // factor x4 + Factor factorMatrixContinuous = new Factor("factor x4"); + MatrixContinuousDomain domain4 = new MatrixContinuousDomain(); + domain4.setMinBound(matrix1); + domain4.setMaxBound(matrix1); + factorMatrixContinuous.setDomain(domain4); + factorMatrixContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength"); + + // factor x5 + Factor factorEquationContinuous = new Factor("factor x5"); + EquationContinuousDomain domain5 = new EquationContinuousDomain(); + domain5.setMinBound(40.0); + domain5.setMaxBound(50.0); + domain5.setVariableName("Lx1"); + factorEquationContinuous.setDomain(domain5); + factorEquationContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength"); + + testDesignPlan.addFactor(factorContinuous); + testDesignPlan.addFactor(factorMatrixContinuous); + testDesignPlan.addFactor(factorEquationContinuous); + + // test write + String content = MexicoHelper.getDesignPlanAsXML(testDesignPlan); + File tempFile = File.createTempFile("testdesignplan", ".xml"); + tempFile.deleteOnExit(); + FileUtils.writeStringToFile(tempFile, content); + + // test to read it and get content + DesignPlan plan = MexicoHelper.getDesignPlanFromXML(tempFile, null); + String reReadContent = MexicoHelper.getDesignPlanAsXML(plan); + + Assert.assertEquals(content, reReadContent); + } + + /** + * Test l'ajout des nouveaux type de facteurs equation discrete. + * + * @throws IOException + * @throws IsisFishException + */ + @Test + public void testDiscreteEquationFactor() throws IOException, IsisFishException { + + // get test plan and add some STRANGES factors + DesignPlan testDesignPlan = getTestDesignPlan(false); + + // factor x6 + Factor factorEquationDiscrete = new Factor("factor x6"); + EquationDiscreteDomain domain6 = new EquationDiscreteDomain(); + domain6.getValues().put("1", "if ( context.getValue() < 1.0) {\n\treturn 1.0;\n} else {\treturn context.getValue();\n}"); + domain6.getValues().put("2", "if ( context.getValue() < 1.666) {\n\treturn 1.666;\n} else {\treturn context.getValue();\n}"); + factorEquationDiscrete.setDomain(domain6); + factorEquationDiscrete.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength"); + + testDesignPlan.addFactor(factorEquationDiscrete); + + // test write + String content = MexicoHelper.getDesignPlanAsXML(testDesignPlan); + Assert.assertTrue(content.contains("context.getValue() < 1.0")); + + File tempFile = File.createTempFile("testdesignplan", ".xml"); + tempFile.deleteOnExit(); + FileUtils.writeStringToFile(tempFile, content); + + // test to read it and get content + DesignPlan plan = MexicoHelper.getDesignPlanFromXML(tempFile, null); + String reReadContent = MexicoHelper.getDesignPlanAsXML(plan); + + Assert.assertEquals(content, reReadContent); + } + + /** + * Test que l'export XML de l'import XML produise le meme xml. + * Pareil, mais pour une version v2 du schema xml. + * + * @throws IOException + * @throws IsisFishException + */ + @Test + public void testExportImportV2() throws IOException, IsisFishException { + + // first export + DesignPlan testDesignPlan = getTestDesignPlan(false); + String xml1 = MexicoHelper.getDesignPlanAsXML(testDesignPlan); + if (log.isDebugEnabled()) { + log.debug("xml 1 = " + xml1); + } + + // export + File testFile = new File("src/test/resources/mexico/mexicohelper_designplanV2.xml"); + // topia context can be null in tests + DesignPlan plan = MexicoHelper.getDesignPlanFromXML(testFile, regionContext); + String xml2 = MexicoHelper.getDesignPlanAsXML(plan); + if (log.isDebugEnabled()) { + log.debug("xml 2 = " + xml2); + } + Assert.assertEquals(xml1, xml2); + } } Property changes on: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -43,10 +43,10 @@ * Simulation parameter test class. * * @author chatellier - * @version $Revision: 1.0 $ + * @version $Revision$ * - * Last update : $Date: 19 mars 2009 $ - * By : $Author: chatellier $ + * Last update : $Date$ + * By : $Author$ */ public class SimulationParameterTest extends AbstractIsisFishTest { @@ -274,4 +274,15 @@ Assert.assertEquals("desc", params2.getDescription()); Assert.assertEquals(1, params2.getResultEnabled().size()); } + + /** + * Test que le log level est bien correctement recopié. + */ + @Test + public void testLogLevelCopy() { + SimulationParameter params = new SimulationParameterImpl(); + params.setSimulLogLevel("error"); + SimulationParameter newInstance = params.deepCopy(); + Assert.assertEquals("error", newInstance.getSimulLogLevel()); + } } Property changes on: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin + * Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,322 +25,52 @@ package fr.ifremer.isisfish.simulator; -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import junit.framework.Assert; - import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.ConvertUtilsBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.MatrixNDImpl; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixNDImpl; import fr.ifremer.isisfish.AbstractIsisFishTest; -import fr.ifremer.isisfish.IsisFishDAOHelper; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.StorageException; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationImpl; -import fr.ifremer.isisfish.entities.PopulationSeasonInfo; -import fr.ifremer.isisfish.entities.PopulationSeasonInfoDAO; -import fr.ifremer.isisfish.entities.VesselType; -import fr.ifremer.isisfish.entities.VesselTypeDAO; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; -import fr.ifremer.isisfish.simulator.sensitivity.Scenario; -import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; import fr.ifremer.isisfish.util.ConverterUtil; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; /** * Test for simulation prescript. * - * Creer un populationSeasonInfoDAO. - * Affectation de la matrice m1. - * Le prescript doit la changer en m2. - * * @author chatellier - * @version $Revision: 1.0 $ + * @version $Revision$ * - * Last update : $Date: 24 févr. 2009 $ - * By : $Author: chatellier $ + * Last update : $Date$ + * By : $Author$ */ public class SimulationPreScriptTest extends AbstractIsisFishTest { - - /** log. */ - private static Log log = LogFactory.getLog(SimulationPreScriptTest.class); - - protected static Configuration freemarkerConfiguration; @Before public void setUp() throws Exception { // not do it in @BeforeClass // test will fail ! init(); - freemarkerConfiguration = getFreemarkerConfiguration(); // very important , other test wil fail with that //System.setProperty("hibernate.hbm2ddl.auto", "create"); } - + @After public void tearDown() { // very important , other test wil fail with that //System.clearProperty("hibernate.hbm2ddl.auto"); } - - /** - * Creer un simulation. - * - * @throws IOException - * @throws TemplateException - * @throws StorageException - * @throws TopiaException - * - * FIXME fix this test (empty schema error) - */ - @Test - public void testFactorPreScriptFactorInt() throws IOException, TemplateException, StorageException, TopiaException { - String topiaId = null; - - // init simulation - SimulationContext context = SimulationContext.get(); - SimulationParameter params = new SimulationParameterImpl(); - SimulationStorage simulation = SimulationStorage.create("test_1_int", params); - TopiaContext storageContext = simulation.getStorage(); - storageContext.createSchema(); - TopiaContext childStorageContext = storageContext.beginTransaction(); - VesselTypeDAO vesselTypeDAO = IsisFishDAOHelper.getVesselTypeDAO(childStorageContext); - VesselType vesselType = vesselTypeDAO.create(); - vesselType.setLength(4); - vesselType.update(); - topiaId = vesselType.getTopiaId(); - childStorageContext.commitTransaction(); - - // factor - Factor<Integer,Integer> factor = new Factor<Integer,Integer>("testint"); - ContinuousDomain<Integer,Integer> domain = new ContinuousDomain<Integer,Integer>(); - domain.setMinBound(0); - domain.setMaxBound(50); - factor.setDomain(domain); - factor.setPath(topiaId + "#length"); - factor.setValueForIdentifier(49); - - Assert.assertEquals((Integer)49, factor.getValue()); - - // scenario - Scenario scenario = new Scenario(); - List<Factor> factors = new ArrayList<Factor>(); - factors.add(factor); - scenario.setFactors(factors); - - // context values - Map<String, Object> root = new HashMap<String, Object>(); - root.put("scenario", scenario); - root.put("beanUtils", ConverterUtil.getConverter(null)); - - // process template - Template template = freemarkerConfiguration - .getTemplate("templates/prescript/factorprescript.ftl"); - Writer out = new StringWriter(); - template.process(root, out); - out.flush(); - String scriptContent = out.toString(); - log.info("Script = " + scriptContent); - - // - SimulationPreScript simulationPreScript = new SimulationPreScript(); - params.setUsePreScript(true); - params.setPreScript(scriptContent); - - context.setSimulationStorage(simulation); - // FIXME here is the error, getDb throw exception - //simulationPreScript.beforeSimulation(context); - SimulationContext.remove(); - - // try to find previous entity - vesselType = vesselTypeDAO.findByTopiaId(topiaId); - - // FIXME should test value remplaced by precript - //Assert.assertEquals(49, vesselType.getLength()); - } - /** - * Creer un simulation. - * Creer un populationSeasonInfoDAO. - * Affectation de la matrice m1. - * Le prescript doit la changer en m2. - * - * @throws IOException - * @throws TemplateException - * @throws StorageException - * @throws TopiaException - * - * FIXME fix this test (empty schema error) - */ - @Test - public void testFactorPreScriptFactorMatrix() throws IOException, TemplateException, StorageException, TopiaException { - - // matrix 1 - MatrixND matrix1 = MatrixFactory.getInstance().create("test1", - new int[] { 3, 2 }, new String[] { "col1", "col2" }); - matrix1.setValue(new int[] { 0, 0 }, 13); - matrix1.setValue(new int[] { 0, 1 }, -14); - matrix1.setValue(new int[] { 1, 0 }, 21); - matrix1.setValue(new int[] { 1, 1 }, 2); - matrix1.setValue(new int[] { 2, 0 }, 12); - matrix1.setValue(new int[] { 2, 1 }, -1); - - // matrix 2 - MatrixND matrix2 = MatrixFactory.getInstance().create("test2", - new int[] { 2, 3 }, new String[] { "col1", "col2" }); - matrix2.setValue(new int[] { 0, 0 }, 9999); - matrix2.setValue(new int[] { 0, 1 }, 15000); - matrix2.setValue(new int[] { 0, 2 }, -40000); - matrix2.setValue(new int[] { 1, 0 }, 21345); - matrix2.setValue(new int[] { 1, 1 }, 81000); - matrix2.setValue(new int[] { 1, 2 }, -13000); - - String topiaId = null; - - // init simulation - SimulationContext context = SimulationContext.get(); - SimulationParameter params = new SimulationParameterImpl(); - SimulationStorage simulation = SimulationStorage.create("test_2_matrix", params); - TopiaContext storageContext = simulation.getStorage(); - storageContext.createSchema(); - TopiaContext childStorageContext = storageContext.beginTransaction(); - PopulationSeasonInfoDAO populationSeasonInfoDAO = IsisFishDAOHelper.getPopulationSeasonInfoDAO(childStorageContext); - PopulationSeasonInfo populationSeasonInfo = populationSeasonInfoDAO.create(); - populationSeasonInfo.setMigrationMatrix(matrix1); - populationSeasonInfo.update(); - topiaId = populationSeasonInfo.getTopiaId(); - childStorageContext.commitTransaction(); - - // factor - Factor<MatrixND,String> factor1 = new Factor<MatrixND,String>("testmatrix"); - DiscreteDomain<MatrixND,String> domain1 = new DiscreteDomain<MatrixND,String>(); - domain1.getValues().put("m1", matrix1); - factor1.setDomain(domain1); - factor1.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); - factor1.setValueForIdentifier("m1"); - - // factor - Factor<MatrixND,String> factor2 = new Factor<MatrixND,String>("testmatrix"); - DiscreteDomain<MatrixND,String> domain2 = new DiscreteDomain<MatrixND,String>(); - domain2.getValues().put("m2", matrix1); - factor2.setDomain(domain2); - factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); - factor2.setValueForIdentifier("m2"); - - // scenario - Scenario scenario = new Scenario(); - List<Factor> factors = new ArrayList<Factor>(); - factors.add(factor1); - factors.add(factor2); - scenario.setFactors(factors); - - // context values - Map<String, Object> root = new HashMap<String, Object>(); - root.put("scenario", scenario); - root.put("beanUtils", ConverterUtil.getConverter(null)); - - // process template - Template template = freemarkerConfiguration - .getTemplate("templates/prescript/factorprescript.ftl"); - Writer out = new StringWriter(); - template.process(root, out); - out.flush(); - String scriptContent = out.toString(); - log.info("Script = " + scriptContent); - - // - SimulationPreScript simulationPreScript = new SimulationPreScript(); - params.setUsePreScript(true); - params.setPreScript(scriptContent); - - context.setSimulationStorage(simulation); - // FIXME here is the error, getDb throw exception - //simulationPreScript.beforeSimulation(context); - SimulationContext.remove(); - - // try to find previous entity - populationSeasonInfo = populationSeasonInfoDAO.findByTopiaId(topiaId); - // FIXME should test value remplaced by precript - //Assert.assertEquals(matrix2, populationSeasonInfo.getMigrationMatrix()); - } - - /** - * Creer un scenario basé sur les EquationDomain. - * - * @throws IOException - * @throws TemplateException - * @throws StorageException - * @throws TopiaException - */ - @Test - public void testFactorPreScriptEquation() throws IOException, TemplateException, StorageException, TopiaException { - - // factor - Factor<Double,Double> factorEquation = new Factor<Double,Double>("test.equation.name"); - EquationContinuousDomain domain1 = new EquationContinuousDomain(); - domain1.setReferenceValue(3.0); - domain1.setOperator("-"); - domain1.setCoefficient(0.1); - domain1.setVariableName("K1"); - factorEquation.setDomain(domain1); - factorEquation.setPath("fr.ifremer.equation1#testFactorPreScriptEquation"); - factorEquation.setValueForIdentifier(0.1); - - log.info("Script = " + domain1.getClass().getSimpleName()); - - // scenario - Scenario scenario = new Scenario(); - List<Factor> factors = new ArrayList<Factor>(); - factors.add(factorEquation); - scenario.setFactors(factors); - - // context values - Map<String, Object> root = new HashMap<String, Object>(); - root.put("scenario", scenario); - root.put("beanUtils", ConverterUtil.getConverter(null)); - - // process template - Template template = freemarkerConfiguration.getTemplate("templates/prescript/factorprescript.ftl"); - Writer out = new StringWriter(); - template.process(root, out); - out.flush(); - String scriptContent = out.toString(); - log.info("Script = " + scriptContent); - //Assert.assertTrue(scriptContent.indexOf("\"PopulationEquation.K1\", 0.68, \"-\"") != -1); - - // le nom de la valeur de la variable n'apparait pas "en elle meme" - // dans le prescript, il y a seulement le nom - // du facteur. Charge à l'UI de savoir comment l'afficher - Assert.assertTrue(scriptContent.indexOf("\"test.equation.name\", 0.68, \"-\"") != -1); - - Assert.assertTrue(scriptContent.indexOf("K1") == -1); - } - - /** * Test que les chaine represantant des matrices sont correctement * transformée en MatrixND. * Property changes on: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin + * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -27,37 +27,54 @@ import java.util.ArrayList; import java.util.List; +import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixHelper; import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; import fr.ifremer.isisfish.AbstractIsisFishTest; +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.RuleStorage; +import fr.ifremer.isisfish.datastore.StorageException; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; import fr.ifremer.isisfish.entities.PopulationImpl; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.StrategyImpl; import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.rule.RuleHelper; import fr.ifremer.isisfish.simulator.SimulationParameter; import fr.ifremer.isisfish.simulator.SimulationParameterImpl; import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan; import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; +import fr.ifremer.isisfish.simulator.sensitivity.Scenario; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculatorRandomMock; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; /** * Test for {@link SimulationService}. * * @author chatellier - * @version $Revision: 1.0 $ + * @version $Revision$ * - * Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $ + * Last update : $Date$ By : $Author$ */ public class SimulationServiceTest extends AbstractIsisFishTest { @@ -80,8 +97,8 @@ DesignPlan designPlan = new DesignPlan(); // factor 1 - Factor<Double,Double> factor1 = new Factor<Double,Double>("factor 1 (double)"); - ContinuousDomain<Double,Double> domain1 = new ContinuousDomain<Double,Double>(); + Factor factor1 = new Factor("factor 1 (double)"); + ContinuousDomain domain1 = new ContinuousDomain(); domain1.setMinBound(0.0); domain1.setMaxBound(50.0); domain1.setCardinality(4); @@ -89,28 +106,28 @@ factor1.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength"); // factor 2 - /*Factor<Double> factor2 = new Factor<Double>("factor 2 (double)"); - DiscreteDomain<Double> domain2 = new DiscreteDomain<Double>(); + Factor factor2 = new Factor("factor 2 (double)"); + DiscreteDomain domain2 = new DiscreteDomain(); domain2.getValues().put(0.0, 12.3); domain2.getValues().put(1.0, 70.9); domain2.getValues().put(2.0, 21.0); domain2.getValues().put(3.0, -12.1); domain2.getValues().put(4.0, -8.45); factor2.setDomain(domain2); - factor2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength");*/ + factor2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength"); // factor 3 - Factor<Double,Double> factor3 = new Factor<Double,Double>("factor 3 (double)"); - ContinuousDomain<Double,Double> domain3 = new ContinuousDomain<Double,Double>(); + Factor factor3 = new Factor("factor 3 (double)"); + ContinuousDomain domain3 = new ContinuousDomain(); domain3.setMinBound(12.0); domain3.setMaxBound(99.0); domain3.setCardinality(4); factor3.setDomain(domain3); factor3.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength"); - designPlan.getFactors().add(factor1); - //designPlan.getFactors().add(factor2); - designPlan.getFactors().add(factor3); + designPlan.addFactor(factor1); + //designPlan.add(factor2); + designPlan.addFactor(factor3); return designPlan; } @@ -144,8 +161,8 @@ matrix2.setValue(new int[] { 2, 1 }, -1); // factor 1 - Factor<MatrixND,Double> factor1 = new Factor<MatrixND,Double>("factor 1 (matrixND)"); - DiscreteDomain<MatrixND,Double> domain1 = new DiscreteDomain<MatrixND,Double>(); + Factor factor1 = new Factor("factor 1 (matrixND)"); + DiscreteDomain domain1 = new DiscreteDomain(); domain1.getValues().put(0.0, matrix1); domain1.getValues().put(1.0, matrix2); factor1.setDomain(domain1); @@ -206,4 +223,306 @@ } } } + + /** + * Test la generation de facteur simple. + * + * @throws StorageException + * @throws TopiaException + */ + @Test + public void testFactorPreScriptFactor() throws StorageException, TopiaException { + + // factor + Factor factor = new Factor("test"); + ContinuousDomain domain = new ContinuousDomain(); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); + factor.setDomain(domain); + factor.setPath("fr.ifremer.entities.Cell#1234567890#length"); + factor.setValueForIdentifier(0.5); + + Assert.assertEquals(25.0, factor.getValue()); + + // scenario + Scenario scenario = new Scenario(); + List<Factor> factors = new ArrayList<Factor>(); + factors.add(factor); + scenario.setFactors(factors); + + SimulationService service = SimulationService.getService(); + String scriptContent = service.generatePreScript(scenario); + Assert.assertTrue(scriptContent.contains("java.lang.Double")); + Assert.assertTrue(scriptContent.contains("db.findByTopiaId(\"fr.ifremer.entities.Cell#1234567890\")")); + Assert.assertTrue(scriptContent.contains("BeanUtils.setProperty(entity0, \"length\"")); + } + + /** + * Creer un simulation. + * Creer un populationSeasonInfoDAO. + * + * @throws StorageException + * @throws TopiaException + */ + @Test + public void testFactorPreScriptFactorMatrix() throws StorageException, TopiaException { + + // matrix 1 + MatrixND matrix1 = MatrixFactory.getInstance().create("test1", + new int[] { 3, 2 }, new String[] { "col1", "col2" }); + matrix1.setValue(new int[] { 0, 0 }, 13); + matrix1.setValue(new int[] { 0, 1 }, -14); + matrix1.setValue(new int[] { 1, 0 }, 21); + matrix1.setValue(new int[] { 1, 1 }, 2); + matrix1.setValue(new int[] { 2, 0 }, 12); + matrix1.setValue(new int[] { 2, 1 }, -1); + + // matrix 2 + MatrixND matrix2 = MatrixFactory.getInstance().create("test2", + new int[] { 2, 3 }, new String[] { "col1", "col2" }); + matrix2.setValue(new int[] { 0, 0 }, 9999); + matrix2.setValue(new int[] { 0, 1 }, 15000); + matrix2.setValue(new int[] { 0, 2 }, -40000); + matrix2.setValue(new int[] { 1, 0 }, 21345); + matrix2.setValue(new int[] { 1, 1 }, 81000); + matrix2.setValue(new int[] { 1, 2 }, -13000); + + // factor + Factor factor1 = new Factor("testmatrix"); + DiscreteDomain domain1 = new DiscreteDomain(); + domain1.getValues().put("m1", matrix1); + factor1.setDomain(domain1); + factor1.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); + factor1.setValueForIdentifier("m1"); + + // factor + Factor factor2 = new Factor("testmatrix"); + DiscreteDomain domain2 = new DiscreteDomain(); + domain2.getValues().put("m2", matrix1); + factor2.setDomain(domain2); + factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); + factor2.setValueForIdentifier("m2"); + + // scenario + Scenario scenario = new Scenario(); + List<Factor> factors = new ArrayList<Factor>(); + factors.add(factor1); + factors.add(factor2); + scenario.setFactors(factors); + + SimulationService service = SimulationService.getService(); + String scriptContent = service.generatePreScript(scenario); + //log.info("Script = " + scriptContent); + Assert.assertTrue(scriptContent.contains("org.nuiton.math.matrix.MatrixNDImpl ")); + Assert.assertTrue(scriptContent.contains("db.findByTopiaId(\"org.nuiton.math.matrix.MatrixND#563456293453#2.456347646\");")); + Assert.assertTrue(scriptContent.contains("BeanUtils.setProperty(entity0, \"dim\"")); + } + + /** + * Creer un scenario basé sur les EquationDomain. + * + * @throws StorageException + * @throws TopiaException + */ + @Test + public void testFactorPreScriptEquation() throws StorageException, TopiaException { + + // factor + Factor factorEquation = new Factor("test.equation.name.K1"); + EquationContinuousDomain domain1 = new EquationContinuousDomain(); + domain1.setReferenceValue(10.0); + domain1.setCoefficient(0.1); + domain1.setVariableName("K1"); + domain1.setPercentageType(true); + factorEquation.setDomain(domain1); + factorEquation.setPath("fr.ifremer.equation1#testFactorPreScriptEquation"); + factorEquation.setValueForIdentifier(0.4); + + // scenario + Scenario scenario = new Scenario(); + List<Factor> factors = new ArrayList<Factor>(); + factors.add(factorEquation); + scenario.setFactors(factors); + + SimulationService service = SimulationService.getService(); + String scriptContent = service.generatePreScript(scenario); + //log.info("Script = " + scriptContent); + + // le nom de la valeur de la variable n'apparait pas "en elle meme" + // dans le prescript, il y a seulement le nom + // du facteur. Charge à l'UI de savoir comment l'afficher + Assert.assertTrue(scriptContent.contains("context.setComputeValue(\"test.equation.name.K1\",9.8)")); + } + + /** + * Test que la generation du prescript avec l'ajout des populations + * de départ et des regles de IsisFish 3.4.0.0 fonctionne correctement. + * + * @throws IsisFishException + */ + @Test + public void testPrescriptGenerationPopAndRules() throws IsisFishException { + + // get a context to a database + RegionStorage regionStorage = RegionStorage.getRegion("BaseMotosICA"); + TopiaContext regionContext = regionStorage.getStorage(); + + // build test scenario + Scenario scenario1 = new Scenario(); + + // factor pop + Factor factorPop = new Factor("myPopulationParams"); + factorPop.setDomain(new MatrixContinuousDomain()); + factorPop.setPath("parameters.population.xxx.number"); + MatrixND mat = MatrixFactory.getInstance().create(new int[]{2, 3}); + MatrixHelper.convertToId(mat); + factorPop.setValue(mat); + + // factor rule, species = c'est une des especes de la base BaseMotosICA + Rule ruleTacPoids = RuleStorage.getRule("TACpoids").getNewRuleInstance(); + Properties props = new Properties(); + props.setProperty("rule.0.parameter.species", "fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378"); + RuleHelper.populateRule(0, regionContext, ruleTacPoids, props); + Rule ruleTailleMin = RuleStorage.getRule("TailleMin").getNewRuleInstance(); + props = new Properties(); + props.setProperty("rule.0.parameter.species", "fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378"); + props.setProperty("rule.0.parameter.propSurvie", "42"); + RuleHelper.populateRule(0, regionContext, ruleTailleMin, props); + Factor factorRule = new Factor("myRuleParams"); + factorPop.setDomain(new RuleDiscreteDomain()); + factorRule.setPath("parameters.rules"); + List<Rule> rules = new ArrayList<Rule>(); + rules.add(ruleTacPoids); + rules.add(ruleTailleMin); + factorRule.setValue(rules); + + List<Factor> factors = new ArrayList<Factor>(); + factors.add(factorPop); + factors.add(factorRule); + scenario1.setFactors(factors); + + // generate prescript for that wonderfull scenario + SimulationService service = SimulationService.getService(); + String preScriptContent = service.generatePreScript(scenario1); + //log.info("Script = " + preScriptContent); + + Assert.assertTrue(preScriptContent.contains("params.setProperty(\"population.xxx.number\"")); + Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.0.parameter.species\",\"fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378\");")); + Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.1.parameter.propSurvie\",\"42.0\");")); + Assert.assertTrue(preScriptContent.contains("rules\",\"TACpoids,TailleMin\")")); + } + + /** + * Test que la generation du prescript avec l'ajout des facteurs sur + * les parametres de regles. + * + * @since 3.4.0.0 + * @throws IsisFishException + */ + @Test + public void testPrescriptGenerationRulesParameters() throws IsisFishException { + + // build test scenario + Scenario scenario1 = new Scenario(); + + // factor pop + Factor factorPop = new Factor("parameters of rule TACpoids"); + factorPop.setDomain(new MatrixContinuousDomain()); + factorPop.setPath("parameters.rule.0.parameter.tacInTons"); + factorPop.setValue(42.0); + + List<Factor> factors = new ArrayList<Factor>(); + factors.add(factorPop); + scenario1.setFactors(factors); + + // generate prescript for that wonderfull scenario + SimulationService service = SimulationService.getService(); + String preScriptContent = service.generatePreScript(scenario1); + log.info("Script = " + preScriptContent); + + Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.0.parameter.tacInTons\",\"42.0\");")); + } + + /** + * Test que la generation du prescript avec l'ajout des groupes des facteurs + * depuis IsisFish 3.4.0.0 fonctionne correctement. + * + * @throws IsisFishException + * + * FIXME echatellier replace setValueForIdentifier code + */ + @Ignore + public void testPrescriptGenerationGroups() throws IsisFishException { + + // build test scenario + Scenario scenario1 = new Scenario(); + + // factor 1 + Factor factor1 = new Factor("factor 1 (double)"); + ContinuousDomain domain1 = new ContinuousDomain(); + domain1.setMinBound(0.0); + domain1.setMaxBound(50.0); + domain1.setCardinality(4); + factor1.setDomain(domain1); + factor1.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength"); + + // factor 2 + Factor factor2 = new Factor("factor 2 (double)"); + ContinuousDomain domain2 = new ContinuousDomain(); + domain2.setMinBound(1.0); + domain2.setMaxBound(9.0); + domain2.setCardinality(3); + factor2.setDomain(domain2); + factor2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength"); + + // factor 3 + Factor factor3 = new Factor("factor 3 (double)"); + DiscreteDomain domain3 = new DiscreteDomain(); + domain3.getValues().put(0.0, 12.3); + domain3.getValues().put(1.0, 70.9); + domain3.getValues().put(2.0, 21.0); + domain3.getValues().put(3.0, -12.1); + domain3.getValues().put(4.0, -8.45); + factor3.setDomain(domain3); + factor3.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength"); + + // factor 4 + Factor factor4 = new Factor("factor 4 (double)"); + DiscreteDomain domain4 = new DiscreteDomain(); + domain4.getValues().put(0.0, -7.3); + domain4.getValues().put(1.0, 4.9); + domain4.getValues().put(2.0, -42.0); + domain4.getValues().put(3.0, 27.1); + domain4.getValues().put(4.0, 53.32); + factor4.setDomain(domain4); + factor4.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength"); + + // group continu + FactorGroup group1 = new FactorGroup("myContinuousGroup"); + group1.addFactor(factor1); + group1.addFactor(factor2); + + // group discret + FactorGroup group2 = new FactorGroup("myDiscreteGroup"); + group2.addFactor(factor3); + group2.addFactor(factor4); + + // compute AS => scenario + group1.setValueForIdentifier(0.75); + scenario1.addFactor(group1); + group2.setValueForIdentifier(2.0); + scenario1.addFactor(group2); + + // generate prescript for that wonderfull scenario + SimulationService service = SimulationService.getService(); + String preScriptContent = service.generatePreScript(scenario1); + //log.info("Script = " + preScriptContent); + + Assert.assertTrue(preScriptContent.contains("/* factor group : myContinuousGroup */")); + Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"37.5\"")); + Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"8.5\"")); + Assert.assertTrue(preScriptContent.contains("/* factor group : myDiscreteGroup */")); + Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"21.0\"")); + Assert.assertTrue(preScriptContent.contains("value4 = beanUtils.convert(\"-42.0\"")); + } } Property changes on: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -41,10 +41,10 @@ * simulation au travers de SSH. * * @author chatellier - * @version $Revision: 1.0 $ + * @version $Revision$ * - * Last update : $Date: 22 janv. 2009 $ - * By : $Author: chatellier $ + * Last update : $Date$ + * By : $Author$ */ public class SshSimulatorLauncherTest extends AbstractIsisFishTest { Property changes on: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,17 +25,23 @@ package fr.ifremer.isisfish.simulator.sensitivity; +import java.util.ArrayList; +import java.util.Collection; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Assert; +import org.junit.Test; import org.nuiton.math.matrix.MatrixFactory; import org.nuiton.math.matrix.MatrixND; -import org.junit.Assert; -import org.junit.Test; +import fr.ifremer.isisfish.rule.Rule; +import fr.ifremer.isisfish.rule.RuleMock; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; /** * Factors test. @@ -56,15 +62,15 @@ @Test public void testIntFactor() { - Factor<Integer,Integer> factor = new Factor<Integer,Integer>("testint"); - ContinuousDomain<Integer,Integer> domain = new ContinuousDomain<Integer,Integer>(); - domain.setMinBound(0); - domain.setMaxBound(50); + Factor factor = new Factor("testint"); + ContinuousDomain domain = new ContinuousDomain(); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); factor.setDomain(domain); factor.setPath("org.nuiton.factor#1234567890#0.12242345354#name"); - factor.setValueForIdentifier(49); + factor.setValueForIdentifier(0.5); - Assert.assertEquals((Integer) 49, factor.getValue()); + Assert.assertEquals(25.0, factor.getValue()); if (log.isInfoEnabled()) { log.info("factor#toString() = " + factor); @@ -100,8 +106,8 @@ matrix2.setValue(new int[] { 1, 2 }, -13000); // factor - Factor<MatrixND,String> factor = new Factor<MatrixND,String>("testmatrix"); - DiscreteDomain<MatrixND,String> domain = new DiscreteDomain<MatrixND,String>(); + Factor factor = new Factor("testmatrix"); + DiscreteDomain domain = new DiscreteDomain(); domain.getValues().put("m1", matrix1); domain.getValues().put("m2", matrix2); factor.setDomain(domain); @@ -142,21 +148,38 @@ matrix1.setValue(new int[] { 2, 0 }, 3); matrix1.setValue(new int[] { 2, 1 }, -1); + // matrix minBound + MatrixND minBound = MatrixFactory.getInstance().create("test1", + new int[]{3, 2}, new String[]{"col1", "col2"}); + minBound.setValue(new int[]{0, 0}, 0.9); + minBound.setValue(new int[]{0, 1}, -15.4); + minBound.setValue(new int[]{1, 0}, 18.9); + minBound.setValue(new int[]{1, 1}, 1.8); + minBound.setValue(new int[]{2, 0}, 2.7); + minBound.setValue(new int[]{2, 1}, -1.1); + + // matrix maxBound + MatrixND maxBound = MatrixFactory.getInstance().create("test1", + new int[]{3, 2}, new String[]{"col1", "col2"}); + maxBound.setValue(new int[]{0, 0}, 1.1); + maxBound.setValue(new int[]{0, 1}, -12.6); + maxBound.setValue(new int[]{1, 0}, 23.1); + maxBound.setValue(new int[]{1, 1}, 2.2); + maxBound.setValue(new int[]{2, 0}, 3.3); + maxBound.setValue(new int[]{2, 1}, -0.9); + // factor - Factor<MatrixND,Double> factor = new Factor<MatrixND,Double>("testmatrix"); - MatrixContinuousDomain domain = new MatrixContinuousDomain (); - domain.setMatrix(matrix1); + Factor factor = new Factor("testmatrix"); + MatrixContinuousDomain domain = new MatrixContinuousDomain(true); + domain.setReferenceValue(matrix1); domain.setCoefficient(0.1); - domain.setOperator("*"); factor.setDomain(domain); factor.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor.setValueForIdentifier(0.1); - Assert.assertEquals(0.92, factor.getValue().getValue(new int[] { 0, 0 }),0.0000001); - Assert.assertEquals(2.76, factor.getValue().getValue(new int[] { 2, 0 }),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); - Assert.assertEquals(0.1, ((MatrixContinuousDomain)factor.getDomain()).getValue(),0); + Assert.assertEquals(0.92, ((MatrixND)factor.getValue()).getValue(new int[] { 0, 0 }),0.0000001); + Assert.assertEquals(2.76, ((MatrixND)factor.getValue()).getValue(new int[] { 2, 0 }),0.0000001); + Assert.assertEquals(0.1, (Double)factor.getDisplayedValue(),0); // matrix 2 MatrixND matrix2 = MatrixFactory.getInstance().create("test1", @@ -169,19 +192,18 @@ matrix2.setValue(new int[] { 2, 1 }, -1); // factor 2 - Factor<MatrixND,Double> factor2 = new Factor<MatrixND,Double>("testmatrix"); - MatrixContinuousDomain domain2 = new MatrixContinuousDomain(); - domain2.setMatrix(matrix2); + Factor factor2 = new Factor("testmatrix"); + MatrixContinuousDomain domain2 = new MatrixContinuousDomain(true); + domain2.setReferenceValue(matrix2); domain2.setCoefficient(0.1); - domain2.setOperator("/"); factor2.setDomain(domain2); factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); - factor2.setValueForIdentifier(0.1); + factor2.setValueForIdentifier(0.2); - Assert.assertEquals(-7.0, factor2.getValue().getValue(new int[] { 0, 0 }),0.0000001); - Assert.assertEquals(-21.0, factor2.getValue().getValue(new int[] { 2, 0 }),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(0.94, ((MatrixND)factor2.getValue()).getValue(new int[] { 0, 0 }),0.0000001); + Assert.assertEquals(2.82, ((MatrixND)factor2.getValue()).getValue(new int[] { 2, 0 }),0.0000001); + //Assert.assertEquals(0,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + //Assert.assertEquals(1,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); // matrix 3 MatrixND matrix3 = MatrixFactory.getInstance().create("test1", @@ -194,19 +216,18 @@ matrix3.setValue(new int[] { 2, 1 }, -1); // factor 3 - Factor<MatrixND,Double> factor3 = new Factor<MatrixND,Double>("testmatrix"); - MatrixContinuousDomain domain3 = new MatrixContinuousDomain(); - domain3.setMatrix(matrix3); - domain3.setCoefficient(0.1); - domain3.setOperator("-"); + Factor factor3 = new Factor("testmatrix"); + MatrixContinuousDomain domain3 = new MatrixContinuousDomain(true); + domain3.setReferenceValue(matrix3); + domain3.setCoefficient(0.2); factor3.setDomain(domain3); factor3.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor3.setValueForIdentifier(0.1); - Assert.assertEquals(0.28, factor3.getValue().getValue(new int[] { 0, 0 }),0.0000001); - Assert.assertEquals(0.68, factor3.getValue().getValue(new int[] { 2, 0 }),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(0.84, ((MatrixND)factor3.getValue()).getValue(new int[] { 0, 0 }),0.0000001); + Assert.assertEquals(2.52, ((MatrixND)factor3.getValue()).getValue(new int[] { 2, 0 }),0.0000001); + //Assert.assertEquals(0,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + //Assert.assertEquals(1,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); // matrix 3 MatrixND matrix4 = MatrixFactory.getInstance().create("test1", @@ -219,19 +240,18 @@ matrix4.setValue(new int[] { 2, 1 }, -1); // factor 3 - Factor<MatrixND,Double> factor4 = new Factor<MatrixND,Double>("testmatrix"); - MatrixContinuousDomain domain4 = new MatrixContinuousDomain(); - domain4.setMatrix(matrix4); - domain4.setCoefficient(0.1); - domain4.setOperator("+"); + Factor factor4 = new Factor("testmatrix"); + MatrixContinuousDomain domain4 = new MatrixContinuousDomain(true); + domain4.setReferenceValue(matrix4); + domain4.setCoefficient(0.3); factor4.setDomain(domain4); factor4.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); - factor4.setValueForIdentifier(0.1); + factor4.setValueForIdentifier(0.4); - Assert.assertEquals(0.12, factor4.getValue().getValue(new int[] { 0, 0 }),0.0000001); - Assert.assertEquals(0.52, factor4.getValue().getValue(new int[] { 2, 0 }),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(0.94, ((MatrixND)factor4.getValue()).getValue(new int[] { 0, 0 }),0.0000001); + Assert.assertEquals(2.82, ((MatrixND)factor4.getValue()).getValue(new int[] { 2, 0 }),0.0000001); + //Assert.assertEquals(0,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + //Assert.assertEquals(1,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); if (log.isInfoEnabled()) { log.info("factor#toString() = " + factor); @@ -247,68 +267,125 @@ public void testEquationContinuousFactor() { // factor - Factor<Double,Double> factor = new Factor<Double,Double>("testequation"); - EquationContinuousDomain domain = new EquationContinuousDomain(); + Factor factor = new Factor("testequation"); + EquationContinuousDomain domain = new EquationContinuousDomain(true); domain.setCoefficient(0.1); - domain.setOperator("*"); domain.setVariableName("Linf"); domain.setReferenceValue(3.0); factor.setDomain(domain); factor.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor.setValueForIdentifier(0.1); - Assert.assertEquals(2.76, factor.getValue(),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); - Assert.assertEquals(0.1, ((EquationContinuousDomain)factor.getDomain()).getValue(),0); + Assert.assertEquals(2.76, (Double)factor.getValue(),0.0000001); + Assert.assertEquals(2.7,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + Assert.assertEquals(3.3,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); // factor 2 - Factor<Double,Double> factor2 = new Factor<Double,Double>("testequation"); - EquationContinuousDomain domain2 = new EquationContinuousDomain(); + Factor factor2 = new Factor("testequation"); + EquationContinuousDomain domain2 = new EquationContinuousDomain(true); domain2.setCoefficient(0.1); - domain2.setOperator("/"); domain2.setVariableName("Linf"); domain2.setReferenceValue(3.0); factor2.setDomain(domain2); factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor2.setValueForIdentifier(0.1); - Assert.assertEquals(-21, Double.valueOf(factor2.getValue()),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(2.76, (Double)factor2.getValue(),0.0000001); + Assert.assertEquals(2.7,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + Assert.assertEquals(3.3,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); // factor 3 - Factor<Double,Double> factor3 = new Factor<Double,Double>("testequation"); - EquationContinuousDomain domain3 = new EquationContinuousDomain(); + Factor factor3 = new Factor("testequation"); + EquationContinuousDomain domain3 = new EquationContinuousDomain(true); domain3.setCoefficient(0.1); - domain3.setOperator("+"); domain3.setVariableName("Linf"); domain3.setReferenceValue(3.0); factor3.setDomain(domain3); factor3.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); - factor3.setValueForIdentifier(0.1); + factor3.setValueForIdentifier(0.2); - Assert.assertEquals(0.52, Double.valueOf(factor3.getValue()),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(2.82, (Double)factor3.getValue(),0.0000001); + Assert.assertEquals(2.7,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + Assert.assertEquals(3.3,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); // factor 4 - Factor<Double,Double> factor4 = new Factor<Double,Double>("testequation"); - EquationContinuousDomain domain4 = new EquationContinuousDomain(); - domain4.setCoefficient(0.1); - domain4.setOperator("-"); + Factor factor4 = new Factor("testequation"); + EquationContinuousDomain domain4 = new EquationContinuousDomain(true); + domain4.setCoefficient(0.05); domain4.setVariableName("Linf"); domain4.setReferenceValue(3.0); factor4.setDomain(domain4); factor4.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor4.setValueForIdentifier(0.1); - Assert.assertEquals(0.68, Double.valueOf(factor4.getValue()),0.0000001); - Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0); - Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0); + Assert.assertEquals(2.88, (Double)factor4.getValue(),0.0000001); + Assert.assertEquals(2.7,(Double)((ContinuousDomain)factor.getDomain()).getMinBound(),0); + Assert.assertEquals(3.3,(Double)((ContinuousDomain)factor.getDomain()).getMaxBound(),0); if (log.isInfoEnabled()) { log.info("factor#toString() = " + factor); } } + + /** + * Test factor with matrix. + * + * @see MatrixND + */ + @Test + public void testRuleFactor() { + + // available rules + Rule ruleA = new RuleMock("hour restriction"); + Rule ruleB = new RuleMock("zone restriction"); + Rule ruleC = new RuleMock("ship number restriction"); + + // rules set + Collection<Rule> rules1 = new ArrayList<Rule>(); // 0 rule + Collection<Rule> rules2 = new ArrayList<Rule>(); // 1 rule + rules2.add(ruleA); + Collection<Rule> rules3 = new ArrayList<Rule>(); // 3 rule + rules3.add(ruleA); + rules3.add(ruleB); + rules3.add(ruleC); + + // factor and domain definition + Factor factor = new Factor("testrule"); + RuleDiscreteDomain ruleDomain = new RuleDiscreteDomain(); + ruleDomain.getValues().put("rules1", rules1); + ruleDomain.getValues().put("rules2", rules2); + ruleDomain.getValues().put("rules3", rules3); + factor.setDomain(ruleDomain); + + // TODO post r operation, and some asserts + } + + /** + * Assert that clone do work (with inheritance). + */ + @Test + public void testClone() { + + Factor factor = new Factor("testclone"); + factor.setPath("fr.ifremer.isisfish.entities.Cell#lenght"); + factor.setComment("answer to life"); + + ContinuousDomain domain = new ContinuousDomain(); + domain.setMinBound(0.0); + domain.setMaxBound(50.0); + factor.setDomain(domain); + + factor.setValueForIdentifier(0.84); + + // clone + Factor clone = (Factor)factor.clone(); + + // test on clone + Assert.assertEquals("testclone", clone.getName()); + Assert.assertEquals("fr.ifremer.isisfish.entities.Cell#lenght", clone.getPath()); + Assert.assertEquals("answer to life", clone.getComment()); + Assert.assertEquals(42.0, clone.getValue()); + Assert.assertNotSame(domain, clone.getDomain()); + Assert.assertEquals(42.0, clone.getDomain().getValueForIdentifier(0.84)); + } } Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -26,7 +26,6 @@ package fr.ifremer.isisfish.simulator.sensitivity; import java.io.File; -import java.io.Serializable; import java.util.List; import org.apache.commons.logging.Log; @@ -92,7 +91,7 @@ // return result SensitivityScenarios sensitivityScenarios = new SensitivityScenarios(); - List<Factor<?, ?>> factors = plan.getFactors(); + List<Factor> factors = plan.getFactors(); for (int i = 0; i < factors.size() * 2; ++i) { Scenario scenario = new Scenario(); @@ -103,8 +102,8 @@ Domain domain = factor.getDomain(); if (domain instanceof MatrixContinuousDomain) { MatrixContinuousDomain cDomain = (MatrixContinuousDomain) domain; - Double minValue = cDomain.getMinBound(); - Double maxValue = cDomain.getMaxBound(); + Object minValue = cDomain.getMinBound(); + Object maxValue = cDomain.getMaxBound(); factor.setValueForIdentifier(minValue.toString()); scenario.addFactor(factor); @@ -112,8 +111,8 @@ scenario.addFactor(factor); } else if (domain instanceof EquationContinuousDomain) { EquationContinuousDomain cDomain = (EquationContinuousDomain) domain; - Double minValue = cDomain.getMinBound(); - Double maxValue = cDomain.getMaxBound(); + Object minValue = cDomain.getMinBound(); + Object maxValue = cDomain.getMaxBound(); factor.setValueForIdentifier(minValue.toString()); scenario.addFactor(factor); @@ -121,16 +120,16 @@ scenario.addFactor(factor); } else if (domain instanceof ContinuousDomain) { ContinuousDomain cDomain = (ContinuousDomain) domain; - Double minValue = cDomain.getMinBound(); - Double maxValue = cDomain.getMaxBound(); + Object minValue = cDomain.getMinBound(); + Object maxValue = cDomain.getMaxBound(); factor.setValueForIdentifier(minValue); scenario.addFactor(factor); factor.setValueForIdentifier(maxValue); scenario.addFactor(factor); } else { - DiscreteDomain<? extends Serializable,? extends Serializable> dDomain = (DiscreteDomain) domain; - for (Serializable sValue : dDomain.getValues().keySet()) { + DiscreteDomain dDomain = (DiscreteDomain) domain; + for (Object sValue : dDomain.getValues().keySet()) { factor.setValueForIdentifier(sValue); scenario.addFactor(factor); } Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/types/MonthTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/types/MonthTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/types/MonthTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,7 +36,7 @@ import org.junit.Test; /** - * TODO add comment here. + * Test on {@link Month}. * * @author chatellier * @version $Revision$ Deleted: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -1,76 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 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 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.sensitivity; - -import javax.swing.JComponent; -import javax.swing.JTextField; - -import org.junit.Assert; -import org.junit.Test; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.MatrixNDImpl; -import org.nuiton.math.matrix.gui.MatrixPanelEditor; - -import fr.ifremer.isisfish.AbstractIsisFishTest; -import fr.ifremer.isisfish.entities.Equation; -import fr.ifremer.isisfish.ui.input.InputOneEquationUI; - -/** - * Test for {@link EditorHelper} class. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class EditorHelperTest extends AbstractIsisFishTest { - - /** - * Test that editor for given type are those excepted. - */ - @Test - public void testGetEditorForType() { - - JComponent result = EditorHelper.getEditorForType(double.class); - Assert.assertTrue(result instanceof JTextField); - - result = EditorHelper.getEditorForType(Double.class); - Assert.assertTrue(result instanceof JTextField); - - result = EditorHelper.getEditorForType(MatrixND.class); - Assert.assertTrue(result instanceof MatrixPanelEditor); - - result = EditorHelper.getEditorForType(MatrixNDImpl.class); - Assert.assertTrue(result instanceof MatrixPanelEditor); - - result = EditorHelper.getEditorForType(Equation.class); - Assert.assertTrue(result instanceof InputOneEquationUI); - - //result = EditorHelper.getEditorForType(PopulationReproductionEquation.class); - //Assert.assertTrue(result instanceof InputOneEquationUI); - } -} Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -28,9 +28,6 @@ import static org.nuiton.i18n.I18n._; import java.awt.HeadlessException; -import java.util.ArrayList; -import java.util.List; - import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JTree; @@ -38,14 +35,17 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Test; import org.nuiton.math.matrix.MatrixFactory; import org.nuiton.math.matrix.MatrixND; -import org.junit.Test; import fr.ifremer.isisfish.AbstractIsisFishTest; import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup; import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; +import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer; +import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel; /** * Sensitivity tree model test. @@ -68,16 +68,16 @@ * * @return la liste des facteur */ - protected List<Factor<?,?>> getFactors() { - - Factor<Integer, Integer> factor1 = new Factor<Integer, Integer>( + protected FactorGroup getFactorGroup() { + + Factor factor1 = new Factor( "testint"); - ContinuousDomain<Integer, Integer> domain1 = new ContinuousDomain<Integer, Integer>(); - domain1.setMinBound(0); - domain1.setMaxBound(50); + ContinuousDomain domain1 = new ContinuousDomain(); + domain1.setMinBound(0.0); + domain1.setMaxBound(50.0); factor1.setDomain(domain1); factor1.setPath("org.nuiton.factor#1234567890#0.12242345354#name"); - factor1.setValueForIdentifier(49); + factor1.setValueForIdentifier(0.5); // matrix 1 MatrixND matrix1 = MatrixFactory.getInstance().create("test1", @@ -100,20 +100,20 @@ matrix2.setValue(new int[] { 1, 2 }, -13000); // factor - Factor<MatrixND, String> factor2 = new Factor<MatrixND, String>( + Factor factor2 = new Factor( "testmatrix"); - DiscreteDomain<MatrixND, String> domain2 = new DiscreteDomain<MatrixND, String>(); + DiscreteDomain domain2 = new DiscreteDomain(); domain2.getValues().put("m1", matrix1); domain2.getValues().put("m2", matrix2); factor2.setDomain(domain2); factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim"); factor2.setValueForIdentifier("m2"); - List<Factor<?,?>> factors1 = new ArrayList<Factor<?,?>>(); - factors1.add(factor1); - factors1.add(factor2); + FactorGroup factorGroup = new FactorGroup("test"); + factorGroup.addFactor(factor1); + factorGroup.addFactor(factor2); - return factors1; + return factorGroup; } /* @@ -124,7 +124,7 @@ final JTree tree = new JTree(); tree.setRootVisible(true); - FactorTreeModel model = new FactorTreeModel(getFactors()); + FactorTreeModel model = new FactorTreeModel(getFactorGroup()); tree.setModel(model); tree.setCellRenderer(new FactorTreeCellRenderer()); Copied: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/FormInterval.java (from rev 3392, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/widget/FormInterval.java) =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/FormInterval.java (rev 0) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/FormInterval.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,58 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2001 - 2011 Ifremer, CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.widget; + +import java.awt.Frame; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import fr.ifremer.isisfish.ui.widget.Interval; +import fr.ifremer.isisfish.ui.widget.IntervalPanel; + +/** + * FormInterval. + */ +public class FormInterval extends Frame { + + /** serialVersionUID. */ + private static final long serialVersionUID = 4911081593147906648L; + + class QuitListener extends WindowAdapter { + public void windowClosing(WindowEvent e) { + e.getWindow().dispose(); + } + } + + public FormInterval(Interval i) { + IntervalPanel ip = new IntervalPanel(); + this.add(ip); + // ip.setEnabled(false); + ip.setModel(i); + + this.addWindowListener(new QuitListener()); + pack(); + } +} Copied: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/IntervalPanelTest.java (from rev 3392, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/widget/IntervalPanelTest.java) =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/IntervalPanelTest.java (rev 0) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/widget/IntervalPanelTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,75 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.widget; + +import javax.swing.SwingUtilities; + +import org.junit.Test; + +/** + * Test class for {@link IntervalPanel}. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class IntervalPanelTest { + + /** + * Test to display a frame with interval panel. + * + * @throws InterruptedException + */ + @Test + public void testIntervalPanelDisplay() throws InterruptedException { + Interval i = new Interval(0, 11); + final FormInterval f = new FormInterval(i); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + f.setVisible(true); + } + }); + + Thread t = new Thread(new Runnable() { + public void run() { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // do nothing + } + f.dispose(); + } + }); + t.start(); + + // it would really be nice to wait the thread, otherwise the test + // means nothing!!! + t.join(); + } +} Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -182,12 +182,12 @@ FileUtil.deleteRecursively(dest); } - /** + /* * Save a file as non utf-8 encoded. * Convert to uft-8. * Assert that file has been converted. * @throws IOException - */ + * @Test public void convertToUnicodeTest() throws IOException { String content = getFirstClassContent("ConvertToUnicode"); @@ -209,13 +209,13 @@ Assert.assertTrue(newContent.indexOf("cod\u00E9") > 0); nonUnicodeFile.delete(); - } + }*/ - /** + /* * Try to convert file already in UTF-8. * * @throws IOException - */ + * @Test public void convertToUnicodeUselessTest() throws IOException { String content = getFirstClassContent("UselessConvertToUnicode"); @@ -237,5 +237,5 @@ Assert.assertTrue(newContent.indexOf("cod\u00E9") > 0); nonUnicodeFile.delete(); - } + }*/ } Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -51,6 +51,7 @@ import org.tmatesoft.svn.core.wc.SVNCopySource; import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNStatus; +import org.tmatesoft.svn.core.wc.SVNStatusType; import org.tmatesoft.svn.core.wc.SVNUpdateClient; import org.tmatesoft.svn.core.wc.SVNWCClient; @@ -962,8 +963,7 @@ vcs.checkout(null, false); // now, make a modification, on REMOTE repo - SVNURL svnURL = SVNURL.parseURIDecoded("file://" - + remoteRepo.getAbsolutePath()); + SVNURL svnURL = SVNURL.parseURIDecoded("file://" + remoteRepo.getAbsolutePath()); SVNURL svnURLNewDir = svnURL.appendPath("isis-fish-data", false) .appendPath("trunk", false).appendPath("test", false); SVNClientManager svnManager = SVNClientManager.newInstance(); @@ -1253,7 +1253,7 @@ * @throws IOException */ @Test - public void testGetLocalStatus() throws VCSException, SVNException, + public void testGetLocalStatusModified() throws VCSException, SVNException, IOException { // log @@ -1271,4 +1271,36 @@ Assert.assertEquals(Status.STATUS_MODIFIED, vcs.getLocalStatus(file)); } + + /** + * Test file local status. + * + * - Checkout + * - delete file (file system delete) + * - tests + * + * @throws VCSException + * @throws SVNException + * @throws IOException + */ + @Test + public void testGetLocalStatusMissing() throws VCSException, SVNException, + IOException { + + // log + if (log.isInfoEnabled()) { + log.info("testGetLocalStatus()"); + } + + // chechout + vcs.checkout(null, false); + + // modif on remote repo + File file = new File(vcs.getLocalRepository(), "scripts" + + File.separator + "version.txt"); + file.delete(); + + Map<File, SVNStatus> statusFiles = vcs.getLocalStatus(file, true, SVNStatusType.STATUS_MISSING); + Assert.assertEquals(1, statusFiles.size()); + } } \ No newline at end of file Modified: isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplan.xml =================================================================== --- isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplan.xml 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplan.xml 2011-06-14 17:43:37 UTC (rev 3393) @@ -6,7 +6,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2009 - 2011 Ifremer, Code Lutin, Chatellier Eric %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -23,7 +23,6 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> - <experimentalDesign> <factors> <factor name="factor 1 (double continuous)" property="continuous" type="real"> @@ -98,5 +97,13 @@ </fixed> </domain> </factor> + <factor name="factor 6 (double continuous percentage)" property="continuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1142003453434#0.223499349929004#size</target> + <domain> + <fixed cardinality="5"> + <percentage operator="*" coefficient="5" reference="14"/> + </fixed> + </domain> + </factor> </factors> </experimentalDesign> \ No newline at end of file Copied: isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplanV2.xml (from rev 3392, isis-fish/branches/3.3.1/src/test/resources/mexico/mexicohelper_designplanV2.xml) =================================================================== --- isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplanV2.xml (rev 0) +++ isis-fish/trunk/src/test/resources/mexico/mexicohelper_designplanV2.xml 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 1999 - 2011 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> + +<experimentalDesign version="2"> + <factors> + <factor name="factor 1 (double continuous)" property="continuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength</target> + <domain> + <fixed cardinality="0"> + <range> + <min>0.0</min> + <max>50.0</max> + </range> + </fixed> + </domain> + </factor> + <factor name="factor 2 (double discrete)" property="discrete" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength</target> + <domain> + <fixed cardinality="5"> + <enumeration> + <value>12.3</value> + <value>70.9</value> + <value>21.0</value> + <value>-12.1</value> + <value>-8.45</value> + </enumeration> + </fixed> + </domain> + </factor> + <factor name="factor 3 (integer discrete)" property="discrete" type="integer"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength</target> + <domain> + <fixed cardinality="3"> + <enumeration> + <value>13</value> + <value>14</value> + <value>45</value> + </enumeration> + </fixed> + </domain> + </factor> + <factor name="factor 4 (MatrixContinuous)" property="matrixcontinuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength</target> + <domain> + <fixed cardinality="0"> + <reference coefficient="0.799"> + <mx name="test1"> + <dimension name="col1" size="3"> + <label>null()</label> + <label>null()</label> + <label>null()</label> + </dimension> + <dimension name="col2" size="2"> + <label>null()</label> + <label>null()</label> + </dimension> + <d>13.0</d> + <d>-14.0</d> + <d>21.0</d> + <d>2.0</d> + <d>12.0</d> + <d>-1.0</d> + </mx> + </reference> + </fixed> + </domain> + </factor> + <factor name="factor 5 (EquationContinuous)" property="equationcontinuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength</target> + <domain> + <fixed cardinality="0" variable="L1"> + <reference coefficient="0.1">45.0</reference> + </fixed> + </domain> + </factor> + <factor name="factor 6 (double continuous percentage)" property="continuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1142003453434#0.223499349929004#size</target> + <domain> + <fixed cardinality="5"> + <reference coefficient="5.0">14.0</reference> + </fixed> + </domain> + </factor> + </factors> +</experimentalDesign> Copied: isis-fish/trunk/src/test/resources/mexico/mexicohelper_factorgroupdp.xml (from rev 3392, isis-fish/branches/3.3.1/src/test/resources/mexico/mexicohelper_factorgroupdp.xml) =================================================================== --- isis-fish/trunk/src/test/resources/mexico/mexicohelper_factorgroupdp.xml (rev 0) +++ isis-fish/trunk/src/test/resources/mexico/mexicohelper_factorgroupdp.xml 2011-06-14 17:43:37 UTC (rev 3393) @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> + +<experimentalDesign> + <factors> + <factors name="continuousgrp"> + <factor name="factor 1 (double continuous)" property="continuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength</target> + <domain> + <fixed cardinality="0"> + <range min="0.0" max="50.0"/> + </fixed> + </domain> + </factor> + <factor name="factor 4 (MatrixContinuous)" property="matrixcontinuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength</target> + <domain> + <fixed cardinality="0"> + <range min="0.0" max="1.0"/> + <coefficient value="0.799" operator="-"/> + <mx name="test1"> + <dimension name="col1" size="3"> + <label>null()</label> + <label>null()</label> + <label>null()</label> + </dimension> + <dimension name="col2" size="2"> + <label>null()</label> + <label>null()</label> + </dimension> + <d>13.0</d> + <d>-14.0</d> + <d>21.0</d> + <d>2.0</d> + <d>12.0</d> + <d>-1.0</d> + </mx> + </fixed> + </domain> + </factor> + <factor name="factor 5 (EquationContinuous)" property="equationcontinuous" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength</target> + <domain> + <fixed cardinality="0"> + <range min="0.0" max="1.0"/> + <coefficient value="0.1" operator="-"/> + <equation variable="L1" reference="45.0"/> + </fixed> + </domain> + </factor> + </factors> + <factors name="discretegrp"> + <factor name="factor 2 (double discrete)" property="discrete" type="real"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength</target> + <domain> + <fixed cardinality="5"> + <enumeration> + <value>12.3</value> + <value>70.9</value> + <value>21.0</value> + <value>-12.1</value> + <value>-8.45</value> + </enumeration> + </fixed> + </domain> + </factor> + <factor name="factor 7 (RuleDiscrete)" property="discrete" type="rule"> + <target>parameters.rules</target> + <domain> + <fixed cardinality="2"> + <enumeration> + <value> + <rules> + <rule name="TACpoids"> + <param key="rule.0.parameter.beginDate">0</param> + <param key="rule.0.parameter.tacInTons">0.0</param> + <param key="rule.0.parameter.species">fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378</param> + <param key="rule.0.parameter.propSurvie">0.0</param> + <param key="rule.0.parameter.endDate">0</param> + <param key="rule.0.parameter.propTac">0.0</param> + </rule> + <rule name="TailleMin"> + <param key="rule.0.parameter.beginDate">0</param> + <param key="rule.0.parameter.species">fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378</param> + <param key="rule.0.parameter.propSurvie">42.0</param> + <param key="rule.0.parameter.endDate">0</param> + <param key="rule.0.parameter.TailleMin">0.0</param> + </rule> + </rules> + </value> + <value> + <rules> + <rule name="TailleMin"> + <param key="rule.0.parameter.beginDate">0</param> + <param key="rule.0.parameter.species">fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378</param> + <param key="rule.0.parameter.propSurvie">42.0</param> + <param key="rule.0.parameter.endDate">0</param> + <param key="rule.0.parameter.TailleMin">0.0</param> + </rule> + </rules> + </value> + </enumeration> + </fixed> + </domain> + </factor> + </factors> + <factor name="factor 3 (integer discrete)" property="discrete" type="integer"> + <target>fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength</target> + <domain> + <fixed cardinality="3"> + <enumeration> + <value>13</value> + <value>14</value> + <value>45</value> + </enumeration> + </fixed> + </domain> + </factor> + </factors> +</experimentalDesign> \ No newline at end of file Modified: isis-fish/trunk/src/test/resources/test-database/analyseplans/CalibrationSimplexePasVariable2Capturabilite.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/analyseplans/CalibrationSimplexePasVariable2Capturabilite.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/analyseplans/CalibrationSimplexePasVariable2Capturabilite.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package analyseplans; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.File; import java.io.FileReader; @@ -35,12 +35,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; -import org.codelutin.util.FileUtil; -import org.codelutin.util.StringUtil; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; +import org.nuiton.util.FileUtil; +import org.nuiton.util.StringUtil; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; @@ -399,7 +399,7 @@ exportHisto += experiences.getExperience(number).q1 + ";" + experiences.getExperience(number).q2 + ";" + experiences.getExperience(number).criteria + "\n"; - org.codelutin.util.FileUtil.writeString(exportHistoric, exportHisto); + org.nuiton.util.FileUtil.writeString(exportHistoric, exportHisto); return doNext; Modified: isis-fish/trunk/src/test/resources/test-database/analyseplans/SimulationNumberRestriction.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/analyseplans/SimulationNumberRestriction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/analyseplans/SimulationNumberRestriction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package analyseplans; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Modified: isis-fish/trunk/src/test/resources/test-database/exports/Abundances.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/Abundances.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/Abundances.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,8 +29,8 @@ import java.io.Writer; -import static org.codelutin.i18n.I18n._; -import org.codelutin.math.matrix.*; +import static org.nuiton.i18n.I18n._; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/Biomasses.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/Biomasses.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/Biomasses.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Writer; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/CapturesNombre.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/CapturesNombre.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/CapturesNombre.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/exports/CapturesPoids.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/CapturesPoids.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/CapturesPoids.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/exports/CellsDefinition.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/CellsDefinition.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/CellsDefinition.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.topia.TopiaContext; +import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.entities.Cell; Modified: isis-fish/trunk/src/test/resources/test-database/exports/EffortsMetier.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/EffortsMetier.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/EffortsMetier.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Writer; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/MetierZone.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/MetierZone.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/MetierZone.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,8 +29,8 @@ import java.io.Writer; -import static org.codelutin.i18n.I18n._; -import org.codelutin.math.matrix.*; +import static org.nuiton.i18n.I18n._; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/NonActivite.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/NonActivite.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/NonActivite.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Writer; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/OwnerMargin.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/OwnerMargin.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/OwnerMargin.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Writer; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/RegionDefinition.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/RegionDefinition.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/RegionDefinition.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,8 +29,8 @@ import java.io.Writer; -import static org.codelutin.i18n.I18n._; -import org.codelutin.topia.TopiaContext; +import static org.nuiton.i18n.I18n._; +import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.entities.*; import fr.ifremer.isisfish.export.Export; Modified: isis-fish/trunk/src/test/resources/test-database/exports/RejetsNombre.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/RejetsNombre.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/RejetsNombre.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/exports/RejetsPoids.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/RejetsPoids.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/RejetsPoids.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/exports/VesselMargin.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/VesselMargin.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/VesselMargin.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package exports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.Writer; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import scripts.ResultName; Modified: isis-fish/trunk/src/test/resources/test-database/exports/ZonesDefinition.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/exports/ZonesDefinition.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/exports/ZonesDefinition.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,8 +30,8 @@ import java.io.Writer; import java.util.List; -import static org.codelutin.i18n.I18n._; -import org.codelutin.topia.TopiaContext; +import static org.nuiton.i18n.I18n._; +import org.nuiton.topia.TopiaContext; import fr.ifremer.isisfish.entities.*; import fr.ifremer.isisfish.export.Export; Modified: isis-fish/trunk/src/test/resources/test-database/rules/Cantonnement.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/Cantonnement.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/Cantonnement.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,7 +38,7 @@ import java.util.Iterator; import java.util.List; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.simulator.MetierMonitor; Modified: isis-fish/trunk/src/test/resources/test-database/rules/CantonnementPreSimu.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/CantonnementPreSimu.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/CantonnementPreSimu.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,8 +24,8 @@ */ package rules; -import static org.codelutin.i18n.I18n.n_; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,7 +38,7 @@ import java.util.List; import java.util.Map; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.simulator.MetierMonitor; Modified: isis-fish/trunk/src/test/resources/test-database/rules/ChangementParamControlablePresimu.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/ChangementParamControlablePresimu.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/ChangementParamControlablePresimu.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.util.ArrayList; import java.util.List; Modified: isis-fish/trunk/src/test/resources/test-database/rules/EffortReduction.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/EffortReduction.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/EffortReduction.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.util.List; Modified: isis-fish/trunk/src/test/resources/test-database/rules/GraviteVPUE1.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/GraviteVPUE1.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/GraviteVPUE1.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,7 +36,7 @@ import java.util.List; import java.util.Collection; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.simulator.SimulationContext; import fr.ifremer.isisfish.types.Date; Modified: isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEngin.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEngin.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEngin.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,7 +24,7 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,7 +36,7 @@ import java.util.Iterator; import java.util.List; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.simulator.MetierMonitor; import fr.ifremer.isisfish.simulator.SimulationContext; @@ -229,7 +229,7 @@ MetiersInterdits.put(new Chaine(p.metier.getNom(),true)); //récupère toutes les stratégies pratiquant le métier et pour lesquelles la proportion !=0 -var ListeStrat=new Packages.org.codelutin.dbobject.DBCollection(StrategyFactory); +var ListeStrat=new Packages.org.nuiton.dbobject.DBCollection(StrategyFactory); var Vessels=SetOfVesselsFactory.findAllByRegion(p.metier.getRegion()); for (var ves=0; ves<Vessels.size();ves++){ if (Vessels.get(ves).getMetiers().contains(p.metier)){ Modified: isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEnginPreSimu.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEnginPreSimu.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/InterdictionEnginPreSimu.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,8 +24,8 @@ */ package rules; -import static org.codelutin.i18n.I18n._; -import static org.codelutin.i18n.I18n.n_; +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,7 +38,7 @@ import java.util.List; import java.util.Map; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.simulator.MetierMonitor; import fr.ifremer.isisfish.simulator.SimulationContext; Modified: isis-fish/trunk/src/test/resources/test-database/rules/TACpoids.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/TACpoids.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/TACpoids.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,15 +24,15 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.util.HashSet; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import scripts.RuleUtil; Modified: isis-fish/trunk/src/test/resources/test-database/rules/TailleMin.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/TailleMin.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/TailleMin.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import scripts.SiMatrix; Modified: isis-fish/trunk/src/test/resources/test-database/rules/TotalClosure.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/rules/TotalClosure.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/rules/TotalClosure.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,13 +24,13 @@ */ package rules; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import scripts.SiMatrix; Modified: isis-fish/trunk/src/test/resources/test-database/scripts/GravityModel.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/scripts/GravityModel.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/scripts/GravityModel.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -25,17 +25,17 @@ package scripts; -import static org.codelutin.i18n.I18n.n_; +import static org.nuiton.i18n.I18n.n_; import java.util.Collection; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaException; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; import fr.ifremer.isisfish.datastore.ResultStorage; import fr.ifremer.isisfish.datastore.StorageException; Modified: isis-fish/trunk/src/test/resources/test-database/scripts/ResultName.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/scripts/ResultName.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/scripts/ResultName.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -37,7 +37,7 @@ package scripts; -import static org.codelutin.i18n.I18n.n_; +import static org.nuiton.i18n.I18n.n_; import fr.ifremer.isisfish.util.Doc; // pour pouvoir afficher une aide contextuelle (BUG#1605) Modified: isis-fish/trunk/src/test/resources/test-database/scripts/RuleUtil.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/scripts/RuleUtil.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/scripts/RuleUtil.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -29,7 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.*; +import org.nuiton.math.matrix.*; import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.entities.PopulationGroup; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorJavaExpandGrid.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorJavaExpandGrid.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorJavaExpandGrid.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,9 +30,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RProxy; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RProxy; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFast.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFast.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFast.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -37,12 +37,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RException; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RException; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import org.rosuda.JRI.REXP; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFrF2.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFrF2.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRFrF2.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -30,12 +30,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RException; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RException; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRMorris.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRMorris.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRMorris.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,12 +36,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RException; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RException; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorROptimumLHS.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorROptimumLHS.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorROptimumLHS.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,11 +36,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRRandomLHS.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRRandomLHS.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRRandomLHS.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -36,11 +36,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRSobol.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRSobol.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRSobol.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -37,11 +37,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import org.rosuda.JRI.REXP; import fr.ifremer.isisfish.datastore.SimulationStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRegularFractions.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRegularFractions.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivity/SensitivityCalculatorRegularFractions.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -35,12 +35,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.j2r.REngine; -import org.codelutin.j2r.RException; -import org.codelutin.j2r.RProxy; -import org.codelutin.math.matrix.MatrixFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.util.FileUtil; +import org.nuiton.j2r.REngine; +import org.nuiton.j2r.RException; +import org.nuiton.j2r.RProxy; +import org.nuiton.math.matrix.MatrixFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.util.FileUtil; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.simulator.SimulationParameter; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassReferenceY9.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassReferenceY9.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassReferenceY9.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeReferenceY12.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeReferenceY12.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeReferenceY12.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeY6.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeY6.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassRelativeY6.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,13 +24,13 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassY3.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassY3.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityBiomassY3.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,13 +24,13 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightReferenceY7.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightReferenceY7.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightReferenceY7.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeReferenceY10.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeReferenceY10.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeReferenceY10.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeY4.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeY4.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightRelativeY4.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,13 +24,13 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightY1.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightY1.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityCapturesWeightY1.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,13 +24,13 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassReferenceY8.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassReferenceY8.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassReferenceY8.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,15 +24,15 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeReferenceY11.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeReferenceY11.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeReferenceY11.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,15 +24,15 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.topia.TopiaContext; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeY5.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeY5.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassRelativeY5.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage; Modified: isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassY2.java =================================================================== --- isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassY2.java 2011-06-14 13:21:14 UTC (rev 3392) +++ isis-fish/trunk/src/test/resources/test-database/sensitivityexports/SensitivityGenitorBiomassY2.java 2011-06-14 17:43:37 UTC (rev 3393) @@ -24,14 +24,14 @@ */ package sensitivityexports; -import static org.codelutin.i18n.I18n._; +import static org.nuiton.i18n.I18n._; import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codelutin.math.matrix.MatrixIterator; -import org.codelutin.math.matrix.MatrixND; +import org.nuiton.math.matrix.MatrixIterator; +import org.nuiton.math.matrix.MatrixND; import scripts.ResultName; import fr.ifremer.isisfish.datastore.ResultStorage;
participants (1)
-
chatellier@users.labs.libre-entreprise.org