Author: sletellier Date: 2008-10-08 13:30:08 +0000 (Wed, 08 Oct 2008) New Revision: 1538 Added: isis-fish/branches/arbo-maven/src/main/java/fr/ifremer/isisfish/ui/Common.java Log: Interface JAXX Added: isis-fish/branches/arbo-maven/src/main/java/fr/ifremer/isisfish/ui/Common.java =================================================================== --- isis-fish/branches/arbo-maven/src/main/java/fr/ifremer/isisfish/ui/Common.java (rev 0) +++ isis-fish/branches/arbo-maven/src/main/java/fr/ifremer/isisfish/ui/Common.java 2008-10-08 13:30:08 UTC (rev 1538) @@ -0,0 +1,89 @@ +/* *##% + * Copyright (C) 2006 + * 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. + *##%*/ + +/* * + * Welcome.java + * + * Created: 22 ao?t 2006 10:50:49 + * + * @author poussin + * @version $Revision: 1302 $ + * + * Last update: $Date: 2008-08-18 15:42:57 +0200 (Mon, 18 Aug 2008) $ + * by : $Author: bpoussin $ + */ +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 { + + /* + * Return regions + * + * @param + * @return regions + */ + static public Object[] getRegionItem() { + List<String> regionNames = new ArrayList<String>(); + regionNames.add(" "); + regionNames.addAll(RegionStorage.getRegionNames()); + Object[] result = regionNames.toArray(); + return result; + } + + /* + * Return old simulations + * + * @param + * @return old simulations + */ + static public Object[] getOldSimulationItem() { + + try { + List<String> oldSimul = new ArrayList<String>(); + oldSimul.add(" "); + FilterModel<SimulationProperties, String> filterModel; + // keep in context list of old simulation names (for filter process) + oldSimul.addAll(SimulationStorage.getSimulationNames()); + // create filter model + filterModel = SimulationFilterUtil.createFilterModel(oldSimul); + // to used directly model.getFilteredResult() in xml + // we must fill filterModel result with original items + filterModel.selectAll(); + Object[] result = oldSimul.toArray(); + return result; + } catch (ParseException ex) { + Logger.getLogger(Common.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(Common.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } +}