Author: chatellier Date: 2009-04-14 13:55:22 +0000 (Tue, 14 Apr 2009) New Revision: 2105 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.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/InputNavigationTreeSelectionAdapter.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 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/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/NoneUI.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/PopulationSeasonsUI.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/SelectivityEditorUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.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/WizardGroupCreationUI.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/check/CheckResultTableModel.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableRenderer.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/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/SimulAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfItemSelectedInList.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfListNotEmpty.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/ErrorDialogUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/HidablePanel.java 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/VCSConnectionState.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/GenericCell.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterColumnEditor.java Log: Update code style, logger, system out, depreciations, etc ... Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/Common.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,6 +1,6 @@ /* *##% - * Copyright (C) 2006 - * Ifremer, Code Lutin, C?dric Pineau, Benjamin Poussin + * 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 @@ -17,56 +17,63 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * +package fr.ifremer.isisfish.ui; + +import java.io.IOException; +import java.text.ParseException; +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; +import fr.ifremer.isisfish.simulator.SimulationProperties; +import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; +import fr.ifremer.isisfish.ui.widget.filter.FilterModel; + +/** * Welcome.java * - * Created: 22 ao?t 2006 10:50:49 + * 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) */ -package fr.ifremer.isisfish.ui; - -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.simulator.SimulationProperties; -import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; -import fr.ifremer.isisfish.ui.widget.filter.FilterModel; -import java.io.IOException; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - public class Common { + /** Class logger. */ + private static Log log = LogFactory.getLog(Common.class); + /** - * Return regions + * Return regions. * * @return regions */ - static public Object[] getRegionItem() { + 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. * * @return old simulations */ - static public Object[] getOldSimulationItem() { + public static Object[] getOldSimulationItem() { try { List<String> oldSimul = new ArrayList<String>(); @@ -80,16 +87,20 @@ // 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," "); - + oldSimul.add(0, " "); + return result; } catch (ParseException ex) { - Logger.getLogger(Common.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't get old simulations", ex); + } } catch (IOException ex) { - Logger.getLogger(Common.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't get old simulations", ex); + } } return null; } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,35 +1,57 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* *##% + * 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 fr.ifremer.isisfish.ui.input.InputSaveVerifier; import java.util.ArrayList; import java.util.List; + import javax.swing.JOptionPane; + +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; + /** + * WelcomeSaveVerifier. + * + * @author letellier + * @version $Revision: 2088 $ * - * @author letellier + * Last update: $Date: 2009-04-08 12:24:31 +0200 (mer. 08 avril 2009) $ + * by : $Author: chatellier $ */ public class WelcomeSaveVerifier { - protected List<fr.ifremer.isisfish.ui.SaveVerifier> verifiers = new ArrayList<fr.ifremer.isisfish.ui.SaveVerifier>(); + protected List<SaveVerifier> verifiers = new ArrayList<SaveVerifier>(); + public void addSaveVerifier(InputSaveVerifier inputVerifier) { verifiers.add(inputVerifier); } - public boolean allIsSaved(){ + public boolean allIsSaved() { boolean exit = true; int responce = JOptionPane.CANCEL_OPTION; - for (fr.ifremer.isisfish.ui.SaveVerifier s : verifiers){ + for (fr.ifremer.isisfish.ui.SaveVerifier s : verifiers) { responce = s.checkEdit(); } //boolean exit = checkEdit(event, component); - if (responce == JOptionPane.OK_OPTION){ - } - else if (responce == JOptionPane.CANCEL_OPTION){ + if (responce == JOptionPane.OK_OPTION) { + } else if (responce == JOptionPane.CANCEL_OPTION) { exit = false; } return exit; 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EquationEditorPaneUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -52,9 +52,10 @@ } else { doc.setPage(e.getURL()); } - } catch (Exception eee) { - log.error("Error for : " + e.getURL(),eee); - eee.printStackTrace(); + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Error for : " + e.getURL(), ex); + } } } } @@ -84,8 +85,8 @@ checkWindow.setBackground(Color.white); } - } catch(Exception eee){ - System.out.println("Can't check script " + eee); + } catch(Exception e){ + log.error("Can't check script", e); } } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2005 + * Copyright (C) 2005 - 2009 * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin * * This program is free software; you can redistribute it and/or @@ -17,48 +17,27 @@ * 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.input; -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -import fr.ifremer.isisfish.IsisFishDAOHelper; -import fr.ifremer.isisfish.datastore.FormuleStorage; -import fr.ifremer.isisfish.datastore.RegionStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.StorageException; -import fr.ifremer.isisfish.datastore.update.ImportFromV2; -import fr.ifremer.isisfish.entities.*; -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 static fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.selectSimulation; -import fr.ifremer.isisfish.ui.widget.ErrorDialogUI; -import fr.ifremer.isisfish.util.CellPointcomparator; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.util.Date; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; +import static javax.swing.JOptionPane.showInputDialog; +import static org.codelutin.i18n.I18n._; + +import java.awt.geom.Point2D; +import java.io.File; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + import org.apache.commons.beanutils.MethodUtils; import org.apache.commons.lang.ClassUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import static org.codelutin.i18n.I18n._; import org.codelutin.math.matrix.MatrixFactory; import org.codelutin.math.matrix.MatrixND; import org.codelutin.topia.TopiaContext; @@ -68,22 +47,58 @@ import org.codelutin.util.FileUtil; import org.codelutin.widget.editor.Editor; -import javax.swing.JOptionPane; -import static javax.swing.JOptionPane.showInputDialog; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import java.awt.geom.Point2D; -import java.io.File; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.datastore.FormuleStorage; +import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageException; +import fr.ifremer.isisfish.datastore.update.ImportFromV2; +import fr.ifremer.isisfish.entities.Cell; +import fr.ifremer.isisfish.entities.CellDAO; +import fr.ifremer.isisfish.entities.EffortDescription; +import fr.ifremer.isisfish.entities.EffortDescriptionDAO; +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.entities.Formule; +import fr.ifremer.isisfish.entities.Gear; +import fr.ifremer.isisfish.entities.Metier; +import fr.ifremer.isisfish.entities.MetierSeasonInfo; +import fr.ifremer.isisfish.entities.MetierSeasonInfoDAO; +import fr.ifremer.isisfish.entities.Population; +import fr.ifremer.isisfish.entities.PopulationDAO; +import fr.ifremer.isisfish.entities.PopulationGroup; +import fr.ifremer.isisfish.entities.PopulationSeasonInfo; +import fr.ifremer.isisfish.entities.PopulationSeasonInfoDAO; +import fr.ifremer.isisfish.entities.Selectivity; +import fr.ifremer.isisfish.entities.SelectivityDAO; +import fr.ifremer.isisfish.entities.SetOfVessels; +import fr.ifremer.isisfish.entities.Species; +import fr.ifremer.isisfish.entities.SpeciesDAO; +import fr.ifremer.isisfish.entities.TargetSpecies; +import fr.ifremer.isisfish.entities.TargetSpeciesDAO; +import fr.ifremer.isisfish.entities.Zone; +import fr.ifremer.isisfish.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.widget.ErrorDialogUI; +import fr.ifremer.isisfish.util.CellPointcomparator; -/** @author letellier */ +/** + * All code used in input UI. + * + * 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 $ + */ public class InputAction { - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(InputAction.class); + /** Class logger. */ + private static Log log = LogFactory.getLog(InputAction.class); public InputAction() { if (log.isDebugEnabled()) { @@ -95,7 +110,6 @@ ErrorDialogUI.showError(eee); } - /** * Exporter la region dans un zip * @@ -104,13 +118,16 @@ public File importRegion() { File file = null; try { - file = FileUtil.getFile(".*.zip$", _("isisfish.message.import.region.zipped")); + file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); if (file != null) { RegionStorage.importZip(file); } - } catch (Exception eee) { - log.error("Can't import region", eee); - showMsgBox(eee); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't import region", e); + } + showMsgBox(e); } return file; } @@ -123,21 +140,22 @@ public File importRegionAndRename() { File file = null; try { - file = FileUtil.getFile(".*.zip$", _("isisfish.message.import.region.zipped")); + file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); if (file != null) { - String newName = - showInputDialog(_("isisfish.message.name.imported.region")); + String newName = showInputDialog(_("isisfish.message.name.imported.region")); RegionStorage.importAndRenameZip(file, newName); } } catch (Exception eee) { - log.error("Can't import region", eee); + if (log.isErrorEnabled()) { + log.error("Can't import region", eee); + } showMsgBox(eee); } return file; } - /** * Importer la region depuis un fichier XML de la version 2 * @@ -146,14 +164,17 @@ public File importV2Region() { File file = null; try { - file = FileUtil.getFile(".*.xml$", _("isisfish.message.import.region.xml")); + file = FileUtil.getFile(".*.xml$", + _("isisfish.message.import.region.xml")); if (file != null) { new ImportFromV2(true).importXML(file); } } catch (Exception eee) { - log.error("Can't import region", eee); + if (log.isErrorEnabled()) { + log.error("Can't import region", eee); + } showMsgBox(eee); } return file; @@ -171,14 +192,17 @@ String simulationName; try { //TODO Should use a shared model ? - simulationName = selectSimulation(SimulationStorage.getSimulationNames()); + simulationName = selectSimulation(SimulationStorage + .getSimulationNames()); if (simulationName == null) { return null; } } catch (Exception e) { String msg = _("isisfish.error.no.select.simulation"); - log.warn(msg); + if (log.isWarnEnabled()) { + log.warn(msg); + } e.printStackTrace(); showMsgBox(e); return null; @@ -189,7 +213,9 @@ } // ask new region name - String regionName = showInputDialog(_("isisfish.message.import.region.name"), "region from " + simulationName); + String regionName = showInputDialog( + _("isisfish.message.import.region.name"), "region from " + + simulationName); if (regionName == null || "".equals(regionName)) { return null; } @@ -197,15 +223,17 @@ return null; } - if (log.isInfoEnabled()) { log.info("new region name " + regionName); } try { - SimulationStorage.getSimulation(simulationName).extractRegion(regionName); + SimulationStorage.getSimulation(simulationName).extractRegion( + regionName); } catch (StorageException e) { - log.error("Can't extract region", e); + if (log.isErrorEnabled()) { + log.error("Can't extract region", e); + } showMsgBox(e); } return regionName; @@ -219,7 +247,8 @@ public File exportRegion(RegionStorage regionStorage) { File file = null; try { - file = FileUtil.getFile(".*.zip$", _("isisfish.message.import.region.zipped")); + file = FileUtil.getFile(".*.zip$", + _("isisfish.message.import.region.zipped")); if (file != null) { int resp = JOptionPane.YES_OPTION; if (file.exists()) { @@ -231,7 +260,9 @@ } } } catch (Exception eee) { - log.error("Can't export region", eee); + if (log.isErrorEnabled()) { + log.error("Can't export region", eee); + } showMsgBox(eee); } return file; @@ -251,7 +282,9 @@ RegionStorage.importAndRenameZip(zip, newName); } catch (Exception eee) { - log.error("Can't copy region", eee); + if (log.isErrorEnabled()) { + log.error("Can't copy region", eee); + } showMsgBox(eee); } return newName; @@ -267,8 +300,8 @@ String result = null; try { int resp = JOptionPane.showConfirmDialog(null, _( - "isisfish.message.confirm.remove.region", - regionStorage.getName())); + "isisfish.message.confirm.remove.region", regionStorage + .getName())); if (resp == JOptionPane.YES_OPTION) { regionStorage.delete(cvsDelete); result = _("isisfish.message.region.removed"); @@ -277,7 +310,9 @@ result = _("isisfish.message.region.remove.canceled"); } } catch (Exception eee) { - log.error("Can't remove region", eee); + if (log.isErrorEnabled()) { + log.error("Can't remove region", eee); + } showMsgBox(eee); } return result; @@ -306,7 +341,9 @@ result = _("isisfish.message.commit.region.canceled"); } } catch (Exception eee) { - log.error("Can't export region", eee); + if (log.isErrorEnabled()) { + log.error("Can't export region", eee); + } showMsgBox(eee); } return result; @@ -319,11 +356,13 @@ * <p/> * tree ans * + * @param ui TODO * @param name name of region + * @return loaded region */ public FisheryRegion loadRegion(jaxx.runtime.JAXXObject ui, String name) { - if (log.isTraceEnabled()) { - log.trace("loadRegion called"); + if (log.isDebugEnabled()) { + log.debug("loadRegion : " + name); } try { RegionStorage regionStorage = null; @@ -343,7 +382,9 @@ } return null; } catch (Exception eee) { - log.error("Can't load region", eee); + if (log.isErrorEnabled()) { + log.error("Can't load region", eee); + } showMsgBox(eee); } return null; @@ -361,14 +402,16 @@ } try { if ("".equals(name)) { -// showMsgBox("error " + _("isisfish.error.region.name.empty")); + // showMsgBox("error " + _("isisfish.error.region.name.empty")); } if (RegionStorage.getRegionNames().contains(name)) { -// showMsgBox("Error " + _("isisfish.error.region.already.exists")); + // showMsgBox("Error " + _("isisfish.error.region.already.exists")); } RegionStorage.create(name); } catch (Exception eee) { - log.error("Can't create region", eee); + if (log.isErrorEnabled()) { + log.error("Can't create region", eee); + } showMsgBox(eee); } } @@ -381,7 +424,6 @@ * nom de l'entite et pas du package. * @return null ou un fenetre d'erreur */ - @SuppressWarnings("unchecked") public TopiaEntity create(TopiaContext isisContext, String type) { if (log.isTraceEnabled()) { log.trace("create called for " + type); @@ -394,7 +436,8 @@ Method method = MethodUtils.getAccessibleMethod( IsisFishDAOHelper.class, "get" + type + "DAO", TopiaContext.class); - TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke(null, isisContext); + TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke( + null, isisContext); TopiaEntity entity = dao.create("name", name); entity.update(); @@ -402,7 +445,9 @@ return entity; } catch (Exception eee) { - log.error("Can't create entity", eee); + if (log.isErrorEnabled()) { + log.error("Can't create entity", eee); + } showMsgBox(eee); } return null; @@ -419,7 +464,9 @@ } try { if (selected == null) { - log.warn("Try to save null entity"); + if (log.isWarnEnabled()) { + log.warn("Try to save null entity"); + } return null; } // on est pas en autoUpdate donc il faut faire le update avant le @@ -428,7 +475,9 @@ selected.getTopiaContext().commitTransaction(); } catch (Exception eee) { - log.error("Can't save region", eee); + if (log.isErrorEnabled()) { + log.error("Can't save region", eee); + } showMsgBox(eee); } return selected; @@ -449,11 +498,15 @@ isisContext.rollbackTransaction(); // reload the object - if (selected != null) { - selected = isisContext.findByTopiaId(selected.getTopiaId()); + // can't be null here, or allready null before !!! + //if (selected != null) { + // FIXME don't modify parameters + selected = isisContext.findByTopiaId(selected.getTopiaId()); + //} + } catch (Exception eee) { + if (log.isErrorEnabled()) { + log.error("Can't cancel modification in region", eee); } - } catch (Exception eee) { - log.error("Can't cancel modification in region", eee); showMsgBox(eee); } return selected; @@ -477,20 +530,22 @@ boolean doDelete; List<TopiaEntity> allWillBeRemoved = selected.getComposite(); if (allWillBeRemoved.size() > 0) { - String text = _( - "isisfish.message.delete.object", - selected.toString()); + String text = _("isisfish.message.delete.object", selected + .toString()); for (TopiaEntity e : allWillBeRemoved) { text += ClassUtils.getShortClassName(e.getClass()) + " - " + e.toString() + "\n"; } int resp = JOptionPane.showConfirmDialog(null, text, - _("isisfish.message.delete.entities"), JOptionPane.YES_NO_OPTION); + _("isisfish.message.delete.entities"), + JOptionPane.YES_NO_OPTION); doDelete = resp == JOptionPane.YES_OPTION; } else { - String text = _("isisfish.message.confirm.delete.object", selected.toString()); + String text = _("isisfish.message.confirm.delete.object", + selected.toString()); int resp = JOptionPane.showConfirmDialog(null, text, - _("isisfish.message.delete.entity"), JOptionPane.YES_NO_OPTION); + _("isisfish.message.delete.entity"), + JOptionPane.YES_NO_OPTION); doDelete = resp == JOptionPane.YES_OPTION; } @@ -502,7 +557,9 @@ msg = _("isisfish.message.remove.canceled"); } } catch (Exception eee) { - log.error("Can't remove entity: " + selected, eee); + if (log.isErrorEnabled()) { + log.error("Can't remove entity: " + selected, eee); + } showMsgBox(eee); } return msg; @@ -518,9 +575,9 @@ try { if (eq != null) { String name = showInputDialog(""); - if ("".equals(name)) { -// showMsgBox("Error " +_("isisfish.error.invalid.equation.name")); - } + /*if ("".equals(name)) { + showMsgBox("Error " +_("isisfish.error.invalid.equation.name")); + }*/ if (name != null) { FormuleStorage storage = FormuleStorage.createFormule(eq .getCategory(), name, eq.getLanguage()); @@ -528,7 +585,9 @@ } } } catch (Exception eee) { - log.error("Can't save equation as model", eee); + if (log.isErrorEnabled()) { + log.error("Can't save equation as model", eee); + } showMsgBox(eee); } return null; @@ -545,23 +604,26 @@ public Object saveAsModel(String category, String language, String content) { try { String name = showInputDialog("isisfish.message.saveModel.dialog"); - if ("".equals(name)) { -// showMsgBox("Error " +_("isisfish.error.invalid.equation.name")); - } + /*if ("".equals(name)) { + showMsgBox("Error " +_("isisfish.error.invalid.equation.name")); + }*/ if (name != null) { - FormuleStorage storage = FormuleStorage.createFormule(category, name, language); + FormuleStorage storage = FormuleStorage.createFormule(category, + name, language); storage.setContent(content); } } catch (Exception eee) { - log.error("Can't save equation as model", eee); + if (log.isErrorEnabled()) { + log.error("Can't save equation as model", eee); + } showMsgBox(eee); } return null; } - public Object openEditor(String category, String name, - Class javaInterface, String content, Editor editor) { + public Object openEditor(String category, String name, Class javaInterface, + String content, Editor editor) { if (log.isTraceEnabled()) { log.trace("openEditor"); } @@ -574,7 +636,9 @@ } pane.dispose(); } catch (Exception eee) { - log.error("Can't open editor", eee); + if (log.isErrorEnabled()) { + log.error("Can't open editor", eee); + } showMsgBox(eee); } return null; @@ -584,12 +648,13 @@ return FormuleStorage.getFormules(isisContext, name); } -// InputGear + // InputGear public Object addSelectivity(Population pop, String equation, Gear gear) { try { - SelectivityDAO dao = IsisFishDAOHelper.getSelectivityDAO(pop.getTopiaContext()); + SelectivityDAO dao = IsisFishDAOHelper.getSelectivityDAO(pop + .getTopiaContext()); Selectivity selectivity = dao.create(); selectivity.setGear(gear); @@ -601,7 +666,9 @@ gear.update(); } catch (Exception eee) { - log.error("Can't add selectivity", eee); + if (log.isErrorEnabled()) { + log.error("Can't add selectivity", eee); + } showMsgBox(eee); } return null; @@ -622,24 +689,27 @@ return null; } -// InputMetier + // InputMetier public Object createSeasonInfo(Metier metier) { if (log.isTraceEnabled()) { log.trace("createSeasonInfo called"); } try { - MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper.getMetierSeasonInfoDAO(metier.getTopiaContext()); + MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper + .getMetierSeasonInfoDAO(metier.getTopiaContext()); MetierSeasonInfo metierSeasonInfo = metierSeasonInfoPS.create(); metierSeasonInfo.setFirstMonth(Month.MONTH[0]); metierSeasonInfo.setLastMonth(Month.MONTH[3]); metier.addMetierSeasonInfo(metierSeasonInfo); metierSeasonInfo.update(); metier.update(); -// isisContext.commitTransaction(); + // isisContext.commitTransaction(); } catch (Exception eee) { - log.error("Can't create MetierSeasonInfo", eee); + if (log.isErrorEnabled()) { + log.error("Can't create MetierSeasonInfo", eee); + } showMsgBox(eee); } return null; @@ -654,33 +724,44 @@ metier.update(); metier.getTopiaContext().commitTransaction(); } catch (Exception eee) { - log.error("Can't create MetierSeasonInfo", eee); + if (log.isErrorEnabled()) { + log.error("Can't create MetierSeasonInfo", eee); + } showMsgBox(eee); } return null; } - public Object addTargetSpecies(Metier metier, MetierSeasonInfo m, Species species, String targetFactorEquationName, String targetFactorEquationContent, boolean primaryCatch) { + public Object addTargetSpecies(Metier metier, MetierSeasonInfo m, + Species species, String targetFactorEquationName, + String targetFactorEquationContent, boolean primaryCatch) { if (log.isDebugEnabled()) { - log.debug("addTargetSpecies called: " + metier + " " + species + " " + primaryCatch + " " + targetFactorEquationContent); + log.debug("addTargetSpecies called: " + metier + " " + species + + " " + primaryCatch + " " + targetFactorEquationContent); } try { - TargetSpeciesDAO dao = IsisFishDAOHelper.getTargetSpeciesDAO(metier.getTopiaContext()); + TargetSpeciesDAO dao = IsisFishDAOHelper.getTargetSpeciesDAO(metier + .getTopiaContext()); TargetSpecies targetSpecies = dao.create(); targetSpecies.setSpecies(species); - targetSpecies.getTargetFactorEquation().setName(targetFactorEquationName); - targetSpecies.getTargetFactorEquation().setContent(targetFactorEquationContent); + targetSpecies.getTargetFactorEquation().setName( + targetFactorEquationName); + targetSpecies.getTargetFactorEquation().setContent( + targetFactorEquationContent); targetSpecies.setPrimaryCatch(primaryCatch); m.addSpeciesTargetSpecies(targetSpecies); } catch (Exception eee) { - log.error("Can't add TargetSpecies", eee); + if (log.isErrorEnabled()) { + log.error("Can't add TargetSpecies", eee); + } showMsgBox(eee); } return null; } - public Object removeTargetSpecies(MetierSeasonInfo m, TargetSpecies targetSpecies) { + public Object removeTargetSpecies(MetierSeasonInfo m, + TargetSpecies targetSpecies) { if (log.isDebugEnabled()) { log.debug("removeTargetSpecies called: " + targetSpecies); } @@ -689,32 +770,39 @@ m.removeSpeciesTargetSpecies(targetSpecies); } } catch (Exception eee) { - log.error("Can't remove TargetSpecies", eee); + if (log.isErrorEnabled()) { + log.error("Can't remove TargetSpecies", eee); + } showMsgBox(eee); } return null; } -// SetOfVessels + // SetOfVessels public void addEffortDescription(SetOfVessels setOfVessels, Metier metier) { if (log.isDebugEnabled()) { - log.debug("addEffortDescription called: " + setOfVessels + " metier: " + metier); + log.debug("addEffortDescription called: " + setOfVessels + + " metier: " + metier); } try { - EffortDescriptionDAO effortDescriptionPS = IsisFishDAOHelper.getEffortDescriptionDAO(metier.getTopiaContext()); + EffortDescriptionDAO effortDescriptionPS = IsisFishDAOHelper + .getEffortDescriptionDAO(metier.getTopiaContext()); EffortDescription effortDescription = effortDescriptionPS.create(); effortDescription.setPossibleMetiers(metier); effortDescription.update(); setOfVessels.addPossibleMetiers(effortDescription); setOfVessels.update(); } catch (Exception eee) { - log.error("Can't create EffortDescription", eee); + if (log.isErrorEnabled()) { + log.error("Can't create EffortDescription", eee); + } showMsgBox(eee); } } - public Object removeEffortDescription(SetOfVessels sov, EffortDescription effort) { + public Object removeEffortDescription(SetOfVessels sov, + EffortDescription effort) { if (log.isTraceEnabled()) { log.trace("remove called"); } @@ -722,34 +810,39 @@ sov.removePossibleMetiers(effort); sov.getTopiaContext().commitTransaction(); } catch (Exception eee) { - log.error("Can't remove entity: " + effort, eee); + if (log.isErrorEnabled()) { + log.error("Can't remove entity: " + effort, eee); + } showMsgBox(eee); } return null; } -// Population - public Species getSpeciesByTopiaId(TopiaContext context, String topiaId){ + // Population + public Species getSpeciesByTopiaId(TopiaContext context, String topiaId) { Species result = null; try { SpeciesDAO dao = IsisFishDAOHelper.getSpeciesDAO(context); result = dao.findByTopiaId(topiaId); - } catch (TopiaException ex) { - Logger.getLogger(InputAction.class.getName()).log(Level.SEVERE, null, ex); + } catch (TopiaException e) { + if (log.isErrorEnabled()) { + log.error("Can't get species", e); + } } return result; } + public Population createPopulation(TopiaContext context, Species species) { if (log.isTraceEnabled()) { log.trace("create called"); } try { String name = "Population_new"; - + PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(context); Population pop = dao.create(); pop.setName(name); - + species.addPopulation(pop); pop.setSpecies(species); species.update(); @@ -757,16 +850,21 @@ context.commitTransaction(); return pop; } catch (Exception eee) { - log.error("Can't create Population", eee); + if (log.isErrorEnabled()) { + log.error("Can't create Population", eee); + } showMsgBox(eee); } return null; } public void createPopulationSeasonInfo(Population pop) { - log.debug("createSeasonInfo called"); + if (log.isDebugEnabled()) { + log.debug("createSeasonInfo called"); + } try { - PopulationSeasonInfoDAO dao = IsisFishDAOHelper.getPopulationSeasonInfoDAO(pop.getTopiaContext()); + PopulationSeasonInfoDAO dao = IsisFishDAOHelper + .getPopulationSeasonInfoDAO(pop.getTopiaContext()); PopulationSeasonInfo seasonInfo = dao.create(); seasonInfo.setFirstMonth(Month.MONTH[0]); seasonInfo.setLastMonth(Month.MONTH[3]); @@ -774,51 +872,62 @@ seasonInfo.setPopulation(pop); seasonInfo.update(); pop.update(); -// isisContext.commitTransaction(); + // isisContext.commitTransaction(); } catch (Exception eee) { - log.error("Can't create PopulationSeasonInfo", eee); + if (log.isErrorEnabled()) { + log.error("Can't create PopulationSeasonInfo", eee); + } showMsgBox(eee); } } - public void removePopulationSeasonInfo(Population pop, PopulationSeasonInfo populationSeasonInfo) { - log.debug("removeSeasonInfo called"); + public void removePopulationSeasonInfo(Population pop, + PopulationSeasonInfo populationSeasonInfo) { + if (log.isDebugEnabled()) { + log.debug("removeSeasonInfo called"); + } try { pop.removePopulationSeasonInfo(populationSeasonInfo); pop.update(); pop.getTopiaContext().commitTransaction(); } catch (Exception eee) { - log.error("Can't remove PopulationSeasonInfo", eee); + if (log.isErrorEnabled()) { + log.error("Can't remove PopulationSeasonInfo", eee); + } showMsgBox(eee); } } - public void createMetierSeasonInfo(Metier metier){ - log.debug("createSeasonInfo called"); + public void createMetierSeasonInfo(Metier metier) { + if (log.isDebugEnabled()) { + log.debug("createSeasonInfo called"); + } try { - MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper.getMetierSeasonInfoDAO(metier.getTopiaContext()); + MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper + .getMetierSeasonInfoDAO(metier.getTopiaContext()); MetierSeasonInfo metierSeasonInfo = metierSeasonInfoPS.create(); metierSeasonInfo.setFirstMonth(Month.MONTH[0]); metierSeasonInfo.setLastMonth(Month.MONTH[3]); metier.addMetierSeasonInfo(metierSeasonInfo); metierSeasonInfo.update(); metier.update(); -// isisContext.commitTransaction(); - - }catch(Exception eee){ + // isisContext.commitTransaction(); + } catch (Exception eee) { log.error("Can't create MetierSeasonInfo", eee); showMsgBox(eee); } } - public void removeMetierSeasonInfo(Metier metier, MetierSeasonInfo info){ - log.debug("createSeasonInfo called"); + public void removeMetierSeasonInfo(Metier metier, MetierSeasonInfo info) { + if (log.isDebugEnabled()) { + log.debug("createSeasonInfo called"); + } try { metier.removeMetierSeasonInfo(info); metier.update(); metier.getTopiaContext().commitTransaction(); - }catch(Exception eee){ + } catch (Exception eee) { log.error("Can't create MetierSeasonInfo", eee); showMsgBox(eee); } @@ -829,7 +938,8 @@ log.trace("createRecruitmentDistributionontext called: " + pop); } try { - String val = JOptionPane.showInputDialog(_("isisfish.message.recruitment.number.month")); + String val = JOptionPane + .showInputDialog(_("isisfish.message.recruitment.number.month")); int num = -1; if (val != null && !"".equals(val)) { try { @@ -846,7 +956,8 @@ for (int i = 0; i < num; i++) { sem.add(_("isisfish.common.month", i)); } - MatrixND newMat = MatrixFactory.getInstance().create(new List[]{sem}); + MatrixND newMat = MatrixFactory.getInstance().create( + new List[] { sem }); MatrixND mat = pop.getRecruitmentDistribution(); if (mat != null) { @@ -856,15 +967,18 @@ pop.update(); } } catch (Exception eee) { - log.error("Can't remove PopulationSeasonInfo", eee); + if (log.isErrorEnabled()) { + log.error("Can't remove PopulationSeasonInfo", eee); + } showMsgBox(eee); } return null; } -// Migration + // Migration - public Object addMigration(PopulationSeasonInfo info, PopulationGroup group, Zone departure, Zone arrival, double coeff) { + public Object addMigration(PopulationSeasonInfo info, + PopulationGroup group, Zone departure, Zone arrival, double coeff) { if (log.isTraceEnabled()) { log.trace("addMigration called"); } @@ -874,14 +988,16 @@ info.setMigrationMatrix(mat); } catch (Exception eee) { - log.error("Can't add migration", eee); + if (log.isErrorEnabled()) { + log.error("Can't add migration", eee); + } showMsgBox(eee); } return null; } - - public Object addEmigration(PopulationSeasonInfo info, PopulationGroup group, Zone departure, double coeff) { + public Object addEmigration(PopulationSeasonInfo info, + PopulationGroup group, Zone departure, double coeff) { if (log.isTraceEnabled()) { log.trace("addEmigration called"); } @@ -891,13 +1007,16 @@ info.setEmigrationMatrix(mat); } catch (Exception eee) { - log.error("Can't add emigration", eee); + if (log.isErrorEnabled()) { + log.error("Can't add emigration", eee); + } showMsgBox(eee); } return null; } - public Object addImmigration(PopulationSeasonInfo info, PopulationGroup group, Zone arrival, double coeff) { + public Object addImmigration(PopulationSeasonInfo info, + PopulationGroup group, Zone arrival, double coeff) { if (log.isTraceEnabled()) { log.trace("addImmigration called"); } @@ -907,7 +1026,9 @@ info.setImmigrationMatrix(mat); } catch (Exception eee) { - log.error("Can't add immigration", eee); + if (log.isErrorEnabled()) { + log.error("Can't add immigration", eee); + } showMsgBox(eee); } return null; @@ -930,7 +1051,8 @@ srcMap = srcMap.substring(0, srcMap.length() - ".shp".length()); File ssx = new File(srcMap + ".ssx"); - RegionStorage regionStorage = RegionStorage.getRegion(fisheryRegion.getName()); + RegionStorage regionStorage = RegionStorage + .getRegion(fisheryRegion.getName()); File destDir = regionStorage.getMapRepository(); // copy shp file @@ -942,7 +1064,9 @@ if (ssx.exists()) { FileUtil.copy(ssx, destSsx); } else { - log.info("Ssx file don't exist, try to generate it"); + if (log.isInfoEnabled()) { + log.info("Ssx file don't exist, try to generate it"); + } } List<String> maps = fisheryRegion.getMapFileList(); @@ -950,7 +1074,9 @@ fisheryRegion.setMapFileList(maps); } } catch (Exception eee) { - log.error("Can't copy .shp or .ssx file for: " + shp, eee); + if (log.isErrorEnabled()) { + log.error("Can't copy .shp or .ssx file for: " + shp, eee); + } showMsgBox(eee); } return null; @@ -968,7 +1094,8 @@ List<String> maps = fisheryRegion.getMapFileList(); - RegionStorage regionStorage = RegionStorage.getRegion(fisheryRegion.getName()); + RegionStorage regionStorage = RegionStorage.getRegion(fisheryRegion + .getName()); File mapDir = regionStorage.getMapRepository(); for (Object map : selectedMaps) { @@ -983,7 +1110,9 @@ fisheryRegion.setMapFileList(maps); } catch (Exception eee) { - log.error("Can't remove map", eee); + if (log.isErrorEnabled()) { + log.error("Can't remove map", eee); + } showMsgBox(eee); } return null; @@ -1010,12 +1139,18 @@ try { TopiaContext isisContext = fisheryRegion.getTopiaContext(); -// frame.setInfoText(_("isisfish.message.checking.cell")); - int latNumber = (int) Math.round((fisheryRegion.getMaxLatitude() - fisheryRegion.getMinLatitude()) / fisheryRegion.getCellLengthLatitude()); - int lonNumber = (int) Math.round((fisheryRegion.getMaxLongitude() - fisheryRegion.getMinLongitude()) / fisheryRegion.getCellLengthLongitude()); + // frame.setInfoText(_("isisfish.message.checking.cell")); + int latNumber = (int) Math + .round((fisheryRegion.getMaxLatitude() - fisheryRegion + .getMinLatitude()) + / fisheryRegion.getCellLengthLatitude()); + int lonNumber = (int) Math + .round((fisheryRegion.getMaxLongitude() - fisheryRegion + .getMinLongitude()) + / fisheryRegion.getCellLengthLongitude()); -// frame.setProgressMin(0); -// frame.setProgressMax(latNumber * lonNumber); + // frame.setProgressMin(0); + // frame.setProgressMax(latNumber * lonNumber); int progresscpt = 0; // il faut peut-etre creer ou supprimer des mailles @@ -1025,13 +1160,18 @@ Collections.sort(cells, cellPointcomparator); Point2D.Float point = new Point2D.Float(); - for (float lati = fisheryRegion.getMinLatitude(); lati < fisheryRegion.getMaxLatitude(); lati += fisheryRegion.getCellLengthLatitude()) { + for (float lati = fisheryRegion.getMinLatitude(); lati < fisheryRegion + .getMaxLatitude(); lati += fisheryRegion + .getCellLengthLatitude()) { lati = Math.round(lati * 1000f); lati = lati / 1000.0f; - for (float longi = fisheryRegion.getMinLongitude(); longi < fisheryRegion.getMaxLongitude(); longi += fisheryRegion.getCellLengthLongitude()) { + for (float longi = fisheryRegion.getMinLongitude(); longi < fisheryRegion + .getMaxLongitude(); longi += fisheryRegion + .getCellLengthLongitude()) { longi = Math.round(longi * 1000f) / 1000.0f; point.setLocation(lati, longi); - int position = Collections.binarySearch(cells, point, cellPointcomparator); + int position = Collections.binarySearch(cells, point, + cellPointcomparator); if (position >= 0) { // deja existant on l'enleve de la liste, et on ne cree rien cells.remove(position); @@ -1044,7 +1184,7 @@ cell.setLand(false); cell.update(); } -// frame.setProgressValue(++progresscpt); + // frame.setProgressValue(++progresscpt); } } @@ -1065,7 +1205,9 @@ } isisContext.commitTransaction(); } catch (Exception eee) { - log.error(_("isisfish.error.save.region"), eee); + if (log.isErrorEnabled()) { + log.error(_("isisfish.error.save.region"), eee); + } showMsgBox(eee); } } @@ -1075,17 +1217,18 @@ if (log.isTraceEnabled()) { log.trace("check called: "); } -// frame.setInfoText(_("isisfish.message.check.region")); + // frame.setInfoText(_("isisfish.message.check.region")); CheckResult result = new CheckResult(); CheckRegion.check(fisheryRegion, result); CheckResultFrame dialog = new CheckResultFrame(); dialog.setCheckResult(result); dialog.setVisible(true); } catch (Exception eee) { - log.error(_("isisfish.error.check.region"), eee); + if (log.isErrorEnabled()) { + log.error(_("isisfish.error.check.region"), eee); + } showMsgBox(eee); } return null; } - } Modified: 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,10 +1,45 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* *##% + * Copyright (C) 2005 - 2009 + * 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. + *##%*/ package fr.ifremer.isisfish.ui.input; +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.codelutin.topia.persistence.TopiaEntity; + import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.FisheryRegion; import fr.ifremer.isisfish.entities.Gear; @@ -16,32 +51,20 @@ import fr.ifremer.isisfish.entities.TripType; import fr.ifremer.isisfish.entities.VesselType; import fr.ifremer.isisfish.entities.Zone; -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 static org.codelutin.i18n.I18n._; -import org.codelutin.topia.persistence.TopiaEntity; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; -import java.awt.Component; -import org.hibernate.transaction.JOTMTransactionManagerLookup; - -/** @author letellier */ +/** + * 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 { - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(InputNavigationTreeSelectionAdapter.class); + /** Class logger. */ + private static final Log log = LogFactory.getLog(InputNavigationTreeSelectionAdapter.class); protected NavigationTreeNode currentNode = null; protected InputContentUI currentUI = null; @@ -77,7 +100,7 @@ @Override protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) { if (e != null) { -// ErrorDialogUI.showError(e); + // FIXME add logger here ? e.printStackTrace(); } // go back to previous node @@ -99,7 +122,9 @@ context.getContextValue(InputSaveVerifier.class).addCurrentPanel(currentUI); currentNode = node; } catch (Exception e) { - log.debug(e.getMessage(), e); + if (log.isErrorEnabled()) { + log.error("Can't open ui", e); + } } } @@ -110,17 +135,17 @@ InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); int responce = verif.checkEdit(); //boolean exit = checkEdit(event, component); - if (responce == JOptionPane.OK_OPTION){ + 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){ + else if (responce == JOptionPane.CANCEL_OPTION) { exit = false; } - if (exit){ + if (exit) { verif.removeAllPanels(); } return exit; @@ -234,9 +259,10 @@ true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null); } catch (Exception ex) { - log.error(ex.getMessage(), 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -48,8 +48,6 @@ import fr.ifremer.isisfish.entities.Formule; import fr.ifremer.isisfish.entities.Equation; import fr.ifremer.isisfish.entities.EquationImpl; -import java.util.logging.Level; -import java.util.logging.Logger; import java.lang.reflect.Method; import org.apache.commons.beanutils.MethodUtils; import org.codelutin.topia.persistence.TopiaEntity; @@ -135,7 +133,9 @@ try { editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java")); } catch (IOException ex) { - Logger.getLogger(InputOneEquationUI.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't refresh editor", e); + } } if (nameEquation != null){ setComboModel(); @@ -168,12 +168,12 @@ setComboModel(); setInfoText(_("isisfish.message.saveModel.finished")); } -protected void openEditor(){ +protected void openEditor() { Formule e = (Formule)combo.getSelectedItem(); - if (e != null){ - getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor); + if (e != null) { + getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor); } - else{ + else { getContextValue(InputAction.class).openEditor(nameEquation, "new", clazz, editor.getText(), editor); } } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,30 +1,55 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* *##% + * Copyright (C) 2005 - 2009 + * 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. + *##%*/ package fr.ifremer.isisfish.ui.input; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.JOptionPane; 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; + /** + * InputTabbedPaneListener. * * @author letellier + * @version $Revision: 1312 $ + * + * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ + * by : $Author: sletellier $ */ -public class InputTabbedPaneListener implements ChangeListener{ +public class InputTabbedPaneListener implements ChangeListener { + + /** Class logger. */ + private static Log log = LogFactory.getLog(InputTabbedPaneListener.class); + protected int cacheSelectedIndex = -1; - + @Override public void stateChanged(ChangeEvent e) { try { - JTabbedPane pane = (JTabbedPane)e.getSource(); + JTabbedPane pane = (JTabbedPane) e.getSource(); pane.removeChangeListener(this); int selectedIndex = pane.getSelectedIndex(); - if (cacheSelectedIndex != -1){ + if (cacheSelectedIndex != -1) { pane.setSelectedIndex(cacheSelectedIndex); } InputContentUI ui = (InputContentUI) pane.getSelectedComponent(); @@ -36,22 +61,25 @@ cacheSelectedIndex = pane.getSelectedIndex(); pane.addChangeListener(this); } catch (Exception ex) { - Logger.getLogger(MetierUI.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't refresh", ex); + } } } - /* + /** * Ask you to save if modification are made - * @param ui selected + * @param context * @return true to change tab */ protected boolean closeUI(InputContentUI context) throws Exception { boolean exit = true; // by default, we says that component was succesfull closed - InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class); + InputSaveVerifier verif = context + .getContextValue(InputSaveVerifier.class); int responce = verif.checkEdit(); //boolean exit = checkEdit(event, component); - if (responce == JOptionPane.CANCEL_OPTION){ + if (responce == 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -97,20 +97,23 @@ protected DefaultComboBoxModel getFieldCurrentRegionModel(){ return new DefaultComboBoxModel(Common.getRegionItem()); } -protected void regionChange() { - final String name = fieldCurrentRegion.getSelectedItem().toString(); - if (log.isDebugEnabled()) { - log.debug("Region change, selected : " + name); +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); + } + setInfoText(_("isisfish.message.loading.region", name)); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + loadRegion(name); + getVerifier().setIsisContext(getContextValue(TopiaContext.class)); + setInfoText(_("isisfish.message.load.finished")); + setTreeModel(); + } + }); } - setInfoText(_("isisfish.message.loading.region", name)); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - loadRegion(name); - getVerifier().setIsisContext(getContextValue(TopiaContext.class)); - setInfoText(_("isisfish.message.load.finished")); - setTreeModel(); - } - }); } protected void loadRegion(String name) { if (log.isDebugEnabled()) { @@ -249,7 +252,7 @@ </row> <row> <cell columns='2' fill='horizontal' weightx='1.0'> - <JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onItemStateChanged='regionChange()'/> + <JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onItemStateChanged='regionChange(event)' /> </cell> </row> </Table> 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -124,11 +124,15 @@ if (getMetierSeasonInfo() != null){ try { - log.debug("************** Interval ************"); + if (log.isDebugEnabled()) { + log.debug("************** Interval ************"); + } Month firstMonth = getMetierSeasonInfo().getFirstMonth(); if (firstMonth != null) { interval.setFirst(firstMonth.getMonthNumber()); - log.debug(" first : " + interval.getFirst()); + if (log.isDebugEnabled()) { + log.debug(" first : " + interval.getFirst()); + } } else { interval.setFirst(0); } @@ -136,13 +140,16 @@ Month lastMonth = getMetierSeasonInfo().getLastMonth(); if (lastMonth != null) { interval.setLast(lastMonth.getMonthNumber()); - log.debug(" last : " + interval.getLast()); + if (log.isDebugEnabled()) { + log.debug(" last : " + interval.getLast()); + } } else { interval.setLast(3); } } catch (Exception e) { - log.error("Unexpected origin.", e); - // Only trace the error and go on. + if (log.isErrorEnabled()) { + log.error("Can't display season", e); + } } } } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,7 +1,6 @@ <!-- /* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * Copyright (C) 2005 - 2009 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 @@ -19,7 +18,7 @@ *##%*/ /* * - * IsisFish.java + * MetierTabUI. * * Created: 1 aout 2005 18:37:25 CEST * @@ -57,13 +56,16 @@ jaxx.runtime.SwingUtil.fillComboBox(fieldMetierGear, getRegion().getGear(), getBean().getGear(),true); init = false; } - } catch (Exception ex) { - Logger.getLogger(MetierTabUI.class.getName()).log(Level.SEVERE, null, ex); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't refresh", e); + } } } protected void gearChanged(){ - if (!init) + if (!init) { getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); + } } ]]></script> <Table id='bady'> 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,8 +1,6 @@ - <!-- /* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * Copyright (C) 2005 - 2009 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 @@ -20,7 +18,7 @@ *##%*/ /* * - * IsisFish.java + * MetierUI. * * Created: 1 aout 2005 18:37:25 CEST * @@ -57,7 +55,7 @@ ]]></script> <JPanel id='body' layout='{new BorderLayout()}'> <JTabbedPane id="metierTab" name="Metier" constraints='BorderLayout.CENTER' > - <tab title='{_("isisfish.metier.title")}'><MetierTabUI id="metierTabUI" constructorParams='this'/></tab> + <tab title='{_("isisfish.metier.title")}'><MetierTabUI id="metierTabUI" constructorParams='this'/></tab> <tab title='{_("isisfish.metierSeasonInfoZone.title")}'><MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='this'/></tab> <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='this'/></tab> </JTabbedPane> Modified: 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/NoneUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,3 +1,34 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/** + * NoneUI. + * + * 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 $ + */ + --> <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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,34 +1,21 @@ /* *##% -* Copyright (C) 2005 -* 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. -*##%*/ + * Copyright (C) 2005 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ -/* * -* OpenMapEvents.java -* -* Created: 5 septembre 2005 03:21:41 CEST -* -* @author Benjamin POUSSIN <poussin at codelutin.com> -* @version $Revision: 202 $ -* -* Last update: $Date: 2006-06-30 18:39:09 +0200 (ven, 30 jun 2006) $ -* by : $Author: bpoussin $ -*/ - package fr.ifremer.isisfish.ui.input; import java.awt.event.MouseEvent; @@ -37,23 +24,30 @@ import org.apache.commons.logging.LogFactory; import com.bbn.openmap.Layer; -import com.bbn.openmap.event.DistanceMouseMode; import com.bbn.openmap.event.MapMouseListener; import com.bbn.openmap.event.MapMouseMode; -import com.bbn.openmap.event.NullMouseMode; import com.bbn.openmap.event.ProjectionEvent; import com.bbn.openmap.event.SelectMouseMode; import fr.ifremer.isisfish.map.IsisMapBean; +/** + * OpenMapEvents.java + * + * Created: 5 septembre 2005 03:21:41 CEST + * + * @author Benjamin POUSSIN <poussin at codelutin.com> + * @version $Revision: 202 $ + * + * Last update: $Date: 2006-06-30 18:39:09 +0200 (ven, 30 jun 2006) $ + * by : $Author: bpoussin $ + */ public abstract class OpenMapEvents extends Layer implements MapMouseListener { // OpenMapEvents - /** */ + /** serialVersionUID. */ private static final long serialVersionUID = -8365120112075269288L; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(OpenMapEvents.class); - public OpenMapEvents (IsisMapBean map, MapMouseMode mouseMode, int selectMode){ + public OpenMapEvents(IsisMapBean map, MapMouseMode mouseMode, int selectMode) { super(); this.mouseMode = mouseMode; this.map = map; @@ -63,188 +57,187 @@ map.addMapMouseListener(this); } - public void projectionChanged(ProjectionEvent e){ + + public void projectionChanged(ProjectionEvent e) { // do nothing, it's not reel layer } /** - * SelectMouseMode property: Null, Distance, Nav, Select - */ + * SelectMouseMode property: Null, Distance, Nav, Select + */ protected MapMouseMode mouseMode = null; protected IsisMapBean map = null; protected int selectMode = 1; /** - * OnMouseDragged property. - */ + * OnMouseDragged property. + */ protected String onMouseDragged = null; /** - * Get onMouseDragged property. - * - *@return OnMouseDragged property. - */ + * Get onMouseDragged property. + * + * @return OnMouseDragged property. + */ public String getOnMouseDragged() { return this.onMouseDragged; } /** - * Set onMouseDragged property. - * - *@param onMouseDragged New onMouseDragged property. - */ + * Set onMouseDragged property. + * + * @param onMouseDragged New onMouseDragged property. + */ public void setOnMouseDragged(String onMouseDragged) { this.onMouseDragged = onMouseDragged; } /** - * OnMouseEntered property. - */ + * OnMouseEntered property. + */ protected String onMouseEntered = null; /** - * Get onMouseEntered property. - * - *@return OnMouseEntered property. - */ + * Get onMouseEntered property. + * + * @return OnMouseEntered property. + */ public String getOnMouseEntered() { return this.onMouseEntered; } /** - * Set onMouseEntered property. - * - *@param onMouseEntered New onMouseEntered property. - */ + * Set onMouseEntered property. + * + * @param onMouseEntered New onMouseEntered property. + */ public void setOnMouseEntered(String onMouseEntered) { this.onMouseEntered = onMouseEntered; } /** - * OnMouseExited property. - */ + * OnMouseExited property. + */ protected String onMouseExited = null; /** - * Get onMouseExited property. - * - *@return OnMouseExited property. - */ + * Get onMouseExited property. + * + * @return OnMouseExited property. + */ public String getOnMouseExited() { return this.onMouseExited; } /** - * Set onMouseExited property. - * - *@param onMouseExited New onMouseExited property. - */ + * Set onMouseExited property. + * + * @param onMouseExited New onMouseExited property. + */ public void setOnMouseExited(String onMouseExited) { this.onMouseExited = onMouseExited; } /** - * OnMouseMoved property. - */ + * OnMouseMoved property. + */ protected String onMouseMoved = null; /** - * Get onMouseMoved property. - * - *@return OnMouseMoved property. - */ + * Get onMouseMoved property. + * + * @return OnMouseMoved property. + */ public String getOnMouseMoved() { return this.onMouseMoved; } /** - * Set onMouseMoved property. - * - *@param onMouseMoved New onMouseMoved property. - */ + * Set onMouseMoved property. + * + * @param onMouseMoved New onMouseMoved property. + */ public void setOnMouseMoved(String onMouseMoved) { this.onMouseMoved = onMouseMoved; } /** - * OnMousePressed property. - */ + * OnMousePressed property. + */ protected String onMousePressed = null; /** - * Get onMousePressed property. - * - *@return OnMousePressed property. - */ + * Get onMousePressed property. + * + * @return OnMousePressed property. + */ public String getOnMousePressed() { return this.onMousePressed; } /** - * Set onMousePressed property. - * - *@param onMousePressed New onMousePressed property. - */ + * Set onMousePressed property. + * + * @param onMousePressed New onMousePressed property. + */ public void setOnMousePressed(String onMousePressed) { this.onMousePressed = onMousePressed; } /** - * OnMouseReleased property. - */ + * OnMouseReleased property. + */ protected String onMouseReleased = null; /** - * Get onMouseReleased property. - * - *@return OnMouseReleased property. - */ + * Get onMouseReleased property. + * + * @return OnMouseReleased property. + */ public String getOnMouseReleased() { return this.onMouseReleased; } /** - * Set onMouseReleased property. - * - *@param onMouseReleased New onMouseReleased property. - */ + * Set onMouseReleased property. + * + * @param onMouseReleased New onMouseReleased property. + */ public void setOnMouseReleased(String onMouseReleased) { this.onMouseReleased = onMouseReleased; } public String[] getMouseModeServiceList() { - return new String[] { - SelectMouseMode.modeID - }; + return new String[] { SelectMouseMode.modeID }; } - public boolean mouseClicked(MouseEvent e){ + public boolean mouseClicked(MouseEvent e) { onMouseClicked(); return true; } - public boolean mouseDragged(MouseEvent e){ + public boolean mouseDragged(MouseEvent e) { return false; } - public void mouseEntered(MouseEvent e){ + public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } - public void mouseMoved(){ + public void mouseMoved() { } - public boolean mouseMoved(MouseEvent e){ + public boolean mouseMoved(MouseEvent e) { return false; } - public boolean mousePressed(MouseEvent e){ + public boolean mousePressed(MouseEvent e) { return false; } - public boolean mouseReleased(MouseEvent e){ + public boolean mouseReleased(MouseEvent e) { return false; } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -169,14 +169,15 @@ interval.setLast(3); } } catch (Exception e) { - log.error("Unexpected origin.", e); - // Only trace the error and go on. + if (log.isErrorEnabled()) { + log.error("Can't display interval", e); + } } } } protected void setCombo(){ if (getBean() != null){ - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationSeasonInfoChooser,getBean().getPopulationSeasonInfo(), getPopulationSeasonInfo(), true); + jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationSeasonInfoChooser,getBean().getPopulationSeasonInfo(), getBean().getPopulationSeasonInfo(), true); } } protected void seasonGroupChanged(){ @@ -184,7 +185,7 @@ getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected()); } } -protected void seasonChanged(){ +protected void seasonChanged(ActionEvent event) { init = true; setPopulationSeasonInfo((PopulationSeasonInfoImpl)fieldPopulationSeasonInfoChooser.getSelectedItem()); getVerifier().addCurrentEntity(getPopulationSeasonInfo()); @@ -208,7 +209,7 @@ </cell> <cell fill='horizontal' weightx='1.0'> <JComboBox id="fieldPopulationSeasonInfoChooser" - onActionPerformed='seasonChanged()' + onActionPerformed='seasonChanged(event)' enabled='{isActif()}'/> </cell> </row> 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -23,24 +23,26 @@ }); boolean init = false; -public void refresh(){ +public void refresh() { Gear gear = getVerifier().getEntity(Gear.class); setBean((GearImpl) gear); java.util.List<Object> values = new ArrayList<Object>(); - for (String value : fr.ifremer.isisfish.types.RangeOfValues.getPossibleTypes()) + for (String value : fr.ifremer.isisfish.types.RangeOfValues.getPossibleTypes()) { values.add(value); - if (getBean() != null){ - if (values != null){ + } + if (getBean() != null) { + if (values != null) { init = true; jaxx.runtime.SwingUtil.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true); init = false; } } } -protected void paramChanged(){ - if (fieldGearParamType.getSelectedItem() != null){ - if (!init) +protected void paramChanged() { + if (fieldGearParamType.getSelectedItem() != null) { + if (!init) { getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); + } } } ]]></script> Modified: 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -107,12 +107,12 @@ remove.setEnabled(false); } -protected void setSelectivityTableModel(){ - DefaultTableModel model = new DefaultTableModel(){ +protected void setSelectivityTableModel() { + DefaultTableModel model = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { boolean result = false; - if (column > 0){ + if (column > 0) { result =true; } return result; @@ -121,8 +121,8 @@ Collection<Selectivity> selectivity = getBean().getPopulationSelectivity(); java.util.List<Population> populations = new ArrayList<Population>(); java.util.List<Equation> equations = new ArrayList<Equation>(); - if (selectivity != null){ - for (Selectivity s : selectivity){ + if (selectivity != null) { + for (Selectivity s : selectivity) { populations.add(s.getPopulation()); equations.add(s.getEquation()); } @@ -134,20 +134,20 @@ EquationTableEditor cellEditor = new EquationTableEditor(); selectivityTable.getColumnModel().getColumn(1).setCellEditor(cellEditor); } -protected void add(){ +protected void add() { getAction().addSelectivity((Population)getPopulation(), selectivityEquation.getEditor().getText(), getBean()); setSelectivityTableModel(); } -protected void remove(){ +protected void remove() { getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0))); setSelectivityTableModel(); } protected DefaultComboBoxModel getSelectivityPopulationModel(){ java.util.List<Species> species = getRegion().getSpecies(); DefaultComboBoxModel selectivityPopulationModel = new DefaultComboBoxModel(); - if (species != null){ + if (species != null) { selectivityPopulationModel.addElement(new GenericCell(" ", null, null)); - for (Species s : species){ + for (Species s : species) { if (s.getPopulation() != null){ for (Population p : s.getPopulation()){ selectivityPopulationModel.addElement(new GenericCell(p.getName(), p, Population.class)); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -69,7 +69,7 @@ getVerifier().setDeleteButton(remove); SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class); setBean((SetOfVesselsImpl) setOfVessels); - if (getBean() != null){ + 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); @@ -78,12 +78,14 @@ } } protected void portChanged(){ - if (!init) + if (!init) { getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem()); + } } protected void vesselTypeChanged(){ - if (!init) + if (!init) { getBean().setVesselType((VesselType)fieldSetOfVesselsVesselType.getSelectedItem()); + } } ]]> </script> 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -76,12 +76,12 @@ setSetOfVesselsModel(); } } -protected void setSetOfVesselsModel(){ +protected void setSetOfVesselsModel() { ActionListener[] listeners = fieldStrategySetOfVessels.getActionListeners(); for (ActionListener listener : listeners){ fieldStrategySetOfVessels.removeActionListener(listener); } - jaxx.runtime.SwingUtil.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels(), true); + jaxx.runtime.SwingUtil.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels(), true); for (ActionListener listener : listeners){ fieldStrategySetOfVessels.addActionListener(listener); } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -229,8 +229,10 @@ next.setEnabled(false); finish.setEnabled(true); } - protected void finish(){ - log.debug("wizardGroupFinish called"); + protected void finish() { + if (log.isDebugEnabled()) { + log.debug("wizardGroupFinish called"); + } try { // remove all old group @@ -326,9 +328,12 @@ } popBasic.refresh(); cancel(); - }catch(Exception eee){ - log.error("Can't create PopulationGroup", eee); } + catch(Exception e) { + if (log.isErrorEnabled()) { + log.error("Can't create PopulationGroup", e); + } + } } protected void cancel(){ 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckRegion.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% -* Copyright (C) 2002, 2003 Code Lutin +* Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Static public License @@ -16,20 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * -* CheckSaisie.java -* -* Created: 9 janv. 2004 -* -* @author Benjamin Poussin <poussin at codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - - package fr.ifremer.isisfish.ui.input.check; import static org.codelutin.i18n.I18n._; @@ -66,6 +52,18 @@ import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.util.EvaluatorHelper; +/** + * CheckSaisie.java + * + * Created: 9 janv. 2004 + * + * @author Benjamin Poussin <poussin at codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public class CheckRegion { // CheckSaisie /* // check equation compilation @@ -345,7 +343,7 @@ result.addWarning(region, _("isisfish.error.empty.name")); } - List<Zone> secteurs = region.getZone();; + List<Zone> secteurs = region.getZone(); if(secteurs.size() == 0){ result.addWarning(region, _("isisfish.error.undefined.sector")); }else{ 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResult.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% -* Copyright (C) 2002, 2003 Code Lutin +* Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,19 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * -* CheckResult.java -* -* Created: 9 janv. 2004 -* -* @author Benjamin Poussin <poussin at codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ + package fr.ifremer.isisfish.ui.input.check; import java.util.LinkedHashSet; @@ -37,8 +26,17 @@ import java.util.LinkedList; /** -* Classe permettant de créer le résultat d'une vérification de la bonne saisie des objets -*/ + * Classe permettant de créer le résultat d'une vérification de la bonne saisie des objets. + * + * Created: 9 janv. 2004 + * + * @author Benjamin Poussin <poussin at codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public class CheckResult { // CheckResult LinkedHashSet order = new LinkedHashSet(); 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultFrame.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2002, 2003 Code Lutin + * Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,8 +16,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * - * CheckResultFrame.java +package fr.ifremer.isisfish.ui.input.check; + +import static org.codelutin.i18n.I18n._; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import javax.swing.JScrollPane; +import javax.swing.JTable; + +/** + * CheckResultFrame. * * Created: 10 janv. 2004 * @@ -28,25 +37,19 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package fr.ifremer.isisfish.ui.input.check; - -import static org.codelutin.i18n.I18n._; - -import javax.swing.JFrame; -import javax.swing.WindowConstants; -import javax.swing.JScrollPane; -import javax.swing.JTable; - public class CheckResultFrame extends JFrame { // CheckResultFrame - CheckResultTableModel model; + + /** serialVersionUID. */ + private static final long serialVersionUID = -3425876562425941700L; + + protected CheckResultTableModel model; - public CheckResultFrame(CheckResult checkResult){ + public CheckResultFrame(CheckResult checkResult) { this(); setCheckResult(checkResult); } - public CheckResultFrame(){ + public CheckResultFrame() { super(_("isisfish.message.result.verif.region")); model = new CheckResultTableModel(new CheckResult()); JTable table = new JTable(model); @@ -59,7 +62,7 @@ this.getContentPane().add(new JScrollPane(table)); } - public void setCheckResult(CheckResult checkResult){ + public void setCheckResult(CheckResult checkResult) { model.setCheckResult(checkResult); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableModel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableModel.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableModel.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2002, 2003 Code Lutin + * Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,8 +16,27 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * - * CheckResultTableModel.java +package fr.ifremer.isisfish.ui.input.check; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; + +import org.codelutin.topia.persistence.TopiaEntity; +import org.codelutin.topia.persistence.TopiaId; + +/** + * CheckResultTableModel. * * Created: 10 janv. 2004 * @@ -28,91 +47,73 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class CheckResultTableModel extends AbstractTableModel implements + Comparator { // CheckResultTableModel -package fr.ifremer.isisfish.ui.input.check; + /** serialVersionUID. */ + private static final long serialVersionUID = 328398134761266970L; -import javax.swing.table.AbstractTableModel; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Collection; -import java.util.ArrayList; -import java.awt.Component; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.JTable; -import java.awt.Color; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.table.TableColumnModel; -import java.util.Comparator; -import java.util.TreeSet; -import javax.swing.table.JTableHeader; + protected CheckResult checkResult; + protected ArrayList data; + protected int sortedBy = -1; + protected boolean ascending = true; -import org.codelutin.topia.persistence.TopiaEntity; -import org.codelutin.topia.persistence.TopiaId; - -import java.util.Collections; - -public class CheckResultTableModel extends AbstractTableModel implements Comparator { // CheckResultTableModel - - CheckResult checkResult; - ArrayList data; - int sortedBy = -1; - boolean ascending = true; - - public CheckResultTableModel(CheckResult checkResult){ + public CheckResultTableModel(CheckResult checkResult) { setCheckResult(checkResult); } - public void setCheckResult(CheckResult checkResult){ + public void setCheckResult(CheckResult checkResult) { this.checkResult = checkResult; computeData(); } - protected void computeData(){ + protected void computeData() { data = new ArrayList(); - for(Iterator i=checkResult.order.iterator(); i.hasNext();){ - TopiaEntity o = (TopiaEntity)i.next(); + for (Iterator i = checkResult.order.iterator(); i.hasNext();) { + TopiaEntity o = (TopiaEntity) i.next(); String type = TopiaId.getClassNameAsString(o.getTopiaId()); - addOneData(o, type, "error", (List)checkResult.error.get(o), data); - addOneData(o, type, "warning", (List)checkResult.warning.get(o), data); - addOneData(o, type, "info", (List)checkResult.info.get(o), data); + addOneData(o, type, "error", (List) checkResult.error.get(o), data); + addOneData(o, type, "warning", (List) checkResult.warning.get(o), + data); + addOneData(o, type, "info", (List) checkResult.info.get(o), data); } fireTableDataChanged(); } - protected void addOneData(Object o, String type, String level, List list, Collection result){ - if(list != null && list.size() != 0){ - for(Iterator m=list.iterator(); m.hasNext();){ + protected void addOneData(Object o, String type, String level, List list, + Collection result) { + if (list != null && list.size() != 0) { + for (Iterator m = list.iterator(); m.hasNext();) { Object message = m.next(); - result.add(new Object[]{type, o, level, message}); + result.add(new Object[] { type, o, level, message }); } } } - String [] titles = new String[]{"Class", "Object", "Level", "Message"}; - public String getColumnName(int column){ + String[] titles = new String[] { "Class", "Object", "Level", "Message" }; + + public String getColumnName(int column) { return titles[column]; } - public int getRowCount(){ + public int getRowCount() { return data.size(); } - public int getColumnCount(){ + public int getColumnCount() { return 4; } - public Object getValueAt(int row, int column){ - Object [] rowData = (Object[])data.get(row); + public Object getValueAt(int row, int column) { + Object[] rowData = (Object[]) data.get(row); return rowData[column]; } - public void setSortedBy(int column){ - if(column == sortedBy){ + public void setSortedBy(int column) { + if (column == sortedBy) { ascending = !ascending; - }else{ + } else { sortedBy = column; ascending = true; } @@ -120,12 +121,13 @@ fireTableDataChanged(); } - public int compare(Object o1, Object o2){ - Object [] data1 = (Object[])o1; - Object [] data2 = (Object[])o2; + public int compare(Object o1, Object o2) { + Object[] data1 = (Object[]) o1; + Object[] data2 = (Object[]) o2; - int result = data1[sortedBy].toString().compareTo(data2[sortedBy].toString()); - return ascending?result:-result; + int result = data1[sortedBy].toString().compareTo( + data2[sortedBy].toString()); + return ascending ? result : -result; } public void addMouseListenerToHeaderInTable(final JTable table) { @@ -145,4 +147,3 @@ } } // CheckResultTableModel - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableRenderer.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/check/CheckResultTableRenderer.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2002, 2003 Code Lutin + * Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * +package fr.ifremer.isisfish.ui.input.check; + +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.Component; +import javax.swing.JTable; +import java.awt.Color; + +/** * CheckResultTableRenderer.java * * Created: 10 janv. 2004 @@ -28,27 +35,24 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class CheckResultTableRenderer extends DefaultTableCellRenderer { // CheckResultTableRenderer + /** serialVersionUID. */ + private static final long serialVersionUID = 8015604773747460458L; -package fr.ifremer.isisfish.ui.input.check; - -import javax.swing.table.DefaultTableCellRenderer; -import java.awt.Component; -import javax.swing.JTable; -import java.awt.Color; - -public class CheckResultTableRenderer extends DefaultTableCellRenderer { // CheckResultTableRenderer - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column){ - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if(!isSelected){ - if("error".equals(table.getValueAt(row, 2))){ + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, + row, column); + if (!isSelected) { + if ("error".equals(table.getValueAt(row, 2))) { setBackground(Color.red); - }else if("warning".equals(table.getValueAt(row, 2))){ + } else if ("warning".equals(table.getValueAt(row, 2))) { setBackground(Color.orange); - }else if("info".equals(table.getValueAt(row, 2))){ + } else if ("info".equals(table.getValueAt(row, 2))) { setBackground(Color.cyan); } } return this; } } // CheckResultTableRenderer - 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -42,7 +42,6 @@ import javax.swing.table.DefaultTableModel; import java.util.Map.Entry; - tableTagValue.addMouseListener(new MouseListener() { @Override 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -50,8 +50,6 @@ import org.codelutin.math.matrix.gui.JAXXMatrixEditor; import javax.swing.table.DefaultTableModel; import java.text.ParseException; -import java.util.logging.Level; -import java.util.logging.Logger; import java.awt.event.ItemEvent; import javax.swing.table.TableModel; import fr.ifremer.isisfish.ui.widget.editor.GenericCell; @@ -87,9 +85,9 @@ } public ParamsUI(SimulAction action){ - setContextValue(action); } + public void refresh(){ SimulationService.getService().removeSimulationServiceListener(simulationListener); SimulationService.getService().addSimulationServiceListener(simulationListener); @@ -112,7 +110,7 @@ } } } -protected void regionChange(ItemEvent e){ +protected void regionChange(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { // le premier item est " " pour ne pas avoir de selection par defaut final String selected = fieldSimulParamsRegion.getSelectedItem().toString(); @@ -139,8 +137,10 @@ getParentContainer(SensitivityUI.class).getSensitivityTabUI().setRegion((FisheryRegionImpl) getContextValue(SimulAction.class).getSimulationParameter().getRegion().getFisheryRegion()); getParentContainer(SensitivityUI.class).getSensitivityTabUI().setTreeModel(); } catch (StorageException ex) { - log.debug(ex.getMessage(), ex); - }; + if (log.isErrorEnabled()) { + log.debug("Cant reload factors", ex); + } + } } } protected void setFactor(){ @@ -341,9 +341,13 @@ getContextValue(SimulAction.class).setOldSimulatorNames(fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.filterSimulation(getContextValue(SimulAction.class).getOldSimulationItem())); refresh(); } catch (ParseException ex) { - Logger.getLogger(ParamsUI.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't select simulation filter", ex); + } } catch (IOException ex) { - Logger.getLogger(ParamsUI.class.getName()).log(Level.SEVERE, null, ex); + if (log.isErrorEnabled()) { + log.error("Can't select simulation filter", ex); + } } } protected ComboBoxModel getSimulParamsSelectModel() { 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,7 +1,6 @@ <!-- /* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * Copyright (C) 2005 - 2009 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 @@ -18,8 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * - * IsisFish.java +/** + * PreScriptUI. * * Created: 1 aout 2005 18:37:25 CEST * @@ -32,16 +31,19 @@ --> <JPanel id="simulPreScripts" layout='{new BorderLayout()}'> <script><![CDATA[ - public PreScriptsUI (SimulAction action){ - + public PreScriptsUI(SimulAction action) { setContextValue(action); } - public void refresh(){ - } - protected void save(){ + + protected void save() { getContextValue(SimulAction.class).getSimulationParameter().setPreScript(fieldSimulPreScript.getText()); } - protected void backParameter(){ + + protected void refresh() { + + } + + protected void backParameter() { SimulUI simul = getParentContainer(SimulUI.class); simul.selTab(0); } 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -131,7 +131,9 @@ } public void init() { - log.debug("Init "); + if (log.isDebugEnabled()) { + log.debug("Init "); + } try { param = new SimulationParameter(); List<String> resultNames = getResultNames(); @@ -198,7 +200,9 @@ showMsgBox(e); } finally { try { - fos.close(); + if (fos != null) { + fos.close(); + } } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Can't save simulation", e); @@ -227,8 +231,8 @@ } catch (Exception eee) { if (log.isWarnEnabled()) { log.warn("Can't find result name script", eee); - showMsgBox(eee); } + showMsgBox(eee); } return result; } @@ -282,7 +286,9 @@ * @param simulName name of simulation to load */ public void loadOldSimulation(String simulName) { - log.debug("call loadOldSimulation: " + simulName); + if (log.isDebugEnabled()) { + log.debug("call loadOldSimulation: " + simulName); + } try { this.simulName = simulName; simulStorage = SimulationStorage.getSimulation(simulName); @@ -302,11 +308,15 @@ // Chargement des facteurs File f = simulStorage.getMexicoDesignPlan(SimulationStorage.getSimulationDirectory(simulName)); if (f != null){ - log.debug("Import design plan from : " + f.getPath()); + if (log.isDebugEnabled()) { + log.debug("Import design plan from : " + f.getPath()); + } designPlan = MexicoHelper.getDesignPlanFromXML(f.getPath()); factors.clear(); - for (Factor factor : designPlan.getFactors()){ - log.debug("Find factor : " + factor.getName()); + for (Factor factor : designPlan.getFactors()) { + if (log.isDebugEnabled()) { + log.debug("Find factor : " + factor.getName()); + } factors.put(factor.getPath() + factor.getName(), factor); } } @@ -503,8 +513,6 @@ * Return old simulations. * * @return old simulations - * - * @deprecated use fr.ifremer.isisfish.ui.Common.getOldSimulationItem() */ public List<String> getOldSimulationItem() { @@ -923,8 +931,9 @@ f.setDomain(domain); f.setComment(comment); f.setPath(path + domain.getVariableName()); - if (exist) + if (exist) { removeFactor(f); + } addFactor(f, c); } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -42,6 +42,8 @@ * TODO ce code depuis le xml... * * @author chemit + * + * @deprecated since 20090414, use jaxx bindings instead */ public class SimulatorListeners { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfItemSelectedInList.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfItemSelectedInList.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfItemSelectedInList.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,3 +1,21 @@ +/* *##% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package fr.ifremer.isisfish.ui.widget; import javax.swing.event.ListSelectionListener; @@ -6,7 +24,9 @@ import javax.swing.JList; import javax.swing.JButton; -/** Enable a button if the associated list is not empty */ +/** + * Enable a button if the associated list is not empty. + */ public class EnabledIfItemSelectedInList implements ListSelectionListener { private final JComponent button; private final JList list; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfListNotEmpty.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfListNotEmpty.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/EnabledIfListNotEmpty.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,3 +1,21 @@ +/* *##% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package fr.ifremer.isisfish.ui.widget; import javax.swing.JButton; @@ -6,7 +24,9 @@ import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; -/** Enable a button if the associated list is not empty */ +/** + * Enable a button if the associated list is not empty. + */ public class EnabledIfListNotEmpty implements ListDataListener { private JComponent target; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/ErrorDialogUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/ErrorDialogUI.jaxx 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/ErrorDialogUI.jaxx 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,10 +1,42 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/** + * ErrorDialogUI.java + * + * @author letellier + * @version $Revision: 1312 $ + * + * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ + * by : $Author: sletellier $ + */ +--> + <JDialog title='isisfish.error.dialog.title'> <script> -/** le dialogue pour afficher les erreurs */ +/** Le dialogue pour afficher les erreurs. */ protected static ErrorDialogUI instance; public static void showError(Exception e) { - if (instance == null) { instance = new ErrorDialogUI(); } + if (instance == null) { + instance = new ErrorDialogUI(); + } instance.getErrorMessage().setText(e.getMessage()); StringWriter w = new StringWriter(); e.printStackTrace(new PrintWriter(w)); Modified: 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/FormInterval.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,7 +1,20 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* *##% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ package fr.ifremer.isisfish.ui.widget; @@ -10,30 +23,26 @@ import java.awt.event.WindowEvent; /** -* La classe de test -*/ - - - -public class FormInterval extends Frame{ - /** */ + * FormInterval. + */ +public class FormInterval extends Frame { + + /** serialVersionUID. */ private static final long serialVersionUID = 4911081593147906648L; - /** - */ - class Quitter extends WindowAdapter{ - public void windowClosing(WindowEvent e){ - e.getWindow().dispose();} + class QuitListener extends WindowAdapter { + public void windowClosing(WindowEvent e) { + e.getWindow().dispose(); + } } - public FormInterval(Interval i){ + public FormInterval(Interval i) { IntervalPanel ip = new IntervalPanel(); this.add(ip); // ip.setEnabled(false); ip.setModel(i); - this.addWindowListener(new Quitter()); + this.addWindowListener(new QuitListener()); pack(); } } - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/HidablePanel.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/HidablePanel.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/HidablePanel.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2006 + * Copyright (C) 2006 - 2009 * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin * * This program is free software; you can redistribute it and/or @@ -17,9 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -/* * - * HidablePanel.java - * +package fr.ifremer.isisfish.ui.widget; + +import javax.swing.JPanel; + +/** + * HidablePanel. + * * Created: 7 mars 2006 22:48:25 * * @author poussin @@ -27,25 +31,12 @@ * * Last update: $Date$ * by : $Author$ - */ - -package fr.ifremer.isisfish.ui.widget; - -import javax.swing.JPanel; - - -/** - * @author poussin * + * @deprecated since 20090414 seams to be unused */ - public class HidablePanel extends JPanel { - /** - * - */ - private static final long serialVersionUID = 4153300672681154582L; + /** serialVersionUID. */ + private static final long serialVersionUID = 4153300672681154582L; } - - 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/Interval.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ -/**##%% - * Copyright (C) 2002, 2003 Code Lutin +/* ##%% + * Copyright (C) 2002 - 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,19 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%%**/ -/** - * Interval.java - * - * Created: Wed Oct 4 2000 - * - * @author POUSSIN Benjamin <bpoussin at free.fr> - * Copyright COGITEC - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ - package fr.ifremer.isisfish.ui.widget; import java.io.Serializable; @@ -40,12 +27,18 @@ * particulier car il est circulaire. Par exemple si min=0, max=100, first=75 et * bien last peut etre egal à 25 donc inferieur a first. Dans ce cas si l'on * demande contains 50 il repond faux et contains 99 retourne vrai. + * + * Created: Wed Oct 4 2000 + * + * @author POUSSIN Benjamin <bpoussin at free.fr> Copyright COGITEC + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ */ public class Interval extends Observable implements Serializable, Cloneable { // Interval - /** - * - */ + /** serialVersionUID. */ private static final long serialVersionUID = 245693725840885583L; private int min = 0; @@ -117,8 +110,7 @@ /** * Set the value of first. * - * @param v - * Value to assign to first. + * @param v Value to assign to first. */ public void setFirst(int v) { if (first != v) { @@ -140,8 +132,7 @@ /** * Set the value of last. * - * @param v - * Value to assign to last. + * @param v Value to assign to last. */ public void setLast(int v) { if (last != v) { @@ -152,24 +143,26 @@ } /** - * Set the value of last. + * Move. * - * @param v - * Value to assign to last. + * @param decal decal to move */ public void move(int decal) { int first = this.first + decal; - while (first < getMin()) + while (first < getMin()) { first = getMax() - getMin() + first + 1; - if (first > getMax()) + } + if (first > getMax()) { first = first % (getMax() + 1); + } int last = this.last + decal; - while (last < getMin()) + while (last < getMin()) { last = getMax() - getMin() + last + 1; - if (last > getMax()) + } + if (last > getMax()) { last = last % (getMax() + 1); - + } if (this.first != first || this.last != last) { this.first = first; this.last = last; @@ -180,20 +173,27 @@ /** * Retourne vrai si l'entier est dans l'interval. + * + * @param integerToCheck integer to check + * @return <tt>true</tt> if integerToCheck is in interval */ - public boolean contains(int entier) { - if (getFirst() <= getLast()) - return getFirst() <= entier && entier <= getLast(); - return (getMin() <= entier && entier <= getLast()) - || (getFirst() <= entier && entier <= getMax()); + public boolean contains(int integerToCheck) { + if (getFirst() <= getLast()) { + return getFirst() <= integerToCheck && integerToCheck <= getLast(); + } + + boolean result = (getMin() <= integerToCheck && integerToCheck <= getLast()) + || (getFirst() <= integerToCheck && integerToCheck <= getMax()); + return result; } /** * @return le nombre d'element de l'interval */ public int getNbElem() { - if (getFirst() <= getLast()) + if (getFirst() <= getLast()) { return getLast() - getFirst() + 1; + } return (getMax() - getFirst()) + (getLast() - getMin()) + 2; } @@ -203,6 +203,8 @@ /** * retourne une chaine XML qui represente l'objet. + * + * @deprecated since 20090414 (unused) */ public String toXML() { return "<Interval min=\"" + getMin() + "\" max=\"" + getMax() @@ -211,7 +213,9 @@ } /** - * Retourne une representation string de la valeur donne + * Retourne une representation string de la valeur donne. + * + * @deprecated since 20090414 (unused) */ public String getString(int entier) { return String.valueOf(entier); @@ -219,6 +223,8 @@ /** * Retourne une representation entiere de la valeur String donne + * + * @deprecated since 20090414 (unused) */ public int getString(String ch) { return Integer.parseInt(ch); @@ -247,7 +253,7 @@ } @Override - public Interval clone(){ + public Interval clone() { Interval result = new Interval(); result.setFirst(this.getFirst()); result.setLast(this.getLast()); 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalGraphic.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,11 +1,23 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* ##%% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%%**/ package fr.ifremer.isisfish.ui.widget; - import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; @@ -18,37 +30,45 @@ import java.util.Observer; import javax.swing.JComponent; -class IntervalGraphic extends JComponent implements Observer{ // IntervalGraphic +/** + * IntervalGraphic. + * + * Created: Wed Oct 4 2000 + * + * @author poussin + * @version $Revision: 1919 $ + * + * Mise a jour: $Date: 2009-03-09 15:40:20 +0100 (lun. 09 mars 2009) $ + * par : $Author: sletellier $ + */ +public class IntervalGraphic extends JComponent implements Observer { // IntervalGraphic - /** */ + /** serialVersionUID. */ private static final long serialVersionUID = -6795996897731533693L; - /** - * des constantes - */ + + /* some constants. */ private static final int HANDLE_WITH = 5; private static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR); private static final Cursor W_RESIZE_CURSOR = new Cursor(Cursor.W_RESIZE_CURSOR); private static final Cursor E_RESIZE_CURSOR = new Cursor(Cursor.E_RESIZE_CURSOR); private static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR); - //les couleurs + /* Colors. */ 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 vu + */ 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 + * a la position de l'element 1 + */ protected float delta; //tous pour changer la selection avec la souris @@ -60,14 +80,14 @@ //si vrai le composant est editable private boolean enable = true; - class MouseClick extends MouseAdapter{ - public void mouseEntered( MouseEvent e ){ + class MouseClick extends MouseAdapter { + public void mouseEntered( MouseEvent e) { mouseCursor = getCursor(); } - public void mousePressed( MouseEvent e ){ - int mouseX=e.getX(); + public void mousePressed( MouseEvent e) { + int mouseX = e.getX(); - if(model.getFirst() <= model.getLast()){ + if(model.getFirst() <= model.getLast()) { inDrag = (model.getFirst()*coef - HANDLE_WITH < mouseX) && (mouseX < (model.getLast()+1)*coef + HANDLE_WITH); } @@ -79,30 +99,31 @@ ((model.getFirst()*coef - HANDLE_WITH < mouseX) && (mouseX <= getSize().width)); } - if(inDrag) + 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 ){ - if (!inDrag && enable){ + class MouseMove extends MouseMotionAdapter { + 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)){ + (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)){ + (x < (model.getLast()+1)*coef + HANDLE_WITH)) { cursorType = 2; setCursor(E_RESIZE_CURSOR); delta = x - (model.getLast()*coef); - }else{ + } else { boolean bool = ((model.getFirst() <= model.getLast()) && (model.getFirst()*coef + HANDLE_WITH < x) && @@ -115,11 +136,11 @@ ((model.getFirst()*coef + HANDLE_WITH < x) && (x <= getSize().width)))); - if ( bool ){ + if (bool) { cursorType = 1; setCursor(MOVE_CURSOR); } - else{ + else { cursorType = 4; setCursor(DEFAULT_CURSOR); } @@ -161,8 +182,9 @@ } public void setModel(Interval m){ - if(this.model != null) + if(this.model != null) { this.model.deleteObserver(this); + } this.model = m; this.model.addObserver(this); update(this.model, null); @@ -175,7 +197,7 @@ /** * Dessine sur le graphique l'interval courant */ - protected void redraw( Graphics g ){ + protected void redraw( Graphics g ) { coef = (float)getSize().width / (float)(model.getMax()+1); int width = getSize().width; 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalLabel.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,7 +1,20 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* ##%% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%%**/ package fr.ifremer.isisfish.ui.widget; @@ -10,21 +23,31 @@ import javax.swing.JLabel; /** -* La vue en label -*/ + * La vue en label. + * + * Created: Wed Oct 4 2000 + * + * @author poussin + * @version $Revision: 1919 $ + * + * Mise a jour: $Date: 2009-03-09 15:40:20 +0100 (lun. 09 mars 2009) $ + * par : $Author: sletellier $ + */ class IntervalLabel extends JLabel implements Observer { - /** */ + + /** serialVersionUID. */ private static final long serialVersionUID = -6269941008930677478L; + private Interval model = null; private Object[] renderArray; - public IntervalLabel(Interval m){ + public IntervalLabel(Interval m) { super(); setModel(m); } - 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; @@ -36,16 +59,17 @@ this.renderArray = renderArray; } - public void update(Observable o, Object arg){ + public void update(Observable o, Object arg) { setText(toString(model.getFirst()) + " - " + toString(model.getLast())); } protected String toString(int val) { + String result = null; if (renderArray != null && renderArray.length > val) { - return String.valueOf(renderArray[val]); + result = String.valueOf(renderArray[val]); } else { - return String.valueOf(val); + result = String.valueOf(val); } + return result; } } - 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/IntervalPanel.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,24 +1,23 @@ -/**##%% -* Copyright (C) 2002, 2003 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, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%%**/ +/* ##%% + * Copyright (C) 2002, 2003 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%%**/ package fr.ifremer.isisfish.ui.widget; -//import org.codelutin.i18n.*; import java.awt.Dimension; import java.awt.GridLayout; import java.util.Observable; @@ -26,42 +25,49 @@ import javax.swing.JPanel; /** -* Widget permettant d'editer graphiquement un interval. -*/ + * Widget permettant d'editer graphiquement un interval. + * + * Created: Wed Oct 4 2000 + * + * @author poussin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public class IntervalPanel extends JPanel implements Observer { - /** */ + /** 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[]){ + 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; - public IntervalPanel(){ + public IntervalPanel() { this(null); } - public IntervalPanel(Interval model){ + public IntervalPanel(Interval model) { this(model, DEFAULT_WIDTH, DEFAULT_HEIGHT); } - public IntervalPanel(Interval model, int width, int height){ - if(model == null) { - model = new Interval(0,0); + + public IntervalPanel(Interval model, int width, int height) { + if (model == null) { + model = new Interval(0, 0); } this.model = model; setPreferredSize(new Dimension(width, height)); - this.setLayout(new GridLayout(2,1)); + this.setLayout(new GridLayout(2, 1)); graph = new IntervalGraphic(this.model); label = new IntervalLabel(this.model); @@ -71,29 +77,29 @@ this.add(graph); } - public Interval getModel(){ + public Interval getModel() { return model; } - public void setModel(Interval model){ - if(this.model != null) { + public void setModel(Interval model) { + if (this.model != null) { this.model.deleteObserver(this); } - this.model = model; + this.model = model; model.addObserver(this); graph.setModel(model); label.setModel(model); } - public void setEnabled(boolean enable){ + public void setEnabled(boolean enable) { graph.setEnabled(enable); label.setEnabled(enable); } - - public void update(Observable o, Object arg){ + + public void update(Observable o, Object arg) { if (arg instanceof String) { - String props = (String)arg; + String props = (String) arg; if (props.contains("min")) { firePropertyChange("min", null, getModel().getMin()); } @@ -105,7 +111,7 @@ } if (props.contains("last")) { firePropertyChange("last", null, getModel().getLast()); - } + } } } @@ -114,8 +120,3 @@ } } - - - - - Modified: 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 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2002-2008 Code Lutin, Benjamin Poussin + * Copyright (C) 2002-2009 Code Lutin, Benjamin Poussin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -19,7 +19,6 @@ package fr.ifremer.isisfish.ui.widget; - import fr.ifremer.isisfish.IsisFish; import javax.swing.Icon; import javax.swing.JLabel; @@ -28,17 +27,19 @@ import org.codelutin.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(\"...\"); */ - static private Log log = LogFactory.getLog(VCSConnectionState.class); + private static Log log = LogFactory.getLog(VCSConnectionState.class); public VCSConnectionState() { Icon icon; @@ -46,7 +47,7 @@ if (connected) { icon = Resource.getIcon("images/stock_connect.png"); } else { - icon = Resource.getIcon("images/stock_disconnect.png"); + icon = Resource.getIcon("images/stock_disconnect.png"); } setIcon(icon); } Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/VCSConnectionState.java ___________________________________________________________________ Name: svn:keywords + Author Revision Date Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/EquationTableEditor.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,34 +1,21 @@ /* *##% -* Copyright (C) 2002, 2003 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, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ -/* * -* EquationTableEditor.java -* -* Created: 23 mars 2004 -* -* @author Benjamin Poussin <poussin at codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - package fr.ifremer.isisfish.ui.widget.editor; import static org.codelutin.i18n.I18n._; @@ -49,19 +36,29 @@ import java.util.HashSet; import java.util.Iterator; +/** + * EquationTableEditor. + * + * Created: 23 mars 2004 + * + * @author Benjamin Poussin <poussin at codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public class EquationTableEditor extends JButton implements TableCellEditor { // EquationTableEditor - /** - * - */ - private static final long serialVersionUID = -2483612426979170213L; + /** serialVersionUID. */ + private static final long serialVersionUID = -2483612426979170213L; - HashSet<CellEditorListener> listeners = new HashSet<CellEditorListener>(); + protected HashSet<CellEditorListener> listeners = new HashSet<CellEditorListener>(); - EquationEditorPaneUI frame = null; - Equation equation = null; + protected EquationEditorPaneUI frame = null; + protected Equation equation = null; - public EquationTableEditor(){ + public EquationTableEditor() { addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getFrame().setVisible(true); @@ -69,8 +66,8 @@ }); } - protected EquationEditorPaneUI getFrame(){ - if(frame == null){ + protected EquationEditorPaneUI getFrame() { + if (frame == null) { frame = new EquationEditorPaneUI(); frame.getOkButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -86,8 +83,9 @@ return frame; } - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column){ - equation = (Equation)value; + public Component getTableCellEditorComponent(JTable table, Object value, + boolean isSelected, int row, int column) { + equation = (Equation) value; String name = _("isisfish.common.empty"); if (equation != null) { @@ -95,22 +93,25 @@ } this.setText(name); try { - getFrame().setEquation(equation.getCategory(), equation.getName(), equation.getJavaInterface(), equation.getContent()); + getFrame().setEquation(equation.getCategory(), equation.getName(), + equation.getJavaInterface(), equation.getContent()); } catch (Exception eee) { - throw new IsisFishRuntimeException("Can't create file to edit equation", eee); + throw new IsisFishRuntimeException( + "Can't create file to edit equation", eee); } return this; } - public void addCellEditorListener(CellEditorListener l){ + public void addCellEditorListener(CellEditorListener l) { listeners.add(l); } - public void removeCellEditorListener(CellEditorListener l){ + + public void removeCellEditorListener(CellEditorListener l) { listeners.remove(l); } - public Object getCellEditorValue(){ -// Equation equation = getFrame().getEquationEditorPane().getEquation(); + public Object getCellEditorValue() { + // Equation equation = getFrame().getEquationEditorPane().getEquation(); if (equation != null) { String content = getFrame().getEditor().getText(); equation.setContent(content); @@ -118,32 +119,36 @@ return equation; } - public boolean isCellEditable(EventObject anEvent){ + public boolean isCellEditable(EventObject anEvent) { return true; } - public boolean shouldSelectCell(EventObject anEvent){ + + public boolean shouldSelectCell(EventObject anEvent) { return true; } - public void cancelCellEditing(){ + public void cancelCellEditing() { ChangeEvent e = new ChangeEvent(this); - for(Iterator i=listeners.iterator(); i.hasNext();){ - CellEditorListener l=(CellEditorListener)i.next(); + for (Iterator i = listeners.iterator(); i.hasNext();) { + CellEditorListener l = (CellEditorListener) i.next(); l.editingCanceled(e); } - if(frame != null) + if (frame != null) { frame.dispose(); + } } - public boolean stopCellEditing(){ + + public boolean stopCellEditing() { ChangeEvent e = new ChangeEvent(this); - for(Iterator i=listeners.iterator(); i.hasNext();){ - CellEditorListener l=(CellEditorListener)i.next(); + for (Iterator i = listeners.iterator(); i.hasNext();) { + CellEditorListener l = (CellEditorListener) i.next(); l.editingStopped(e); } - if(frame != null) + if (frame != null) { frame.dispose(); + } return true; } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/GenericCell.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/GenericCell.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/GenericCell.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -1,34 +1,58 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ +/* *##% + * Copyright (C) 2002 - 2009 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ package fr.ifremer.isisfish.ui.widget.editor; /** + * GenericCell. * * @author letellier + * Copyright Code Lutin + * @version $Revision: 1628 $ + * + * Mise a jour: $Date: 2008-11-28 10:25:59 +0100 (ven 28 nov 2008) $ + * par : $Author: chatellier $ */ -public class GenericCell{ +public class GenericCell { private String name; private Object value; private Class type; - public GenericCell(String n, Object c, Class t){ + + public GenericCell(String n, Object c, Class t) { name = n; value = c; type = t; } + @Override - public String toString(){ + public String toString() { return name; } - public Object getValue(){ + + public Object getValue() { return value; } - public String getName(){ + + public String getName() { return name; } - public Class getType(){ + + public Class getType() { return type; } } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterColumnEditor.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterColumnEditor.java 2009-04-14 13:43:46 UTC (rev 2104) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterColumnEditor.java 2009-04-14 13:55:22 UTC (rev 2105) @@ -175,7 +175,9 @@ } } catch (Exception eee) { - log.warn("Can't get entity object for combobox", eee); + if (log.isWarnEnabled()) { + log.warn("Can't get entity object for combobox", eee); + } } break; case Boolean: @@ -234,8 +236,10 @@ } } } - log.info("getCellEditorValue [" + type + "] [mapping:" + mapping + "=" + if (log.isInfoEnabled()) { + log.info("getCellEditorValue [" + type + "] [mapping:" + mapping + "=" + editor); + } //+ editor==null?null:editor.getClass().getSimpleName()); return editor; } @@ -289,9 +293,11 @@ result = cub.convert((String) result, type); } - log.info("getCellEditorValue [" + type + "] [mapping:" + mapping + if (log.isInfoEnabled()) { + log.info("getCellEditorValue [" + type + "] [mapping:" + mapping + "]= " + result); - + } + return result; } @@ -341,7 +347,9 @@ * @see javax.swing.CellEditor#cancelCellEditing() */ public void cancelCellEditing() { - log.debug("cancelCellEditing"); + if (log.isDebugEnabled()) { + log.debug("cancelCellEditing"); + } ChangeEvent e = new ChangeEvent(this); for (CellEditorListener listener : listeners) { listener.editingCanceled(e); @@ -374,7 +382,9 @@ */ public boolean stopCellEditing() { // to prevent concurent modification exception - log.debug("stopCellEditing"); + if (log.isDebugEnabled()) { + log.debug("stopCellEditing"); + } CellEditorListener[] list = listeners .toArray(new CellEditorListener[listeners.size()]); @@ -427,8 +437,10 @@ public int getSelectedValue() { int selectedYear = getSelectedYear(); int selectedMounth = getSelectedMounth(); - log.info("selected mounth " + selectedMounth); - log.info("selected year " + selectedYear); + if (log.isInfoEnabled()) { + log.info("selected mounth " + selectedMounth); + log.info("selected year " + selectedYear); + } return selectedMounth + selectedYear * 12; }
participants (1)
-
chatellier@users.labs.libre-entreprise.org