r3239 - in isis-fish/branches/3.3.1: . src/main/java/fr/ifremer/isisfish/logging src/main/java/fr/ifremer/isisfish/ui src/main/java/fr/ifremer/isisfish/ui/models/common src/main/java/fr/ifremer/isisfish/ui/result src/main/resources/i18n src/main/resources/images
Author: chatellier Date: 2011-04-08 14:26:03 +0000 (Fri, 08 Apr 2011) New Revision: 3239 Log: Refactor ResultUI using generic interface in nuiton-matrix. Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java Removed: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java isis-fish/branches/3.3.1/src/main/resources/images/sigma-barre.gif isis-fish/branches/3.3.1/src/main/resources/images/sigma.gif Modified: isis-fish/branches/3.3.1/pom.xml isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties Modified: isis-fish/branches/3.3.1/pom.xml =================================================================== --- isis-fish/branches/3.3.1/pom.xml 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/pom.xml 2011-04-08 14:26:03 UTC (rev 3239) @@ -48,14 +48,14 @@ <dependency> <groupId>org.nuiton.matrix</groupId> <artifactId>nuiton-matrix</artifactId> - <version>2.1.1-SNAPSHOT</version> + <version>2.2-SNAPSHOT</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.nuiton.matrix</groupId> <artifactId>nuiton-matrix-gui</artifactId> - <version>2.1.1-SNAPSHOT</version> + <version>2.2-SNAPSHOT</version> <scope>compile</scope> </dependency> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/logging/SimulationLoggerUtil.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -170,32 +170,26 @@ * Open a new log console for the given simulation * * @param simulationName name of the simulation to use - * @throws Exception todo + * @throws IOException + * @throws IllegalArgumentException */ - public static void showSimulationLogConsole(String simulationName) throws Exception { - if (simulationName != null) { + public static void showSimulationLogConsole(String simulationName) throws IllegalArgumentException, IOException { + SimulationStorage storage; - try { - SimulationStorage storage; + storage = SimulationStorage.getSimulation(simulationName); - storage = SimulationStorage.getSimulation(simulationName); + File logFile = new File(storage.getSimulationLogFile()); - File logFile = new File(storage.getSimulationLogFile()); + String smtpServer = IsisFish.config.getSmtpServer(); + String defaultFrom = IsisFish.config.getUserMail(); - String smtpServer = IsisFish.config.getSmtpServer(); - String defaultFrom = IsisFish.config.getUserMail(); + String defaultTo = IsisConfig.REPORT_EMAIL; + String title = _("isisfish.simulation.log.console.title", simulationName); - String defaultTo = IsisConfig.REPORT_EMAIL; - String title = _("isisfish.simulation.log.console.title", simulationName); + LogConsole.newConsole(logFile, smtpServer, defaultFrom, defaultTo, title); - LogConsole.newConsole(logFile, smtpServer, defaultFrom, defaultTo, title); - - log.info(_("isisfish.simulation.log.showConsole", simulationName)); - - } catch (Exception eee) { - log.warn(_("isisfish.error.simulation.log.openAppender", simulationName, eee.getMessage()), eee); - throw eee; - } + if (log.isInfoEnabled()) { + log.info(_("isisfish.simulation.log.showConsole", simulationName)); } } Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -59,7 +59,7 @@ import fr.ifremer.isisfish.ui.input.InputSaveVerifier; import fr.ifremer.isisfish.ui.input.InputUI; import fr.ifremer.isisfish.ui.queue.QueueUI; -import fr.ifremer.isisfish.ui.result.ResultView; +import fr.ifremer.isisfish.ui.result.ResultUI; import fr.ifremer.isisfish.ui.script.ScriptUI; import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI; import fr.ifremer.isisfish.ui.simulator.SimulAction; @@ -146,7 +146,7 @@ * @param welcomeUI */ public void newResultFrame(WelcomeUI welcomeUI) { - openFrame(welcomeUI, new ResultView(), _("isisfish.result.title")); + openFrame(welcomeUI, new ResultUI(), _("isisfish.result.title")); } /** Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2011-04-08 14:26:03 UTC (rev 3239) @@ -57,7 +57,7 @@ constructorParams='new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(new SimulAction()).add(this)' /> </tab> <tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/calc.gif"))}'> - <fr.ifremer.isisfish.ui.result.ResultView /> + <fr.ifremer.isisfish.ui.result.ResultUI /> </tab> <tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/bookPage.gif"))}'> <fr.ifremer.isisfish.ui.script.ScriptUI /> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -66,7 +66,6 @@ * @param stringList {@link String} list */ public StringListModel(List<String> stringList) { - super(); setStringList(stringList); } Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResult.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,131 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.io.File; -import java.io.FileWriter; -import java.util.Iterator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.util.FileUtil; - -/** - * Objet permettant l'affichage des donnees resultats sous forme de - * matrice. - */ -public class DataResult extends DataResultUI { // IfremerSimulation - - /** serialVersionUID. */ - private static final long serialVersionUID = -4089377865270062094L; - - /** Class logger. */ - private static Log log = LogFactory.getLog(DataResult.class); - - protected MatrixND matrix; - - public DataResult() { - super(); - init(); - } - - public MatrixND getMatrix() { - return matrix; - } - - public void setMatrix(MatrixND v) { - this.matrix = v; - reload(); - } - - public void reload(){ - loadDescription(); - loadMatrice(); - } - - /** - * Affiche le titre de la matrice - */ - public void loadDescription(){ - getDescriptionLabel().setText(getMatrix().getName()); - } - - /** - * Affiche la matrice dans le panel de matrice - */ - public void loadMatrice(){ - // TODO remplacer la table specifique comme expliqué dans le FIXME - // pour l'affichage des data - // par le panel des matrix qui fait la meme chose - // Il faut juste ajouter que si la matrice a 2 dimensions - // le coin en haut a gauche affiche l'intitulé des dimension - // par exemple 'date/population' - -// getMatrixPanel().setMatrice(getMatrix()); - // FIXME si le composant ou dessus fonctionne, supprimer la ligne - // suivante et sans doute aussi le MatrixInfoTableModel. - getMatriceTable().setModel(new MatrixInfoTableModel(getMatrix())); - - } - - public void on_exportButton_clicked(){ - String result = getMatrix().getName() + ";"; - try{ - File file = FileUtil.getFile(".+.csv", "CSV file"); - if(file != null){ - for (Iterator i=getMatrix().getSemantics(1).iterator(); - i.hasNext();){ - - result += i.next().toString(); - if(i.hasNext()){ - result += ";"; - }else{ - result += "\n"; - } - } - - int y=0; - for (Iterator i=getMatrix().getSemantics(0).iterator(); - i.hasNext(); y++){ - result += i.next().toString()+";"; - for(int x=0; x<getMatrix().getDim(1); x++){ - result += getMatrix().getValue(y, x) + ";"; - } - result += "\n"; - } - - FileWriter writer = new FileWriter(file); - writer.write(result); - writer.close(); - } - }catch(Exception eee){ - log.error(":104:Error during export"+eee); - } - } - -} - Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,235 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.JTableHeader; - -public abstract class DataResultUI extends JPanel implements DataResultUICallback{ - - protected void init(){ - DataResultUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getDataResultChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getDataResultChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable2()); - return result; - } - - private JPanel __table2__ = null; - public JPanel getTable2(){ - if(__table2__ == null){ - Vector childs = getTable2Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 6; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 2; - c.weightx = 1; - c.weighty = 5; - c.gridwidth = 1; - c.gridheight = 4; - c.fill = GridBagConstraints.BOTH; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table2__ = result; - } - return __table2__; - } - - public Vector getTable2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getDescriptionLabel()); - result.add(getExportButton()); - result.add(getScrolledwindow2()); - return result; - } - - private JLabel __descriptionLabel__ = null; - public JLabel getDescriptionLabel(){ - if(__descriptionLabel__ == null){ - JLabel result = new JLabel(_("isisfish.simulation.name")); - - __descriptionLabel__ = result; - } - return __descriptionLabel__; - } - - private JButton __exportButton__ = null; - public JButton getExportButton(){ - if(__exportButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.dataResult.export.csv"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_exportButton_clicked(); - } - }); - - __exportButton__ = result; - } - return __exportButton__; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMatriceTable()); - return result; - } - - private JTable __matriceTable__ = null; - public JTable getMatriceTable(){ - if(__matriceTable__ == null){ - Vector head = getMatriceTableHead(); - JTable result = - new JTable(new DefaultTableModel(new Vector(), head)); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - setSignalMatriceTableHeader(result); - - __matriceTable__ = result; - } - return __matriceTable__; - } - - public Vector getMatriceTableHead(){ - Vector<String> result = new Vector<String>(); - result.add(_("isisfish.dataResult.label")); - result.add(_("isisfish.dataResult.label")); - result.add(_("isisfish.dataResult.label")); - return result; - } - - public void setSignalMatriceTableHeader(JTable table){ - JTableHeader result = table.getTableHeader(); - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/DataResultUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,31 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - - -public interface DataResultUICallback{ - - public void on_exportButton_clicked(); -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBean.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,229 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JPanel; - -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.editor.ChartEditor; -import org.jfree.chart.editor.ChartEditorManager; -import org.jfree.chart.labels.StandardCategoryToolTipGenerator; -import org.jfree.chart.renderer.category.AreaRenderer; -import org.jfree.chart.renderer.category.BarRenderer; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.chart.renderer.category.LineAndShapeRenderer; -import org.jfree.chart.renderer.category.LineRenderer3D; -import org.jfree.chart.renderer.category.MinMaxCategoryRenderer; -import org.jfree.chart.renderer.category.StackedAreaRenderer; -import org.jfree.chart.renderer.category.StackedBarRenderer; - -/** - * GraphBean. - * - * Created: Mon Apr 29 17:48:40 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphBean extends GraphBeanUI implements GraphBeanUICallback, - GraphListener { - - /** serialVersionUID */ - private static final long serialVersionUID = -4474836708965453250L; - - protected GraphBeanModel model; - protected JPanel graphPalette; - protected ChartPanel chartPanel; - protected JFreeChart chart; - - public GraphBean() { - super(); - init(); - getGraphRendererCombo().setEditable(false); - getGraphRendererCombo().setRenderer(new GraphComboRenderer()); - loadGraphRendererCombo(); - } - - protected void loadGraphRendererCombo() { - DefaultComboBoxModel model = new DefaultComboBoxModel(); - - // rendu : vertical bar - BarRenderer barRenderer = new BarRenderer(); - barRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(barRenderer); - - // rendu : vertical bar 3d - BarRenderer3D barRenderer3D = new BarRenderer3D(); - barRenderer3D.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(barRenderer3D); - - // rendu stacked bar - StackedBarRenderer stackedBarRenderer = new StackedBarRenderer(); - stackedBarRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(stackedBarRenderer); - - // rendu aire - AreaRenderer areaRenderer = new AreaRenderer(); - areaRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(areaRenderer); - - // rendu aire empilée - StackedAreaRenderer stackedAreaRenderer = new StackedAreaRenderer(); - stackedAreaRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(stackedAreaRenderer); - - // rendu line aire - LineAndShapeRenderer lineAndShapeRenderer = new LineAndShapeRenderer(); - lineAndShapeRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(lineAndShapeRenderer); - - // rendu ligne 3d - LineRenderer3D lineRenderer3D = new LineRenderer3D(); - lineRenderer3D.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(lineRenderer3D); - - // rendu mix/max - MinMaxCategoryRenderer minMaxCategoryRenderer = new MinMaxCategoryRenderer(); - minMaxCategoryRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - model.addElement(minMaxCategoryRenderer); - - model.setSelectedItem(null); - getGraphRendererCombo().setModel(model); - } - - /** - * Get the value of model. - * @return value of model. - */ - public GraphBeanModel getModel() { - return model; - } - - /** - * Set the value of model. - * @param v Value to assign to model. - */ - public void setModel(GraphBeanModel v) { - this.model = v; - model.addGraphListener(this); - // displayGraph(); - } - - public void graphChanged(GraphEvent e) { - displayGraph(); - } - - /** - * Get the value of chartPanel. - * @return value of chartPanel. - */ - public ChartPanel getChartPanel() { - return chartPanel; - } - - /** - * Set the value of chartPanel. - * @param v Value to assign to chartPanel. - */ - public void setChartPanel(ChartPanel v) { - this.chartPanel = v; - } - - /** - * Get the value of graphPalette. - * @return value of graphPalette. - */ - public JPanel getGraphPalette() { - return graphPalette; - } - - /** - * Set the value of graphPalette. - * @param v Value to assign to graphPalette. - */ - public void setGraphPalette(JPanel v) { - this.graphPalette = v; - } - - /** - * Get the value of chart. - * @return value of chart. - */ - public JFreeChart getChart() { - return chart; - } - - /** - * Set the value of chart. - * @param v Value to assign to chart. - */ - public void setChart(JFreeChart v) { - this.chart = v; - } - - public void displayGraph() { - - JFreeChart chart = new JFreeChart(getModel().getTitle(), - JFreeChart.DEFAULT_TITLE_FONT, getModel().getCategoryPlot(), true); - - setChart(chart); - setChartPanel(new ChartPanel(chart)); - - // C'est un DefaultChartEditor (mais en visibilite package) - // qui etend JPanel et ChartEditor (en version 1.0.13 du moins) - setGraphPalette((JPanel) ChartEditorManager.getChartEditor(this.chart)); - - //getGraphSplitPane().setDividerLocation(1.0); - - getGraphPanel().removeAll(); - getPalettePanel().removeAll(); - getGraphPanel().add(getChartPanel()); - getPalettePanel().add(getGraphPalette()); - getGraphPanel().invalidate(); - getPalettePanel().invalidate(); - getGraphPanel().validate(); - getPalettePanel().validate(); - getGraphPanel().repaint(); - getPalettePanel().repaint(); - } - - public void on_appliquer_clicked() { - ((ChartEditor) getGraphPalette()).updateChart(getChart()); - } - - public void on_graphRendererCombo_selectionChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - getModel().setRenderer( - (CategoryItemRenderer) getGraphRendererCombo() - .getSelectedItem()); - } - } - -}// GraphBean Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanModel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,194 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.HashSet; -import java.util.Iterator; - -import org.jfree.chart.axis.CategoryAxis; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.axis.NumberAxis3D; -import org.jfree.chart.axis.ValueAxis; -import org.jfree.chart.labels.StandardCategoryToolTipGenerator; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.data.category.CategoryDataset; -import org.nuiton.math.matrix.MatrixND; - -/** - * GraphBeanModel. - * - * Created: Fri May 17 13:29:47 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphBeanModel { - - // protected VerticalCategoryPlot verticalCategoryPlot; - protected CategoryDataset categoryDataset; - protected CategoryAxis horizontalAxis; - protected ValueAxis verticalAxis; - protected CategoryItemRenderer renderer; - protected MatrixND matrix; - - // table de toutes les vues du modèle - private HashSet listeners = new HashSet(); - - public GraphBeanModel() { - horizontalAxis = new CategoryAxis(); - horizontalAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); - renderer = new BarRenderer3D(); - renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); - verticalAxis = new NumberAxis3D(); - } - - /** - * Méthode qui permet d'ajouter une vue au modèle - * @param view la nouvelle vue - */ - public void addGraphListener(GraphListener view) { - listeners.add(view); - } - - /** - * Méthode qui retire une vue du modèle - * @param view la vue à retirer - */ - public void removeGraphListener(GraphListener view) { - listeners.remove(view); - } - - /** - * Accesseur sur la table des listeners du modèle - * @return la collection des listeners - */ - public HashSet getGraphListeners() { - return listeners; - } - - /** - * Accesseur en écriture sur la table des listeners du modèle - * @param obs la collection des listeners - */ - public void setGraphListeners(HashSet obs) { - listeners = obs; - } - - /** - * Previent les vues que le model a change - * - */ - protected void fireGraphChanged() { - // Iterateur pour parcourir les vues - Iterator listenersIterator = listeners.iterator(); - GraphEvent ge = new GraphEvent(this); - - while (listenersIterator.hasNext()) { - GraphListener listener = ((GraphListener) listenersIterator.next()); - listener.graphChanged(ge); - } - } - - /** - * Get the value of title. - * @return value of title. - */ - public String getTitle() { - return matrix.getName(); - } - - /** - * Get the value of categoryDataset. - * @return value of categoryDataset. - */ - public CategoryDataset getCategoryDataset() { - return categoryDataset; - } - - /** - * Set the value of categoryDataset. - * @param v Value to assign to categoryDataset. - */ - public void setCategoryDataset(CategoryDataset v) { - this.categoryDataset = v; - fireGraphChanged(); - } - - public void setMatrix(MatrixND mi) { - matrix = mi; - setCategoryDataset(new GraphMatrixNDDataset(mi)); - } - - public CategoryPlot getCategoryPlot() { - return new CategoryPlot(getCategoryDataset(), getHorizontalAxis(), - getVerticalAxis(), getRenderer()); - } - - /** - * Get the value of horizontalAxis. - * @return value of horizontalAxis. - */ - public CategoryAxis getHorizontalAxis() { - horizontalAxis.setLabel(matrix.getDimensionName(0)); - return horizontalAxis; - } - - /** - * Get the value of renderer. - * @return value of renderer. - */ - public CategoryItemRenderer getRenderer() { - return renderer; - } - - /** - * Set the value of renderer. - * @param v Value to assign to renderer. - */ - public void setRenderer(CategoryItemRenderer v) { - this.renderer = v; - fireGraphChanged(); - } - - /** - * Get the value of verticalAxis. - * @return value of verticalAxis. - */ - public ValueAxis getVerticalAxis() { - return verticalAxis; - } - - /** - * Set the value of verticalAxis. - * @param v Value to assign to verticalAxis. - */ - public void setVerticalAxis(ValueAxis v) { - this.verticalAxis = v; - fireGraphChanged(); - } - -}// GraphBeanModel Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,394 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JViewport; - -public abstract class GraphBeanUI extends JPanel implements GraphBeanUICallback{ - - protected void init(){ - GraphBeanUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getGraphBeanChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getGraphBeanChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphSplitPane()); - return result; - } - - private JSplitPane __graphSplitPane__ = null; - public JSplitPane getGraphSplitPane(){ - if(__graphSplitPane__ == null){ - Vector childs = getGraphSplitPaneChilds(); - Component child1 = null; - Component child2 = null; - if(childs.size() >= 1) - child1 = (Component)childs.get(0); - if(childs.size() >= 2) - child2 = (Component)childs.get(1); - - JSplitPane result = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - child1, child2); - result.setOneTouchExpandable(true); - result.setDividerSize(10); - - __graphSplitPane__ = result; - } - return __graphSplitPane__; - } - - public Vector getGraphSplitPaneChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable3()); - result.add(getTable1()); - return result; - } - - private JPanel __table3__ = null; - public JPanel getTable3(){ - if(__table3__ == null){ - Vector childs = getTable3Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 3; - c.gridwidth = 2; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table3__ = result; - } - return __table3__; - } - - public Vector getTable3Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel1()); - result.add(getScrolledwindow1()); - result.add(getGraphRendererCombo()); - return result; - } - - private JLabel __label1__ = null; - public JLabel getLabel1(){ - if(__label1__ == null){ - JLabel result = new JLabel(_("isisfish.graphBean.graph.render")); - - __label1__ = result; - } - return __label1__; - } - - private JScrollPane __scrolledwindow1__ = null; - public JScrollPane getScrolledwindow1(){ - if(__scrolledwindow1__ == null){ - Vector childs = getScrolledwindow1Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow1__ = result; - } - return __scrolledwindow1__; - } - - public Vector getScrolledwindow1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getViewport1()); - return result; - } - - private JViewport __viewport1__ = null; - public JViewport getViewport1(){ - if(__viewport1__ == null){ - JViewport result = new JViewport(); - Vector childs = getViewport1Childs(); - for (Object child : childs) result.add((Component) child); - - __viewport1__ = result; - } - return __viewport1__; - } - - public Vector getViewport1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable99()); - return result; - } - - private JPanel __table99__ = null; - public JPanel getTable99(){ - if(__table99__ == null){ - Vector childs = getTable99Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table99__ = result; - } - return __table99__; - } - - public Vector getTable99Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphPanel()); - return result; - } - - private javax.swing.JPanel __graphPanel__ = null; - public javax.swing.JPanel getGraphPanel(){ - if(__graphPanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __graphPanel__ = result; - } - return __graphPanel__; - } - - private JComboBox __graphRendererCombo__ = null; - public JComboBox getGraphRendererCombo(){ - if(__graphRendererCombo__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_graphRendererCombo_selectionChanged(e); - } - }); - - __graphRendererCombo__ = result; - } - return __graphRendererCombo__; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable2()); - result.add(getAppliquer()); - return result; - } - - private JPanel __table2__ = null; - public JPanel getTable2(){ - if(__table2__ == null){ - Vector childs = getTable2Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table2__ = result; - } - return __table2__; - } - - public Vector getTable2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getPalettePanel()); - return result; - } - - private javax.swing.JPanel __palettePanel__ = null; - public javax.swing.JPanel getPalettePanel(){ - if(__palettePanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __palettePanel__ = result; - } - return __palettePanel__; - } - - private JButton __appliquer__ = null; - public JButton getAppliquer(){ - if(__appliquer__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.apply"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_appliquer_clicked(); - } - }); - - __appliquer__ = result; - } - return __appliquer__; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphBeanUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,34 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -public interface GraphBeanUICallback{ - - public void on_graphRendererCombo_selectionChanged(ItemEvent e); - public void on_appliquer_clicked(); -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphComboRenderer.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,87 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; - -import org.jfree.chart.renderer.category.AreaRenderer; -import org.jfree.chart.renderer.category.BarRenderer; -import org.jfree.chart.renderer.category.BarRenderer3D; -import org.jfree.chart.renderer.category.IntervalBarRenderer; -import org.jfree.chart.renderer.category.LayeredBarRenderer; -import org.jfree.chart.renderer.category.LineAndShapeRenderer; -import org.jfree.chart.renderer.category.LineRenderer3D; -import org.jfree.chart.renderer.category.MinMaxCategoryRenderer; -import org.jfree.chart.renderer.category.StackedAreaRenderer; -import org.jfree.chart.renderer.category.StackedBarRenderer; - -/** - * GraphComboRenderer. - * - * Created: Thu Sep 12 19:55:10 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphComboRenderer extends DefaultListCellRenderer { - - /** serialVersionUID */ - private static final long serialVersionUID = 5439698068065934760L; - - public GraphComboRenderer() { - super(); - } - - public Component getListCellRendererComponent(JList liste, Object o, - int attributeIndex, boolean isSelected, boolean hasFocus) { - super.getListCellRendererComponent(liste, o, attributeIndex, - isSelected, hasFocus); - if (o instanceof StackedBarRenderer) { - setText(_("isisfish.graphCombo.render.bar.stacked")); - } else if (o instanceof BarRenderer3D) { - setText(_("isisfish.graphCombo.render.bar.3d")); - } else if (o instanceof BarRenderer) { - setText(_("isisfish.graphCombo.render.bar")); - } else if (o instanceof StackedAreaRenderer) { - setText(_("isisfish.graphCombo.render.surface.stacked")); - } else if (o instanceof AreaRenderer) { - setText(_("isisfish.graphCombo.render.surface")); - } else if (o instanceof LineRenderer3D) { - setText(_("isisfish.graphCombo.render.line.3d")); - } else if (o instanceof LineAndShapeRenderer) { - setText(_("isisfish.graphCombo.render.line")); - } else if (o instanceof MinMaxCategoryRenderer) { - setText(_("isisfish.graphCombo.render.min.max")); - } else { - setText((o == null) ? "" : o.toString()); - } - return this; - } -}// GraphComboRenderer Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphEvent.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,45 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.EventObject; - -/** - * GraphEvent.java - * - * Created: Tue May 21 16:42:58 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphEvent extends EventObject { - /** serialVersionUID */ - private static final long serialVersionUID = 4189617216481564748L; - - public GraphEvent(GraphBeanModel gbm) { - super((Object) gbm); - } - -}// GraphEvent Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphListener.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,39 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.EventListener; - -/** - * GraphListener. - * - * Created: Tue May 21 16:36:39 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public interface GraphListener extends EventListener { - public void graphChanged(GraphEvent e); -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/GraphMatrixNDDataset.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,255 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ResourceBundle; - -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.AbstractSeriesDataset; -import org.jfree.data.resources.DataPackageResources; -import org.nuiton.math.matrix.MatrixND; - -/** - * GraphMatrixNDDataset. - * - * Created: Fri May 17 16:26:19 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class GraphMatrixNDDataset extends AbstractSeriesDataset implements - CategoryDataset { //XYDataset { - - /** serialVersionUID. */ - private static final long serialVersionUID = -891382923646394164L; - - /** The series names. */ - protected List seriesNames; - - /** The categories. */ - protected List categories; - - /** Storage for the data. */ - protected MatrixND mat; - - public GraphMatrixNDDataset(MatrixND mat) { - this(mat.getSemantic(1), mat.getSemantic(0), mat); - } - - /** - * Constructs a GraphMatrixNDDataset, populates it with the matrix, and uses the - * supplied names for the series and the supplied objects for the categories. - * - * @param seriesNames The series names. - * @param categories The categories. - * @param mat The matrix. - */ - public GraphMatrixNDDataset(List seriesNames, List categories, MatrixND mat) { - - this.mat = mat; - - if (mat != null && mat.getDimCount() > 1) { - - String baseName = DataPackageResources.class.getCanonicalName(); - ResourceBundle resources = ResourceBundle.getBundle(baseName); - - int series_count = mat.getDim(1); - if (series_count > 0) { - - // set up the series names... - if (seriesNames != null) { - - if (seriesNames.size() != series_count) { - throw new IllegalArgumentException( - "DefaultCategoryDataset: the number of " - + "series names does not match the number of series in the data."); - } - - this.seriesNames = seriesNames; - } else { - String prefix = resources - .getString("series.default-prefix") - + " "; - this.seriesNames = this.generateNames(series_count, prefix); - } - - if (mat.getDimCount() > 1) { - // set up the category names... - int categoryCount = mat.getDim(0); - if (categories != null) { - if (categories.size() != categoryCount) { - throw new IllegalArgumentException( - "DefaultCategoryDataset: the number of " - + "categories does not match the number of categories in the data."); - } - this.categories = categories; - } else { - String prefix = resources - .getString("categories.default-prefix") - + " "; - this.categories = this.generateNames(categoryCount, - prefix); - } - } else { - this.categories = null; - } - } else { - this.seriesNames = null; - this.categories = null; - } - } else { - this.seriesNames = null; - this.categories = null; - } - } - - /** - * Generates an array of names, by appending a space plus an integer (starting with 1) - * to the supplied prefix string. - * @param count The number of names required. - * @param prefix The name prefix. - */ - private List generateNames(int count, String prefix) { - - List result = new ArrayList(); - String name; - for (int i = 0; i < count; i++) { - name = prefix + (i + 1); - result.add(name); - } - return result; - - } - - /* - * @see org.jfree.data.general.AbstractSeriesDataset#getSeriesCount() - */ - @Override - public int getSeriesCount() { - int result = 0; - if (mat != null && mat.getNbDim() > 1) { - result = mat.getDim(1); - } - return result; - } - - /* - * @see org.jfree.data.general.AbstractSeriesDataset#getSeriesKey(int) - */ - @Override - public Comparable getSeriesKey(int series) { - return seriesNames.get(series).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnIndex(java.lang.Comparable) - */ - @Override - public int getColumnIndex(Comparable key) { - return categories.indexOf(key); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnKey(int) - */ - @Override - public Comparable getColumnKey(int column) { - return categories.get(column).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getColumnKeys() - */ - @Override - public List getColumnKeys() { - - // the CategoryDataset interface expects a list of categories, but we've stored them in - // an array... - if (categories == null) { - return new ArrayList(); - } else { - return Collections.unmodifiableList(categories); - } - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowIndex(java.lang.Comparable) - */ - @Override - public int getRowIndex(Comparable key) { - return seriesNames.indexOf(key); - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowKey(int) - */ - @Override - public Comparable getRowKey(int row) { - return seriesNames.get(row).toString(); - } - - /* - * @see org.jfree.data.KeyedValues2D#getRowKeys() - */ - @Override - public List getRowKeys() { - return seriesNames; - } - - /* - * @see org.jfree.data.KeyedValues2D#getValue(java.lang.Comparable, java.lang.Comparable) - */ - @Override - public Number getValue(Comparable rowKey, Comparable columnKey) { - return new Double(mat.getValue(columnKey, rowKey)); - } - - /* - * @see org.jfree.data.Values2D#getColumnCount() - */ - @Override - public int getColumnCount() { - return categories.size(); - } - - /* - * @see org.jfree.data.Values2D#getRowCount() - */ - @Override - public int getRowCount() { - return seriesNames.size(); - } - - /* - * @see org.jfree.data.Values2D#getValue(int, int) - */ - @Override - public Number getValue(int row, int column) { - return new Double(mat.getValue(column, row)); - } -} // GraphMatrixNDDataset Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItem.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,97 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.ListSelectionModel; - -import org.nuiton.util.Resource; - -/** - * InfoItem.java - * - * Created: Thu Jul 06 13:54:59 2000 - * - * @author PERNEL Xavier - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class InfoItem extends InfoItemUI implements InfoPanelable { - - protected int position; - - public InfoItem() { - super(); - init(); - - ImageIcon sigmabarre = Resource.getIcon("images/sigma-barre.gif"); - ImageIcon sigma = Resource.getIcon("images/sigma.gif"); - getSumButton().setSelectedIcon(sigma); - getSumButton().setIcon(sigmabarre); - getSumButton().setBorder(BorderFactory.createEtchedBorder()); - getSumButton().setBorderPainted(true); - getSumButton().setToolTipText(_("isisfish.infoItem.sum")); - - getList().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - } - - /** - * Get the value of position. - * @return value of position. - */ - public int getPosition() { - return position; - } - - /** - * Set the value of position. - * @param v Value to assign to position. - */ - public void setPosition(int v) { - this.position = v; - } - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(){ - if (getSumButton().isSelected()){ - return -1; - }else{ - return 1; - } - } -} // InfoItem Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDate.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,111 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -/** -* InfoItemDate.java -* -* -* Created: Thu Jul 06 14:06:32 2000 -* -* @author PERNEL Xavier -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.ListSelectionModel; - -import org.nuiton.util.Resource; - -public class InfoItemDate extends InfoItemDateUI implements InfoPanelable { - - protected int position; - - public InfoItemDate() { - super(); - init(); - - getLabel().setText(_("isisfish.common.date")); - ImageIcon sigmabarre = Resource.getIcon("images/sigma-barre.gif"); - ImageIcon sigma = Resource.getIcon("images/sigma.gif"); - getSumButton().setSelectedIcon(sigma); - getSumButton().setIcon(sigmabarre); - getSumButton().setBorder(BorderFactory.createEtchedBorder()); - getSumButton().setBorderPainted(true); - getSumButton().setToolTipText(_("isisfish.infoItem.sum")); - - ImageIcon sigmaAnBarre = Resource.getIcon("images/sigma_an-barre.gif"); - ImageIcon sigmaAn = Resource.getIcon("images/sigma_an.gif"); - getSumAnButton().setSelectedIcon(sigmaAn); - getSumAnButton().setIcon(sigmaAnBarre); - getSumAnButton().setBorder(BorderFactory.createEtchedBorder()); - getSumAnButton().setBorderPainted(true); - getSumAnButton().setToolTipText(_("isisfish.infoItem.sum.year")); - - getList().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - getList().setCellRenderer(new InfoItemDateListRenderer()); - } - - /** - * Get the value of position. - * @return value of position. - */ - public int getPosition() { - return position; - } - - /** - * Set the value of position. - * @param v Value to assign to position. - */ - public void setPosition(int v) { - this.position = v; - } - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(){ - if (getSumButton().isSelected()){ - return -1; - }else if (getSumAnButton().isSelected()){ - return 12; - }else{ - return 1; - } - } -} // InfoItemDate Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateListRenderer.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,63 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import java.awt.Component; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; - -import fr.ifremer.isisfish.types.Date; - -/** - * InfoItemDateListRenderer. - * - * Created: Thu Sep 12 20:16:20 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class InfoItemDateListRenderer extends DefaultListCellRenderer { - - /** serialVersionUID */ - private static final long serialVersionUID = -3340579108147857972L; - - public InfoItemDateListRenderer (){ - super(); - } - - public Component getListCellRendererComponent(JList liste, - Object o, - int attributeIndex, - boolean isSelected, - boolean hasFocus){ - super.getListCellRendererComponent(liste, o, attributeIndex,isSelected, hasFocus); - if (o instanceof Date) - setText((o == null) ? "" : ((Date)o).getMonth().toString()+" "+((Date)o).getYear()); - else - setText((o == null) ? "" : o.toString()); - return this; - } -}// InfoItemDateListRenderer Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,265 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; - -public abstract class InfoItemDateUI extends JPanel implements InfoItemDateUICallback{ - - protected void init(){ - InfoItemDateUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getInfoItemDateChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = (ButtonGroup)hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getInfoItemDateChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable31()); - return result; - } - - private JPanel __table31__ = null; - public JPanel getTable31(){ - if(__table31__ == null){ - Vector childs = getTable31Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table31__ = result; - } - return __table31__; - } - - public Vector getTable31Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable32()); - result.add(getScrolledwindow2()); - return result; - } - - private JPanel __table32__ = null; - public JPanel getTable32(){ - if(__table32__ == null){ - Vector childs = getTable32Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[2] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table32__ = result; - } - return __table32__; - } - - public Vector getTable32Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel()); - result.add(getSumAnButton()); - result.add(getSumButton()); - return result; - } - - private JLabel __label__ = null; - public JLabel getLabel(){ - if(__label__ == null){ - JLabel result = new JLabel(_("isisfish.infoItem.label")); - - __label__ = result; - } - return __label__; - } - - private JToggleButton __sumAnButton__ = null; - public JToggleButton getSumAnButton(){ - if(__sumAnButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.common.sum")); - - __sumAnButton__ = result; - } - return __sumAnButton__; - } - - private JToggleButton __sumButton__ = null; - public JToggleButton getSumButton(){ - if(__sumButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.infoItem.sum")); - - __sumButton__ = result; - } - return __sumButton__; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getList()); - return result; - } - - private JList __list__ = null; - public JList getList(){ - if(__list__ == null){ - JList result = new JList(new DefaultListModel()); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - __list__ = result; - } - return __list__; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemDateUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface InfoItemDateUICallback{ - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,242 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.JViewport; -import javax.swing.ListSelectionModel; - -public abstract class InfoItemUI extends JPanel implements InfoItemUICallback{ - - protected void init(){ - InfoItemUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getInfoItemChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String, ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getInfoItemChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable29()); - return result; - } - - private JPanel __table29__ = null; - public JPanel getTable29(){ - if(__table29__ == null){ - Vector childs = getTable29Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table29__ = result; - } - return __table29__; - } - - public Vector getTable29Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable30()); - result.add(getScrolledwindow1()); - return result; - } - - private JPanel __table30__ = null; - public JPanel getTable30(){ - if(__table30__ == null){ - Vector childs = getTable30Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table30__ = result; - } - return __table30__; - } - - public Vector getTable30Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getLabel()); - result.add(getSumButton()); - return result; - } - - private JLabel __label__ = null; - public JLabel getLabel(){ - if(__label__ == null){ - JLabel result = new JLabel(_("isisfish.infoItem.label")); - - __label__ = result; - } - return __label__; - } - - private JToggleButton __sumButton__ = null; - public JToggleButton getSumButton(){ - if(__sumButton__ == null){ - JToggleButton result = new JToggleButton(_("isisfish.common.blank"), false); - result.setToolTipText(_("isisfish.common.sum")); - - __sumButton__ = result; - } - return __sumButton__; - } - - private JScrollPane __scrolledwindow1__ = null; - public JScrollPane getScrolledwindow1(){ - if(__scrolledwindow1__ == null){ - Vector childs = getScrolledwindow1Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow1__ = result; - } - return __scrolledwindow1__; - } - - public Vector getScrolledwindow1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getList()); - return result; - } - - private JList __list__ = null; - public JList getList(){ - if(__list__ == null){ - JList result = new JList(new DefaultListModel()); - result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - __list__ = result; - } - return __list__; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoItemUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface InfoItemUICallback{ - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/InfoPanelable.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,55 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import javax.swing.JLabel; -import javax.swing.JList; - -/** - * InfoPanelable. - * - * Created: Mon Jun 3 18:58:09 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public interface InfoPanelable { - - public JLabel getLabel(); - public JList getList(); - public int getPosition(); - public void setPosition(int i); - - /** - * Method getSumStep indique le pas d'increment pour la somme sur - * la dimension. - * - * @return -1 indique de faire la somme sur tous les elmements. 1 - * indique de faire la somme 1 a 1 (donc de ne pas faire de - * somme), 2 indiques de faire la somme 2 a 2, ... - */ - public int getSumStep(); - -}// InfoPanelable Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,101 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.ImageObserver; + +import javax.swing.JComponent; + +/** + * TODO add comment here. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class LegendGraphic extends JComponent { + + /** serialVersionUID. */ + private static final long serialVersionUID = -4493919765232743572L; + + protected LegendModel model; + + /** + * Constructeur + */ + public LegendGraphic(LegendModel m) { + setModel(m); + } + + public void setModel(LegendModel m) { + this.model = m; + repaint(); + } + + /** + * Dessine sur le graphique la legende courante + */ + protected void redraw(Graphics g) { + //double coef = (double)getSize().width / (double)(model.getMax()-model.getMin()); + float coef = (float) getSize().width / 255f; + + int width = getSize().width; + int height = getSize().height; + + Image ImageBuffer = createImage(width, height); + Graphics tmpg = ImageBuffer.getGraphics(); + + int rgb; + for (int i = 0; i <= 255; i++) { + rgb = 255 - i; + tmpg.setColor(new Color(rgb, rgb, rgb)); + // tmpg.setColor(model.getLegendColor()); + tmpg.fillRect(Math.round((float) (i * coef)), 0, Math.round(coef), + height); + tmpg.drawRect(Math.round((float) (i * coef)), 0, Math.round(coef), + height); + } + + g.drawImage(ImageBuffer, 0, 0, getSize().width, getSize().height, + new ImageObserver() { + public boolean imageUpdate(Image img, int infoflags, int x, + int y, int width, int height) { + return true; + } + }); + } + + @Override + public void paint(Graphics g) { + redraw(g); + } + +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendGraphic.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendModel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -37,14 +37,14 @@ protected double min; protected double max; - - public LegendModel (){ - this(0,0); + + public LegendModel() { + this(0, 0); } - - public LegendModel (double min,double max){ - this.min = min; - this.max = max; + + public LegendModel(double min, double max) { + this.min = min; + this.max = max; } /** @@ -52,31 +52,31 @@ * @return value of min. */ public double getMin() { - return min; + return min; } - + /** * Set the value of min. * @param v Value to assign to min. */ - public void setMin(double v) { - this.min = v; + public void setMin(double v) { + this.min = v; } - + /** * Get the value of max. * @return value of max. */ public double getMax() { - return max; + return max; } - + /** * Set the value of max. * @param v Value to assign to max. */ - public void setMax(double v) { - this.max = v; + public void setMax(double v) { + this.max = v; } - + }// LegendModel Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/LegendPanel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin + * Copyright (C) 2002 - 2011 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,15 +25,10 @@ package fr.ifremer.isisfish.ui.result; -import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.image.ImageObserver; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; @@ -49,7 +44,7 @@ /** serialVersionUID */ private static final long serialVersionUID = -6803899655178581165L; - + private final static int DEFAULT_WIDTH = 110; private final static int DEFAULT_HEIGHT = 50; @@ -58,137 +53,77 @@ protected JLabel labelMax; protected JLabel labelMin; - - public LegendPanel (){ - this(null); + public LegendPanel() { + this(null); } - public LegendPanel(LegendModel model){ - this(model, DEFAULT_WIDTH, DEFAULT_HEIGHT); + public LegendPanel(LegendModel model) { + this(model, DEFAULT_WIDTH, DEFAULT_HEIGHT); } - public LegendPanel(LegendModel model, int width, int height){ - if(model == null) - model = new LegendModel(0,0); - this.model = model; + public LegendPanel(LegendModel model, int width, int height) { + if (model == null) { + model = new LegendModel(0, 0); + } + this.model = model; - setPreferredSize(new Dimension(width, height)); - this.setLayout(new GridBagLayout()); + setPreferredSize(new Dimension(width, height)); + this.setLayout(new GridBagLayout()); - graph = new LegendGraphic(this.model); - labelMin = new JLabel(Double.toString(model.getMin())); - labelMax = new JLabel(Double.toString(model.getMax())); - labelMin.setVisible(true); - labelMax.setVisible(true); - graph.setVisible(true); + graph = new LegendGraphic(this.model); + labelMin = new JLabel(Double.toString(model.getMin())); + labelMax = new JLabel(Double.toString(model.getMax())); + labelMin.setVisible(true); + labelMax.setVisible(true); + graph.setVisible(true); - GridBagConstraints c = null; + GridBagConstraints c = null; - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - this.add(labelMin,c); + c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + c.weightx = 0; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.HORIZONTAL; + this.add(labelMin, c); - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - this.add(graph,c); + c = new GridBagConstraints(); + c.gridx = 1; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.BOTH; + this.add(graph, c); - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - this.add(labelMax,c); + c = new GridBagConstraints(); + c.gridx = 2; + c.gridy = 0; + c.weightx = 0; + c.weighty = 1; + c.gridwidth = 1; + c.gridheight = 1; + c.fill = GridBagConstraints.HORIZONTAL; + this.add(labelMax, c); } - public LegendModel getModel(){ - return model; + public LegendModel getModel() { + return model; } - public void setModel(LegendModel model){ - this.model = model; - graph.setModel(model); - labelMin.setText(Double.toString(model.getMin())); - labelMax.setText(Double.toString(model.getMax())); + public void setModel(LegendModel model) { + this.model = model; + graph.setModel(model); + labelMin.setText(Double.toString(model.getMin())); + labelMax.setText(Double.toString(model.getMax())); } - public void setEnabled(boolean enable){ - graph.setEnabled(enable); - labelMin.setEnabled(enable); - labelMax.setEnabled(enable); + public void setEnabled(boolean enable) { + graph.setEnabled(enable); + labelMin.setEnabled(enable); + labelMax.setEnabled(enable); } }// LegendPanel - - -class LegendGraphic extends JComponent{ - - protected LegendModel model; - - /** - * Constructeur - */ - public LegendGraphic(LegendModel m){ - super(); - setModel(m); - } - - public void setModel(LegendModel m){ - this.model = m; - repaint(); - } - - /** - * Dessine sur le graphique la legende courante - */ - protected void redraw( Graphics g ){ - //double coef = (double)getSize().width / (double)(model.getMax()-model.getMin()); - float coef = (float)getSize().width / 255f; - - int width = getSize().width; - int height = getSize().height; - - Image ImageBuffer = createImage(width, height); - Graphics tmpg = ImageBuffer.getGraphics(); - - int rgb; - for (int i=0;i<=255;i++){ - rgb = 255-i; - tmpg.setColor(new Color(rgb,rgb,rgb)); - // tmpg.setColor(model.getLegendColor()); - tmpg.fillRect(Math.round((float)(i*coef)) , 0, - Math.round(coef) , height); - tmpg.drawRect(Math.round((float)(i*coef)) , 0, - Math.round(coef) , height); - } - - g.drawImage(ImageBuffer, 0, 0, getSize().width, getSize().height, - new ImageObserver(){ - public boolean imageUpdate( Image img, int infoflags, - int x, int y, - int width, int height ){ - return true; - } - }); - } - - /** - */ - public void paint( Graphics g ){ - redraw(g); - } - -} Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MapRendererUI.jaxx 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,52 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<Table> + <import> + static org.nuiton.i18n.I18n._ + </import> + <row> + <cell fill="horizontal"> + <com.bbn.openmap.gui.ToolPanel id="toolPanel" /> + </cell> + </row> + <row> + <cell fill="both" weightx="1" weighty="1"> + <fr.ifremer.isisfish.map.IsisMapBean id="isisMapBean" + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.NO_SELECTION}"/> + </cell> + </row> + <!-- <row> + <cell fill="horizontal"> + <com.bbn.openmap.InformationDelegator id="informationDelegator" + label='{_("isisfish.simpleResult.more.information")}' + map="{getIsisMapBean()}" showLights="false" /> + </cell> + </row> --> + <row> + <cell fill="horizontal"> + <LegendPanel id="legendPanel" /> + </cell> + </row> +</Table> \ No newline at end of file Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixInfoTableModel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,123 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.math.matrix.MatrixException; -import fr.ifremer.isisfish.types.Date; -import javax.swing.table.AbstractTableModel; - -/** - * MatrixInfoTableModel. - * - * Created: Fri May 31 18:31:20 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ - */ -public class MatrixInfoTableModel extends AbstractTableModel { - - /** serialVersionUID */ - private static final long serialVersionUID = 2632133167225155487L; - - protected MatrixND matrix; - - public MatrixInfoTableModel (MatrixND mat){ - if (mat.getNbDim() > 2){ - throw new MatrixException("matrice with more than 2 dimension not supported."); - } - this.matrix = mat; - } - - /** - * @return Le nombre de lignes de la table. - */ - public int getRowCount() { - if (matrix == null || matrix.getNbDim() < 1){ - return 0; - }else{ - return matrix.getDim(0); - } - } - - /** - * @return Le nombre de colonnes de la table. - */ - public int getColumnCount() { - if (matrix == null || matrix.getNbDim() < 1){ - return 0; - }else{ - return matrix.getDim(1) + 1; - } - } - - /** - * @param row La ligne - * @param column La colonnes - * @return L'Object correspondant dans la matrice. - */ - public Object getValueAt(int row, int column) { - if (column == 0){ - Object obj = matrix.getSemantics(0).get(row); - if (obj instanceof Date){ - return ((Date)obj).getMonth().toString()+" "+((Date)obj).getYear(); - }else{ - return obj.toString(); - } - } - else { - if (matrix.getNbDim() == 1){ - return ""+matrix.getValue(column-1); - }else{ // mat.getNbDim() == 2 - return ""+matrix.getValue(row, column-1); - } - } - } - -// /** -// * @param obj L'objet a inserer dans la matrice. -// * @param row La ligne -// * @param column La colonnes -// */ -// public void setValueAt(Object obj, int row, int column) { -// } -// -// /** -// * Le modele est rendu editable. -// */ -// public boolean isCellEditable(int row, int column) { -// return false; -// } - - public String getColumnName(int column){ - if (column == 0){ - return matrix.getDimensionName(0)+"\\"+matrix.getDimensionName(1); - } - else{ - return ""+matrix.getSemantics(1).get(column-1); - } - } - -}// MatrixInfoTableModel Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,108 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.awt.Component; + +import javax.swing.Icon; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixRenderer; + +import com.bbn.openmap.gui.OMToolSet; +import com.bbn.openmap.gui.Tool; + +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.map.ResultatLayer; + +/** + * Result matrix viewer map renderer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MatrixMapRenderer implements MatrixRenderer { + + protected MapRendererUI mapRendererUI; + + public MatrixMapRenderer(FisheryRegion fisheryRegion) { + mapRendererUI = new MapRendererUI(); + + // Create the directional and zoom control tool + OMToolSet resultatMapOMTS = new OMToolSet(); + // Associate the tool with the map + resultatMapOMTS.setupListeners(mapRendererUI.getIsisMapBean()); + // Add the tool to the map toolbar + mapRendererUI.getToolPanel().add((Tool)resultatMapOMTS); + + //mapRendererUI.getInformationDelegator().setMap(getIsisMapBean()); + //mapRendererUI.getInformationDelegator().setShowLights(false); + //mapRendererUI.getInformationDelegator().setLabel(_("isisfish.simpleResult.more.information")); + + // set fishery region + mapRendererUI.getIsisMapBean().setFisheryRegion(fisheryRegion); + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getComponent(org.nuiton.math.matrix.MatrixND) + */ + @Override + public Component getComponent(MatrixND matrix) { + + ResultatLayer layer = new ResultatLayer(); + layer.setMatriceInfo(matrix); + mapRendererUI.getIsisMapBean().removeAllResultatLayer(); + + mapRendererUI.getIsisMapBean().addResultatLayer(matrix.getName(), layer); + mapRendererUI.getLegendPanel().setModel(new LegendModel(0,Math.round(layer.getDataMapList().getMaxDataMapValue()))); + // poussin 20060822 FIXME: migration vers v3, je ne sais pas comment ca merchait avant, la methode n'existe pas :( + // getInformationDelegator().addLayer(layer); + + return mapRendererUI; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getIcon() + */ + @Override + public Icon getIcon() { + return null; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getName() + */ + @Override + public String getName() { + return _("isisfish.result.map"); + } + +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixMapRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,155 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +import java.awt.Component; +import java.util.Iterator; + +import javax.swing.Icon; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixRenderer; +import org.nuiton.topia.TopiaContext; + +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.simulator.SimulationParameter; +import fr.ifremer.isisfish.types.Date; + +/** + * Simulation summary renderer. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MatrixSummaryRenderer implements MatrixRenderer { + + protected static final String ABONDANCE_STRING = n_("matrixAbundance"); + protected static final String CAPTUREPARMETIER_STRING = _("matrixCatchPerStrategyMetPerZoneMet"); + protected static final String REJETPARMETIER_STRING = _("matrixDiscardsPerStrMetPerZonePop"); + + protected SimulationStorage simulationStorage; + + protected ResultStorage resultStorage; + + protected TopiaContext topiaContext; + + protected Component cachedComponent; + + public MatrixSummaryRenderer(SimulationStorage simulationStorage, ResultStorage resultStorage, TopiaContext topiaContext) { + this.resultStorage = resultStorage; + this.simulationStorage = simulationStorage; + this.topiaContext = topiaContext; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getComponent(org.nuiton.math.matrix.MatrixND) + */ + @Override + public Component getComponent(MatrixND matrix) { + if (cachedComponent == null) { + + SimulationParameter sp = simulationStorage.getParameter(); + StringBuffer resume = new StringBuffer(sp.toString()); + resume.append("\n"); + + for(Iterator<String> i = resultStorage.getResultName().iterator(); i.hasNext();) { + String name = (String)i.next(); + try { + + // TODO EC20090717 ca marche plus ca + if (name.startsWith(ABONDANCE_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(new Date(0), name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.reduce(); + resume.append(_("isisfish.result.begin.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + + mat1 = resultStorage.getMatrix(resultStorage.getLastDate(), name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.reduce(); + resume.append(_("isisfish.result.end.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + } + /* + un peu long + else if(name.startsWith(REJETPARMETIER_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.sumOverDim(2); + mat1 = mat1.sumOverDim(3); + + mat1 = mat1.reduce(); + resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + } + else if (!name.startsWith(CAPTUREPARMETIER_STRING)){ + MatrixND mat1 = resultStorage.getMatrix(name, topiaContext); + mat1 = mat1.sumOverDim(0); + mat1 = mat1.sumOverDim(1); + mat1 = mat1.sumOverDim(2); + + mat1 = mat1.reduce(); + resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); + }*/ + } catch (Exception eee) { + resume.append(_("isisfish.error.no.matrix", name)); + } + } + + resume.append("\n\n"); + resume.append(simulationStorage.getInformation().toString()); + + cachedComponent = new JScrollPane(new JTextArea(resume.toString())); + } + + return cachedComponent; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getIcon() + */ + @Override + public Icon getIcon() { + return null; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixRenderer#getName() + */ + @Override + public String getName() { + return _("isisfish.result.summary"); + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/MatrixSummaryRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEdit.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,623 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/** -* ResultatEdit2.java -* -* Created: Wed Oct 23 2002 -* -* @author <poussin at codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import javax.swing.ButtonGroup; -import javax.swing.JList; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.math.matrix.MatrixND; -import org.nuiton.topia.TopiaContext; -import org.nuiton.util.FileUtil; -import org.nuiton.util.Resource; - -import fr.ifremer.isisfish.datastore.ExportStorage; -import fr.ifremer.isisfish.datastore.ResultStorage; -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.export.Export; -import fr.ifremer.isisfish.map.ResultatLayer; -import fr.ifremer.isisfish.simulator.SimulationParameter; -import fr.ifremer.isisfish.types.Date; - -public class ResultEdit extends ResultEditUI { // ResultatEdit2 - - /** to use log facility, just put in your code: log.info("..."); */ - static private Log log = LogFactory.getLog(ResultEdit.class); - - static final String ABONDANCE_STRING = _("isisfish.result.abundance"); - static final String CAPTUREPARMETIER_STRING = _("isisfish.result.capture.metier"); - static final String REJETPARMETIER_STRING = _("isisfish.result.reject.metier"); - static final String DEBARQUEMENTPARMETIER_STRING = _("isisfish.result.unload.metier"); - static final String EFFORTPARMETIER_STRING = _("isisfish.result.stress.metier"); - static final String CAPTURE_STRING = _("isisfish.result.capture"); - - /** la simulation visualise */ - SimulationStorage simulation = null; - /** le ResultatManager de la simulation */ - ResultStorage resultManager = null; - - // Les diffrentes vu des resultats - DataResult dataBean; - SimpleResultatMapBean mapBean; - GraphBean graphBean; - ResumePanel resumeBean; - TopiaContext tx; - - /** les differents panel pour afficher les informations sur les - * dimensions des matrices des resultats */ - InfoPanelable[] infoItemTab = null; - - public ResultEdit(SimulationStorage simulation) { - setStatusOK(false); - init(); - initObjet(); - setSimulation(simulation); - setStatusOK(true); - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - if (this.tx != null) { - this.tx.closeContext(); - } - } - - private void initObjet(){ - getResultat().setEditable(false); - - mapBean = new SimpleResultatMapBean(); - graphBean = new GraphBean(); - graphBean.setModel(new GraphBeanModel()); - dataBean = new DataResult(); - resumeBean = new ResumePanel(); - - ButtonGroup group = new ButtonGroup(); - group.add(getMapRadioButton()); - group.add(getGraphRadioButton()); - group.add(getDonneeRadioButton()); - group.add(getResumeRadioButton()); - // getResumeRadioButton().setSelected(true); - - getAjoutRendu().setText(null); - getAjoutRendu().setIcon(Resource.getIcon("images/Right.gif")); - getAjoutRendu().setMargin(new Insets(0,0,0,0)); - getStatusImage().setMargin(new Insets(0,0,0,0)); - - getViewPanel().setLayout(new GridBagLayout()); - } - - void setStatusOK(boolean state) { - if (state){ - getStatusImage().setIcon(Resource.getIcon("images/BulbG.gif")); - }else{ - getStatusImage().setIcon(Resource.getIcon("images/BulbR.gif")); - } - getStatusImage().paintImmediately(0,0,25,25); - } - - /** - * Method updateInfoPanel permet de mettre a jour le - * infoItemTab. Le 0 contient les dates. - * - * @param group le group utilise pour mettre a jour le infoItemTab - * @return todo - */ - protected InfoPanelable [] createInfoPanel(MatrixND group) { - if (group == null){ - return new InfoPanelable[0]; - } - - InfoPanelable [] result = new InfoPanelable[group.getNbDim()]; - - // les dates sont toujours dans la dimension 0 - InfoItemDate infoItemDate = new InfoItemDate(); - infoItemDate.getList().setListData(group.getSemantics(0).toArray()); - result[0] = infoItemDate; - - for (int i=1; i < group.getNbDim(); i++) { - InfoItem item = new InfoItem(); - - // on affecte le nom - if (group.getDimensionName(i).equals("")){ - item.getLabel().setText(_("isisfish.result.dimension") + " " + i); - }else{ - item.getLabel().setText(_(group.getDimensionName(i))); - } - - List elems = group.getSemantics(i); - item.getList().setListData(elems.toArray()); - //?? item.setPosition(i); - result[i] = item; - } - - return result; - } - - void redrawInfoPanel(InfoPanelable[] infoItems){ - // Affichage dans le panel - getInfoPanel().removeAll(); - getInfoPanel().setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - for(int i=0; i<infoItems.length; i++){ - c.gridy = i; - getInfoPanel().add((Component)infoItems[i], c); - } - - - getScroll().invalidate(); - getScroll().validate(); - repaint(); - } - - /** - * Get the value of simulation. - * @return value of simulation. - */ - public SimulationStorage getSimulation() { - return simulation; - } - - /** - * Set the value of simulation. - * @param simulation Value to assign to simulation. - */ - public void setSimulation(SimulationStorage simulation) { - try { - this.simulation = simulation; - if (this.tx != null) { - this.tx.closeContext(); - } - this.tx = simulation.getStorage().beginTransaction(); - FisheryRegion region = SimulationStorage.getFisheryRegion(this.tx); - //FisheryRegion region = simulation.getFisheryRegion(); - - mapBean.setRegion(region); - - resultManager = simulation.getResultStorage(); - getResultat().removeAllItems(); - for(String item : resultManager.getResultName()){ - getResultat().addItem(item); - } - loadResume(simulation, resultManager); - } catch (Exception eee) { - log.warn("Can't change simulation storage", eee); - } - } - -// protected MatriceND reduire2D(MatriceND matrice){ -// int aGarder = 2; -// for (int j=0; j<matrice.getNbDim(); j++){ -// if (matrice.getDim(j) > 1 ) -// aGarder--; -// } -// -// int [] dimValid = new int[matrice.getNbDim()]; -// for (int j=0; j<matrice.getNbDim(); j++){ -// if (matrice.getDim(j) > 1 || aGarder > 0){ -// dimValid[j] = -1; -// if (matrice.getDim(j) <= 1) -// aGarder --; -// } -// else -// dimValid[j] = 0; -// } -// -//// reduction de la matrice -// return matrice.get(dimValid); -// } - - public void loadResume(SimulationStorage simulation, ResultStorage resultManager){ - SimulationParameter sp = simulation.getParameter(); - StringBuffer resume = new StringBuffer(sp.toString()); - resume.append("\n"); - - // TODO EC20090717 ca marche plus ca - // les results name ne commence plus par ABONDANCE_STRING... - for(Iterator i=resultManager.getResultName().iterator(); i.hasNext();){ - String name = (String)i.next(); - try { - - if (name.startsWith(ABONDANCE_STRING)){ - MatrixND mat1 = resultManager.getMatrix(new Date(0), name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.reduce(); - resume.append(_("isisfish.result.begin.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - - mat1 = resultManager.getMatrix(resultManager.getLastDate(), name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.reduce(); - resume.append(_("isisfish.result.end.simulation")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - else if(name.startsWith(REJETPARMETIER_STRING)){ - MatrixND mat1 = resultManager.getMatrix(name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.sumOverDim(2); - mat1 = mat1.sumOverDim(3); - - mat1 = mat1.reduce(); - resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - else if (!name.startsWith(CAPTUREPARMETIER_STRING) && name.startsWith(CAPTURE_STRING)){ - MatrixND mat1 = resultManager.getMatrix(name, tx); - mat1 = mat1.sumOverDim(0); - mat1 = mat1.sumOverDim(1); - mat1 = mat1.sumOverDim(2); - - mat1 = mat1.reduce(); - resume.append(_("isisfish.common.sum")).append(mat1.getName()).append(": ").append(mat1.getValue(0)).append("\n"); - } - } catch (Exception eee) { - resume.append(_("isisfish.error.no.matrix", name)); - } - } - - resume.append("\n\n"); - resume.append(simulation.getInformation().toString()); - - resumeBean.setResume(resume.toString()); - getResumeRadioButton().setSelected(true); - } - -// /** -// * Method groupResult permet de grouper les resultats par nom. -// * -// * @param simulation la simulation dont il faut grouper les resultats -// * @return une hash de ResultatGroup -// */ -// HashMap groupResult(Simulation simulation){ -// HashMap result = new HashMap(); -// -// LinkedList resultats = Resultat.xmlToVector(simulation.getResultat()); -// for (Iterator it = resultats.iterator(); it.hasNext();) { -// Resultat resultat = (Resultat)it.next(); -// String name = resultat.getName(); -// -//// stockage des resultats par type -// ResultatGroup group = (ResultatGroup)result.get(name); -// if (group == null) { -//// group = new ResultatGroup(dbSimulation); -// group = new ResultatGroup(dbManager); -// result.put(name, group); -// } -// group.add(resultat); -// } -// -// return result; -// } - - /** - * Method reduction permet de reduire la matrice en fonction des - * selections de l'utilisateur dans l'interface. - * - * @param matrix todo - * - * @param infoItems todo - * @return todo - */ - protected MatrixND createAndReduce(MatrixND matrix, InfoPanelable [] infoItems){ - - // Reduit la matrice en fonction des choix de l utilisateur - // dans les autres InfoItem recuperation des autres elements - // selectionnees. - for (int i = 0; i < infoItems.length; i++) { - InfoPanelable item = infoItems[i]; - JList list = item.getList(); - int [] indList = list.getSelectedIndices(); - - if (indList.length == 0){ - // si rien n'est selectionné on selection tout - list.setSelectionInterval(0, - list.getModel().getSize()-1); - indList = list.getSelectedIndices(); - } - - log.debug("matrice avant submatrice de la dim "+i+" :"+matrix); - - if (0 < indList.length && indList.length < matrix.getDim(i)){ - matrix = matrix.getSubMatrix(i, indList); - } - - log.debug("matrice apres submatrice de la dim "+i+" :"+matrix); - - if (item.getSumStep() != 1) { - // on somme - matrix = matrix.sumOverDim(i, item.getSumStep()); - if(matrix.getDim(i) == 1){ - // c une somme global sur tous les elements - matrix.setDimensionName(i, _("isisfish.common.sum")); - }else{ - // c une somme partielle - String name = matrix.getDimensionName(i)+" "+ - _("isisfish.common.sum"); - - //si c une somme pour les annees, on change l'intitule - if (item instanceof InfoItemDate){ - name = _("isisfish.common.year"); - } - - matrix.setDimensionName(i, name); - } - - // #1905 : modifie les semantiques de type Date pour que lorsque - // c'est par exemple une somme par année - // les semantique se nomment - // janvier 0, janvier 1... - // plutot que - // janvier 0, fevrier 0... - Object sem = matrix.getSemantics(i); - if (sem instanceof List) { - List<Object> semList = (List<Object>)sem; - List<Object> newList = new ArrayList<Object>(); - for (int index = 0 ; index < semList.size(); ++index) { - Object semObject = semList.get(index); - if (semObject instanceof Date) { - Date semDate = (Date)semObject; - Date newDate = new Date(semDate.getDate() * item.getSumStep()); - newList.add(newDate); - } - else { - newList.add(semObject); - } - } - matrix.setSemantics(i, newList); - } - // end semantics modification - } - log.debug("matrice apres sum de la dim "+i+" :"+matrix); - } - - log.debug("Matrice avant le reduce: " + matrix); - - // arrive ici on a une matrice qui a des tailles de dimension 1 - // et un tableau des legende pour chaque dimension - - // il faut que la matrice est 2 dimensions - // reduction de la matrice - MatrixND result = matrix.reduce(2); - - return result; - } - - public void addRendu(MatrixND matrix, InfoPanelable [] infoItems){ - setStatusOK(false); - - log.debug("La matrice avant réduction est: " + matrix); - - // recuperation de la matriceInfo - MatrixND matInfo = createAndReduce(matrix, infoItems); - - log.debug("La matrice après réduction est: " + matInfo); - - if (matInfo.getNbDim() > 2) { - // matrice superieur a 2 dimensions non geree!! - JOptionPane.showMessageDialog(null, _("isisfish.error.matrix.more.2d"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - return; - } - - // ajout a la carte - // On ajoute a la carte que si on le peut - if (matInfo.getNbDim() == 2){ - try{ - ResultatLayer layer = new ResultatLayer(); - layer.setMatriceInfo(matInfo); - mapBean.removeAllResultatLayer(); - mapBean.addResultatLayer(matInfo.getName(), layer); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat à la carte. ", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.card"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - } - - // ajout au graph - try{ - graphBean.getModel().setMatrix(matInfo); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat au graph.", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.result.graph"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - - // ajout au data - try{ - dataBean.setMatrix(matInfo); - }catch(Exception eee){ - log.warn("Erreur lors de l'ajout du résultat au data.", eee); - JOptionPane.showMessageDialog(null, _("isisfish.error.add.result.data"), _("isisfish.common.alert"), JOptionPane.ERROR_MESSAGE); - } - - setStatusOK(true); - } - - public void on_ajoutRendu_clicked(){ - String resultName = (String)getResultat().getSelectedItem(); - if (resultName != null) { - // si on etait sur le resume on se met automatiquement sur le graph - if (getViewPanel().getComponentCount() == 1 && - getViewPanel().getComponent(0) == resumeBean){ - graphBean.getGraphSplitPane().setDividerLocation(1.0); - getGraphRadioButton().setSelected(true); - } - // on ajoute de rendu - addRendu(resultManager.getMatrix(resultName, tx), infoItemTab); - } - } - - public void on_resultat_selection_notify_event(ItemEvent e){ - if(e.getStateChange() == ItemEvent.SELECTED){ - String resultName = (String)e.getItem(); - MatrixND matrix = resultManager.getMatrix(resultName, tx); - infoItemTab = createInfoPanel(matrix); - redrawInfoPanel(infoItemTab); - } - } - - public void on_graphRadioButton_toggled(ChangeEvent e){ - if (getGraphRadioButton().isSelected()){ - graphBean.getGraphSplitPane().setDividerLocation(1.0); - setViewBean(graphBean); - } - } - - public void on_mapRadioButton_toggled(ChangeEvent e){ - if (getMapRadioButton().isSelected()) - setViewBean(mapBean); - } - - public void on_donneeRadioButton_toggled(ChangeEvent e){ - if (getDonneeRadioButton().isSelected()) - setViewBean(dataBean); - } - - public void on_resumeRadioButton_toggled(ChangeEvent e){ - if (getResumeRadioButton().isSelected()) - setViewBean(resumeBean); - } - - /** - * Method setViewBean modifie le bean visible. - * - * @param bean le bean qui doit devenir visible - */ - public void setViewBean(JPanel bean){ - setStatusOK(false); - - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - - getViewPanel().removeAll(); - getViewPanel().add(bean,c); - getViewPanel().invalidate(); - getViewPanel().validate(); - getViewPanel().repaint(); - graphBean.getGraphSplitPane().setDividerLocation(1.0); - setStatusOK(true); - } - - ////////////////////////////////////////////////////////////////////// - /// Menu Export /// - ////////////////////////////////////////////////////////////////////// - - - /** - * Surcharge de la method getMenuExport_menuChilds pour ajouter - * les methods que l'on trouve dans les scripts de l'objet Export. - */ - public Vector getMenuExport_menuChilds(){ - Vector<JMenuItem> result = new Vector<JMenuItem>(); - for (String name : ExportStorage.getExportNames()) { - JMenuItem item = getExportMenu(name); - result.add(item); - } - return result; - } - - /** - * Retourne l'item de menu qui permet l'appelle de la method du code - * ECMAScript d'export. - * @param methodName todo - * @return todo - */ - protected JMenuItem getExportMenu(String methodName){ - JMenuItem result = new JMenuItem(_(methodName)); - result.addActionListener(new ExportActionListener(methodName)); - return result; - } - - - protected class ExportActionListener implements ActionListener{ - private String name; - public ExportActionListener(String name){ - this.name = name; - } - public void actionPerformed(ActionEvent e){ - try{ - File file = FileUtil.getFile(".+.txt", _("isisfish.result.export.file")); - if(file != null){ - Writer out = new BufferedWriter(new FileWriter(file)); - ExportStorage storage = ExportStorage.getExport(name); - Export export = storage.getNewExportInstance(); - export.export(simulation, out); - out.close(); - } - }catch(Exception eee){ - log.warn("Erreur lors de l'export ", eee); - } - } - } - -} // ResultatEdit2 Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,696 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JInternalFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSplitPane; -import javax.swing.JViewport; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -public abstract class ResultEditUI extends JInternalFrame implements ResultEditUICallback{ - - public ResultEditUI(){ - super(_("isisfish.result.title")); - } - - protected void init(){ - ResultEditUI result = this; - this.getContentPane().setLayout(new BorderLayout()); - Vector childs = getResultatEditChilds(); - if(childs.size() >= 1) - result.getContentPane().add((Component)childs.get(0), - BorderLayout.CENTER); - - this.setJMenuBar(getMenubar2()); - this.pack(); - - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getResultatEditChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getVbox2()); - return result; - } - - private Box __vbox2__ = null; - public Box getVbox2(){ - if(__vbox2__ == null){ - Vector childs = getVbox2Childs(); - Box result = Box.createVerticalBox(); - for (Object child : childs) result.add((Component) child); - - __vbox2__ = result; - } - return __vbox2__; - } - - public Vector getVbox2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable23()); - return result; - } - - private JMenuBar __menubar2__ = null; - public JMenuBar getMenubar2(){ - if(__menubar2__ == null){ - Vector childs = getMenubar2Childs(); - JMenuBar result = new JMenuBar(); - for (Object child : childs) result.add((JMenuItem) child); - - __menubar2__ = result; - } - return __menubar2__; - } - - public Vector getMenubar2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMenuExport()); - return result; - } - - private JMenu __menuExport__ = null; - public JMenu getMenuExport(){ - if(__menuExport__ == null){ - Vector childs = getMenuExport_menuChilds(); - JMenu result = new JMenu(_("isisfish.result.export")); - for (Object child : childs) result.add((Component) child); - - __menuExport__ = result; - } - return __menuExport__; - } - - public Vector getMenuExport_menuChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getMenuitem6()); - return result; - } - - private JSeparator __menuitem6__ = null; - public JSeparator getMenuitem6(){ - if(__menuitem6__ == null){ - JSeparator result = new JSeparator(); - - __menuitem6__ = result; - } - return __menuitem6__; - } - - private JPanel __table23__ = null; - public JPanel getTable23(){ - if(__table23__ == null){ - Vector childs = getTable23Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table23__ = result; - } - return __table23__; - } - - public Vector getTable23Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable22()); - result.add(getHpaned2()); - return result; - } - - private JPanel __table22__ = null; - public JPanel getTable22(){ - if(__table22__ == null){ - Vector childs = getTable22Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table22__ = result; - } - return __table22__; - } - - public Vector getTable22Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getStatusImage()); - result.add(getStatusbar1()); - return result; - } - - private JButton __statusImage__ = null; - public JButton getStatusImage(){ - if(__statusImage__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.blank"), icon); - - __statusImage__ = result; - } - return __statusImage__; - } - - private JLabel __statusbar1__ = null; - public JLabel getStatusbar1(){ - if(__statusbar1__ == null){ - JLabel result = new JLabel(_("isisfish.result.statusBar")); - - __statusbar1__ = result; - } - return __statusbar1__; - } - - private JSplitPane __hpaned2__ = null; - public JSplitPane getHpaned2(){ - if(__hpaned2__ == null){ - Vector childs = getHpaned2Childs(); - Component child1 = null; - Component child2 = null; - if(childs.size() >= 1) - child1 = (Component)childs.get(0); - if(childs.size() >= 2) - child2 = (Component)childs.get(1); - - JSplitPane result = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - child1, child2); - result.setOneTouchExpandable(true); - result.setDividerSize(10); - - __hpaned2__ = result; - } - return __hpaned2__; - } - - public Vector getHpaned2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable1()); - result.add(getTable25()); - return result; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable7()); - result.add(getResultat()); - return result; - } - - private JPanel __table7__ = null; - public JPanel getTable7(){ - if(__table7__ == null){ - Vector childs = getTable7Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table7__ = result; - } - return __table7__; - } - - public Vector getTable7Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable8()); - result.add(getScroll()); - return result; - } - - private JPanel __table8__ = null; - public JPanel getTable8(){ - if(__table8__ == null){ - Vector childs = getTable8Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table8__ = result; - } - return __table8__; - } - - public Vector getTable8Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getAjoutRendu()); - return result; - } - - private JButton __ajoutRendu__ = null; - public JButton getAjoutRendu(){ - if(__ajoutRendu__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.common.add.short"), icon); - result.setToolTipText(_("isisfish.result.add")); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_ajoutRendu_clicked(); - } - }); - - __ajoutRendu__ = result; - } - return __ajoutRendu__; - } - - private JScrollPane __scroll__ = null; - public JScrollPane getScroll(){ - if(__scroll__ == null){ - Vector childs = getScrollChilds(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scroll__ = result; - } - return __scroll__; - } - - public Vector getScrollChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getInfoPanel()); - return result; - } - - private JPanel __infoPanel__ = null; - public JPanel getInfoPanel(){ - if(__infoPanel__ == null){ - Vector childs = getInfoPanelChilds(); - GridBagConstraints [] cs; - cs = new GridBagConstraints[childs.size()]; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __infoPanel__ = result; - } - return __infoPanel__; - } - - public Vector getInfoPanelChilds(){ - Vector<Object> result; - result = new Vector<Object>(); - return result; - } - - private JComboBox __resultat__ = null; - public JComboBox getResultat(){ - if(__resultat__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_resultat_selection_notify_event(e); - } - }); - - __resultat__ = result; - } - return __resultat__; - } - - private JPanel __table25__ = null; - public JPanel getTable25(){ - if(__table25__ == null){ - Vector childs = getTable25Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table25__ = result; - } - return __table25__; - } - - public Vector getTable25Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getViewPanel()); - result.add(getTable26()); - return result; - } - - private javax.swing.JPanel __viewPanel__ = null; - public javax.swing.JPanel getViewPanel(){ - if(__viewPanel__ == null){ - javax.swing.JPanel result = new javax.swing.JPanel(); - - __viewPanel__ = result; - } - return __viewPanel__; - } - - private JPanel __table26__ = null; - public JPanel getTable26(){ - if(__table26__ == null){ - Vector childs = getTable26Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 3; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[3] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table26__ = result; - } - return __table26__; - } - - public Vector getTable26Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getGraphRadioButton()); - result.add(getMapRadioButton()); - result.add(getDonneeRadioButton()); - result.add(getResumeRadioButton()); - return result; - } - - private JRadioButton __graphRadioButton__ = null; - public JRadioButton getGraphRadioButton(){ - if(__graphRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.graph"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_graphRadioButton_toggled(e); - } - }); - - __graphRadioButton__ = result; - } - return __graphRadioButton__; - } - - private JRadioButton __mapRadioButton__ = null; - public JRadioButton getMapRadioButton(){ - if(__mapRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.map"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_mapRadioButton_toggled(e); - } - }); - - __mapRadioButton__ = result; - } - return __mapRadioButton__; - } - - private JRadioButton __donneeRadioButton__ = null; - public JRadioButton getDonneeRadioButton(){ - if(__donneeRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.datas"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_donneeRadioButton_toggled(e); - } - }); - - __donneeRadioButton__ = result; - } - return __donneeRadioButton__; - } - - private JRadioButton __resumeRadioButton__ = null; - public JRadioButton getResumeRadioButton(){ - if(__resumeRadioButton__ == null){ - JRadioButton result = new JRadioButton(_("isisfish.result.summary"), false); - result.addChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - on_resumeRadioButton_toggled(e); - } - }); - - __resumeRadioButton__ = result; - } - return __resumeRadioButton__; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultEditUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,48 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -/** - * ResultEditUICallback - * - * Generated: Thu Jul 27 22:04:42 CEST 2006 - * By GGen Copyright Code Lutin - * http://www.codelutin.com - * - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -import javax.swing.event.ChangeEvent; - -public interface ResultEditUICallback{ - - public void on_ajoutRendu_clicked(); - public void on_resultat_selection_notify_event(ItemEvent e); - public void on_graphRadioButton_toggled(ChangeEvent e); - public void on_mapRadioButton_toggled(ChangeEvent e); - public void on_donneeRadioButton_toggled(ChangeEvent e); - public void on_resumeRadioButton_toggled(ChangeEvent e); -} Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,266 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.beans.PropertyVetoException; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.Writer; + +import javax.swing.JMenuItem; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixViewerPanel; +import org.nuiton.math.matrix.viewer.renderer.MatrixChartRenderer; +import org.nuiton.math.matrix.viewer.renderer.MatrixInfoTableRenderer; +import org.nuiton.topia.TopiaException; +import org.nuiton.util.FileUtil; + +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.datastore.ExportStorage; +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.datastore.StorageException; +import fr.ifremer.isisfish.entities.FisheryRegion; +import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.logging.SimulationLoggerUtil; +import fr.ifremer.isisfish.simulator.launcher.SimulationJob; +import fr.ifremer.isisfish.simulator.launcher.SimulationService; +import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; +import fr.ifremer.isisfish.ui.CommonHandler; +import fr.ifremer.isisfish.ui.models.common.StringListModel; + +/** + * Handler for result UIs. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ResultHandler extends CommonHandler { + + private static Log log = LogFactory.getLog(ResultHandler.class); + + protected SimulationServiceListener listener = null; + + /** + * Initialise la vue avec les liste des simulations disponible. + * + * @param resultUI + */ + public void init(final ResultUI resultUI) { + initSimulationList(resultUI); + + // reference must stay allocated + listener = new SimulationServiceListener() { + @Override + public void simulationStart(SimulationService simService, SimulationJob job) { + } + @Override + public void simulationStop(SimulationService simService, SimulationJob job) { + initSimulationList(resultUI); + } + @Override + public void clearJobDone(SimulationService simService) { + } + }; + SimulationService.getService().addSimulationServiceListener(listener); + } + + /** + * Reload simulation combo box model. + * + * @param resultUI resultUI + */ + protected void initSimulationList(ResultUI resultUI) { + java.util.List<String> value = SimulationStorage.getSimulationNames(); + + resultUI.getSimulationComboBox().setEditable(false); + StringListModel model = new StringListModel(value); + resultUI.getSimulationComboBox().setModel(model); + resultUI.getSimulationComboBox().setSelectedItem(null); + } + + /** + * Open selected simulation item in new internal frame. + * + * @param resultUI resultUI + */ + public void openNewSimulation(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + SimulationStorage simulation = SimulationStorage.getSimulation(selected); + + ResultSimulationFrame internalFrame = new ResultSimulationFrame(resultUI); + internalFrame.setTitle(simulation.getName()); + internalFrame.setSimulationStorage(simulation); + init(internalFrame); + internalFrame.setSize(800, 600); + resultUI.getSimulationDesktopPane().add(internalFrame); + try { + internalFrame.setSelected(true); + } catch (PropertyVetoException ex) { + if (log.isWarnEnabled()) { + log.warn("Can't auto selected internal frame", ex); + } + } + } + + /** + * Delete selected simulation. + * + * @param resultUI resultUI + */ + public void deleteSimulation(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + SimulationStorage simulation = SimulationStorage.getSimulation(selected); + try { + simulation.delete(false); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't delete simulation", ex); + } + initSimulationList(resultUI); + } + + /** + * Display simulation log. + * + * @param resultUI resultUI + */ + public void showLog(ResultUI resultUI) { + String selected = (String)resultUI.getSimulationComboBox().getSelectedItem(); + try { + SimulationLoggerUtil.showSimulationLogConsole(selected); + } catch (Exception ex) { + throw new IsisFishRuntimeException("Can't display simulation log", ex); + } + } + + /** + * Init ResultSimulationFrame. + * + * @param resultSimulationFrame resultSimulationFrame + */ + public void init(final ResultSimulationFrame resultSimulationFrame) { + SimulationStorage simulation = resultSimulationFrame.getSimulationStorage(); + try { + // init menu + for (String exportName : ExportStorage.getExportNames()) { + JMenuItem item = new JMenuItem(_(exportName)); + item.addActionListener(new ExportActionListener(simulation, exportName)); + resultSimulationFrame.getExportMenu().add(item); + } + + resultSimulationFrame.topiaContext = simulation.getStorage().beginTransaction(); + final ResultStorage resultStorage = simulation.getResultStorage(); + FisheryRegion fisheryRegion = SimulationStorage.getFisheryRegion(resultSimulationFrame.topiaContext); + + // init viewer panel + final MatrixViewerPanel matrixViewerPanel = new MatrixViewerPanel(); + matrixViewerPanel.addMatrixDimentionAction(new YearSumDimensionAction()); + matrixViewerPanel.addMatrixRenderer(new MatrixSummaryRenderer(simulation, resultStorage, resultSimulationFrame.topiaContext), true); + matrixViewerPanel.addMatrixRenderer(new MatrixChartRenderer()); + matrixViewerPanel.addMatrixRenderer(new MatrixMapRenderer(fisheryRegion)); + matrixViewerPanel.addMatrixRenderer(new MatrixInfoTableRenderer()); + matrixViewerPanel.addMatrixFilter(new ResultMatrixFilter(resultStorage)); + + // init available results list + StringListModel model = new StringListModel(resultStorage.getResultName()); + resultSimulationFrame.getResultsComboBox().setModel(model); + resultSimulationFrame.getResultsComboBox().addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + String selectedMatrixName = (String)e.getItem(); + MatrixND matrix = resultStorage.getMatrix(selectedMatrixName, resultSimulationFrame.topiaContext); + matrixViewerPanel.setMatrix(matrix); + } + } + }); + if (model.getSize() > 0) { + model.setSelectedItem(model.getElementAt(0)); + } + + // force summary display + matrixViewerPanel.updateSelectedRenderingComponent(); + resultSimulationFrame.getMatrixViewerContainer().add(matrixViewerPanel, BorderLayout.CENTER); + } catch (TopiaException ex) { + throw new IsisFishRuntimeException("Can't open simulation", ex); + } catch (StorageException ex) { + throw new IsisFishRuntimeException("Can't open simulation", ex); + } + } + + protected class ExportActionListener implements ActionListener { + + protected SimulationStorage simulationStorage; + + protected String exportName; + + public ExportActionListener(SimulationStorage simulationStorage, String exportName) { + this.simulationStorage = simulationStorage; + this.exportName = exportName; + } + + public void actionPerformed(ActionEvent e) { + try { + File file = FileUtil.getFile(".+\\.csv", _("isisfish.result.export.file")); + // add csv extension if not set + if (!file.getName().endsWith(".csv")) { + file = new File(file.getAbsolutePath() + ".csv"); + } + if (file != null) { + Writer out = null; + try { + out = new BufferedWriter(new FileWriter(file)); + ExportStorage storage = ExportStorage.getExport(exportName); + Export export = storage.getNewExportInstance(); + export.export(simulationStorage, out); + } + finally { + IOUtils.closeQuietly(out); + } + } + } catch(Exception eee) { + if (log.isWarnEnabled()) { + log.warn("Erreur lors de l'export ", eee); + } + } + } + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,100 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import static org.nuiton.i18n.I18n._; + +import java.util.ArrayList; +import java.util.List; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.math.matrix.viewer.MatrixFilter; + +import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.types.Date; + +/** + * Filtre qui ajoute les trou dans les données (valeur intermédiares absentes) + * et qui supprime les bornes sans valeures ensuite. + * + * Modifie egalement le titre de la matrice. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ResultMatrixFilter implements MatrixFilter { + + protected ResultStorage resultStorage; + + public ResultMatrixFilter(ResultStorage resultStorage) { + this.resultStorage = resultStorage; + } + + @Override + public MatrixND filter(MatrixND matrix) { + return matrix; + } + + /* + * @see org.nuiton.math.matrix.viewer.MatrixFilter#filterDimension(org.nuiton.math.matrix.MatrixND, int, int) + */ + @Override + public MatrixND filterDimension(MatrixND matrix, int dim, int sumStep) { + + if (dim == 0 && sumStep == 12) { + // si c une somme pour les annees, on change l'intitule + matrix.setDimensionName(0, _("isisfish.common.year")); + } + + // #1905 : modifie les semantiques de type Date pour que lorsque + // c'est par exemple une somme par année + // les semantique se nomment + // janvier 0, janvier 1... + // plutot que + // janvier 0, fevrier 0... + if (dim == 0) { + List sem = matrix.getSemantic(dim); + List<Object> semList = (List<Object>)sem; + List<Object> newList = new ArrayList<Object>(); + for (int index = 0 ; index < semList.size(); ++index) { + Object semObject = semList.get(index); + if (semObject instanceof Date) { + Date semDate = (Date)semObject; + Date newDate = new Date(semDate.getDate() * sumStep); + newList.add(newDate); + } + else { + newList.add(semObject); + } + } + matrix.setSemantic(dim, newList); + } + // end semantics modification */ + + return matrix; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultMatrixFilter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultSimulationFrame.jaxx 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,58 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JInternalFrame resizable="true" iconifiable="true" maximizable="true" closable="true"> + + <script><![CDATA[ + @Override + protected void finalize() throws Throwable { + super.finalize(); + if (topiaContext != null) { + topiaContext.closeContext(); + } + } + ]]></script> + + <ResultHandler id="handler"/> + + <fr.ifremer.isisfish.datastore.SimulationStorage id="simulationStorage" javaBean="null"/> + <fr.ifremer.isisfish.entities.FisheryRegion id="fisheryRegion" javaBean="null"/> + <org.nuiton.topia.TopiaContext id="topiaContext" javaBean="null"/> + + <JMenuBar> + <JMenu id="exportMenu" text="isisfish.result.export" /> + </JMenuBar> + + <Table> + <row> + <cell><JLabel text="isisfish.result.selectResult" /></cell> + <cell fill="horizontal" weightx="1"><JComboBox id="resultsComboBox" /></cell> + </row> + <row> + <cell fill="both" weightx="1" weighty="1" columns="2"> + <JPanel id="matrixViewerContainer" layout="{new BorderLayout()}"/> + </cell> + </row> + </Table> +</JInternalFrame> \ No newline at end of file Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultUI.jaxx 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,62 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<JPanel layout='{new BorderLayout()}'> + + <ResultHandler id="handler" /> + + <script><![CDATA[ + protected void $afterCompleteSetup() { + getHandler().init(this); + } + ]]></script> + <Table constraints="BorderLayout.NORTH"> + <row> + <cell> + <JLabel text="isisfish.result.choose.simulation"/> + </cell> + <cell fill="horizontal" weightx="1"> + <JComboBox id="simulationComboBox"/> + </cell> + <cell> + <JButton text="isisfish.result.new.window" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().openNewSimulation(this)"/> + </cell> + <cell> + <JButton text="isisfish.result.remove.simulation" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().deleteSimulation(this)"/> + </cell> + <cell> + <JButton text="isisfish.result.show.simulation.log" + enabled="{getSimulationComboBox().getSelectedItem() != null}" + onActionPerformed="getHandler().showLog(this)"/> + </cell> + </row> + </Table> + + <JDesktopPane id="simulationDesktopPane" constraints="BorderLayout.CENTER" /> + +</JPanel> \ No newline at end of file Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,223 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Dimension; -import java.awt.event.ItemEvent; -import java.beans.PropertyVetoException; -import java.io.IOException; -import java.text.ParseException; -import java.util.List; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JInternalFrame; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.logging.SimulationLoggerUtil; -import fr.ifremer.isisfish.simulator.SimulationProperties; -import fr.ifremer.isisfish.simulator.launcher.SimulationJob; -import fr.ifremer.isisfish.simulator.launcher.SimulationService; -import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener; -import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; -import fr.ifremer.isisfish.ui.util.ErrorHelper; -import fr.ifremer.isisfish.ui.widget.filter.FilterModel; - -/** - * ResultView.java - * - * Created: Thu May 30 15:48:00 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version - */ -public class ResultView extends ResultViewUI { - - /** to use log facility, just put in your code: log.info("..."); */ - static private Log log = LogFactory.getLog(ResultView.class); - private FilterModel<SimulationProperties, String> filterModel; - private DefaultComboBoxModel model; - - /* - * FIXME this code reload ALL simulation (too long) - */ - SimulationServiceListener listener = new SimulationServiceListener() { - - @Override - public void simulationStart(SimulationService simService, SimulationJob job) { - } - - @Override - public void simulationStop(SimulationService simService, SimulationJob job) { - try { - initSimulation(); - } catch (IOException ex) { - log.error(ex); - } catch (ParseException ex) { - log.error(ex); - } - } - - @Override - public void clearJobDone(SimulationService simService) { - } - }; - - public ResultView (){ - super(); - SimulationService.getService().addSimulationServiceListener(listener); - init(); - try { - initSimulation(); - } catch (Exception e) { - if (log.isWarnEnabled()) { - log.warn(_("could not create simulation filter model for reason %1$s", e.getMessage()),e); - } - ErrorHelper.showErrorDialog(_("could not create simulation filter model for reason %1$s", e.getMessage()), e); - } - } - - private void initSimulation() throws IOException, ParseException { - // keep in context list of old simulation names (for filter process) - java.util.List<String> value = SimulationStorage.getSimulationNames(); - - // TODO filering disabled since it's read all simulation - // TODO can take more than 20m with a lot of simulations... - - // create filter model - //filterModel = SimulationFilterUtil.createFilterModel(value); - // to used directly model.getFilteredResult() in xml - // we must fill filterModel result with original items - //filterModel.selectAll(); - - getSimulation().setEditable(false); - model = new DefaultComboBoxModel(value.toArray()); - getSimulation().setModel(model); - getSimulation().setSelectedItem(null); - } - - public void on_Resultat_destroy_event(){ -// dispose(); - } - - public void on_simulation_selection_notify_event(ItemEvent e){ - // setSelectedSimulation((Simulation)getSimulation().getSelectedItem()); - } - - /* - * Get the value of selectedSimulation. - * @return value of selectedSimulation. - * - public Simulation getSelectedSimulation() { - return selectedSimulation; - }*/ - - /* - * Set the value of selectedSimulation. - * @param v Value to assign to selectedSimulation. - * - public void setSelectedSimulation(Simulation v) { - this.selectedSimulation = v; - }*/ - - public void on_supprimerSimulationButton_clicked(){ - String name = (String)getSimulation().getSelectedItem(); - if (name != null){ - SimulationStorage storage = SimulationStorage.getSimulation(name); - try { - storage.delete(false); - initSimulation(); - } catch (Exception eee) { - if (log.isWarnEnabled()) { - log.warn("Can't delete simulation", eee); - } - ErrorHelper.showErrorDialog(_("Can't delete simulation"), eee); - } - } - } - - public void on_openWindowButton_clicked(){ - String name = (String)getSimulation().getSelectedItem(); - if (name != null){ - SimulationStorage simulation = SimulationStorage.getSimulation(name); - - ResultEdit resEdit = new ResultEdit(simulation); - JInternalFrame intFrame = - new JInternalFrame(simulation.getName(), - true, //resizable - true, //closable - true, //maximizable - true);//iconifiable - intFrame.setContentPane(resEdit.getRootPane()); - intFrame.setVisible(true); - // intFrame.pack(); - intFrame.setSize(new Dimension(800,700)); - getDesktopPane().add(intFrame); - try { - intFrame.setSelected(true); - } catch (PropertyVetoException eee) { - if (log.isWarnEnabled()) { - log.warn("Error dans l internalFrame ", eee); - } - ErrorHelper.showErrorDialog(_("Can't open simulation internal frame"), eee); - } - } - } - - public void on_voirSimulationLogButton_clicked() { - String name = (String)getSimulation().getSelectedItem(); - - try { - SimulationLoggerUtil.showSimulationLogConsole(name); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error(_("Can't display simulation log"), e); - } - ErrorHelper.showErrorDialog(_("Can't display simulation log"), e); - } - } - public void on_filterSimulationLogButton_clicked() { - - try { - List<String> result = SimulationFilterUtil.filterSimulation(filterModel); - - model.removeAllElements(); - for (String s : result) { - model.addElement(s); - } - } catch (Exception e) { - if (log.isWarnEnabled()) { - log.warn(_("could not filter on simulations"), e); - } - ErrorHelper.showErrorDialog(_("could not filter on simulations"), e); - } - } - -}// ResultView Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,408 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; - -public abstract class ResultViewUI extends JPanel implements ResultViewUICallback{ - - public ResultViewUI(){ -// super(_("isisfish.result.title")); - } - - protected void init(){ - ResultViewUI result = this; -// this.getContentPane().setLayout(new BorderLayout()); - this.setLayout(new BorderLayout()); - Vector childs = getResultatViewChilds(); - if(childs.size() >= 1) -// result.getContentPane().add((Component)childs.get(0), BorderLayout.CENTER); - result.add((Component)childs.get(0), BorderLayout.CENTER); - -// TODO : MENUS - -// this.add(getMenubar1()); -// result.addWindowListener(new WindowAdapter(){ -// public void windowClosing(WindowEvent e){ -// on_Resultat_destroy_event(); -// } -// }); - - result.setBounds(10,10,640,480); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b todo - * @param groupName todo - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector<JComponent> getResultatViewChilds(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getVbox1()); - return result; - } - - private Box __vbox1__ = null; - public Box getVbox1(){ - if(__vbox1__ == null){ - Vector childs = getVbox1Childs(); - Box result = Box.createVerticalBox(); - for (Object child : childs) { - result.add((Component) child); - } - - __vbox1__ = result; - } - return __vbox1__; - } - - public Vector<JComponent> getVbox1Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getTable33()); - return result; - } - - private JMenuBar __menubar1__ = null; - public JMenuBar getMenubar1(){ - if(__menubar1__ == null){ - Vector childs = getMenubar1Childs(); - JMenuBar result = new JMenuBar(); - for (Object child : childs) { - result.add((JMenuItem) child); - } - - __menubar1__ = result; - } - return __menubar1__; - } - - public Vector<JComponent> getMenubar1Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getMenuitem1()); - return result; - } - - private JMenu __menuitem1__ = null; - public JMenu getMenuitem1(){ - if(__menuitem1__ == null){ - Vector childs = getMenuitem1_menuChilds(); - JMenu result = new JMenu(_("isisfish.result.file")); - for (Object child : childs) { - result.add((Component) child); - } - - __menuitem1__ = result; - } - return __menuitem1__; - } - - public Vector<JComponent> getMenuitem1_menuChilds(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getMenuitem2()); - return result; - } - - private JMenuItem __menuitem2__ = null; - public JMenuItem getMenuitem2(){ - if(__menuitem2__ == null){ - ImageIcon icon = null; - - JMenuItem result = new JMenuItem(_("isisfish.result.quit"), icon); - - result.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent e){ - on_Resultat_destroy_event(); - } - }); - - __menuitem2__ = result; - } - return __menuitem2__; - } - - private JPanel __table33__ = null; - public JPanel getTable33(){ - if(__table33__ == null){ - Vector<JComponent> childs = getTable33Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 10; - c.gridwidth = 6; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.HORIZONTAL; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[3] = c; - - c = new GridBagConstraints(); - c.gridx = 3; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[4] = c; - - c = new GridBagConstraints(); - c.gridx = 4; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[5] = c; - - c = new GridBagConstraints(); - c.gridx = 5; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.NONE; - cs[6] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) { - result.add(childs.get(i), cs[i]); - } - - __table33__ = result; - } - return __table33__; - } - - public Vector<JComponent> getTable33Childs(){ - Vector<JComponent> result = new Vector<JComponent>(); - result.add(getLabel9()); - result.add(getDesktopPane()); - result.add(getSimulation()); - result.add(getFilterSimulationButton()); - result.add(getOpenWindowButton()); - result.add(getSupprimerSimulationButton()); - result.add(getVoirSimulationLogButton()); - return result; - } - - private JLabel __label9__ = null; - public JLabel getLabel9(){ - if(__label9__ == null){ - JLabel result = new JLabel(_("isisfish.result.choose.simulation")); - - __label9__ = result; - } - return __label9__; - } - - private javax.swing.JDesktopPane - __desktopPane__ = null; - public javax.swing.JDesktopPane - getDesktopPane(){ - if(__desktopPane__ == null){ - javax.swing.JDesktopPane - result = new javax.swing.JDesktopPane -(); - - __desktopPane__ = result; - } - return __desktopPane__; - } - - private JComboBox __simulation__ = null; - public JComboBox getSimulation(){ - if(__simulation__ == null){ - JComboBox result = new JComboBox(); - result.setEditable(true); - result.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - on_simulation_selection_notify_event(e); - } - }); - - __simulation__ = result; - } - return __simulation__; - } - - private JButton __openWindowButton__ = null; - public JButton getOpenWindowButton(){ - if(__openWindowButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.new.window"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_openWindowButton_clicked(); - } - }); - - __openWindowButton__ = result; - } - return __openWindowButton__; - } - - private JButton __supprimerSimulationButton__ = null; - public JButton getSupprimerSimulationButton(){ - if(__supprimerSimulationButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.remove.simulation"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_supprimerSimulationButton_clicked(); - } - }); - - __supprimerSimulationButton__ = result; - } - return __supprimerSimulationButton__; - } - - private JButton __voirSimulationLogButton__ = null; - - public JButton getVoirSimulationLogButton(){ - if(__voirSimulationLogButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.result.show.simulation.log"), icon); - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_voirSimulationLogButton_clicked(); - } - }); - - __voirSimulationLogButton__ = result; - } - return __voirSimulationLogButton__; - } - - private JButton __filterSimulationButton__ = null; - - public JButton getFilterSimulationButton(){ - if(__filterSimulationButton__ == null){ - ImageIcon icon = null; - - JButton result = new JButton(_("isisfish.filter"), icon); - - // TODO disabled, filtering is too long - result.setEnabled(false); - - result.addMouseListener(new MouseAdapter(){ - public void mouseClicked(MouseEvent e){ - on_filterSimulationLogButton_clicked(); - } - }); - - __filterSimulationButton__ = result; - } - return __filterSimulationButton__; - } - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResultViewUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,38 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import java.awt.event.ItemEvent; - -public interface ResultViewUICallback{ - - void on_Resultat_destroy_event(); - void on_simulation_selection_notify_event(ItemEvent e); - void on_openWindowButton_clicked(); - void on_supprimerSimulationButton_clicked(); - void on_voirSimulationLogButton_clicked(); - void on_filterSimulationLogButton_clicked(); -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanel.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,102 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -/** - * ResumePanel. - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version $Revision$ -*/ -public class ResumePanel extends ResumePanelUI { - - /** serialVersionUID */ - private static final long serialVersionUID = 5424709605082901110L; - - protected String resume; -// protected Vector vmatInfo; - - public ResumePanel (){ - super(); - init(); - resume = ""; - getResumeTextArea().setText(this.resume); - } - - /** - * Get the value of resume. - * @return value of resume. - */ - public String getResume() { - return resume; - } - - /** - * Set the value of resume. - * @param v Value to assign to resume. - */ - public void setResume(String v) { - this.resume = v; - getResumeTextArea().setText(this.resume); - } - -// /** -// * Get the value of vmatInfo. -// * @return value of vmatInfo. -// */ -// public Vector getVmatInfo() { -// return vmatInfo; -// } - -// /** -// * Set the value of vmatInfo. -// * @param v Value to assign to vmatInfo. -// */ -// public void setVmatInfo(Vector v) { -// this.vmatInfo = v; -// getMatriceInfoGrid().removeAll(); -// GridBagConstraints [] cs = new GridBagConstraints[vmatInfo.size()]; -// GridBagConstraints c = null; -// for(int i=0; i<vmatInfo.size(); i++){ -// c = new GridBagConstraints(); -// c.gridx = 0; -// c.gridy = i; -// c.weightx = 1; -// c.weighty = 1; -// c.gridwidth = 1; -// c.gridheight = 1; -// c.fill = GridBagConstraints.BOTH; -// cs[i] = c; -// } -// -// getMatriceInfoGrid().setLayout(new GridBagLayout()); -// for(int i=0; i<vmatInfo.size(); i++){ -// DataResult dataResult = new DataResult(); -// dataResult.setMatrix((MatriceInfo)vmatInfo.get(i)); -// getMatriceInfoGrid().add(dataResult, cs[i]); -// } -// } - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,196 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JViewport; - -public abstract class ResumePanelUI extends JPanel implements ResumePanelUICallback{ - - protected void init(){ - ResumePanelUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getResumePanelChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = (ButtonGroup)hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getResumePanelChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable1()); - return result; - } - - private JPanel __table1__ = null; - public JPanel getTable1(){ - if(__table1__ == null){ - Vector childs = getTable1Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 2; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table1__ = result; - } - return __table1__; - } - - public Vector getTable1Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getScrolledwindow2()); - result.add(getMatriceInfoGrid()); - return result; - } - - private JScrollPane __scrolledwindow2__ = null; - public JScrollPane getScrolledwindow2(){ - if(__scrolledwindow2__ == null){ - Vector childs = getScrolledwindow2Childs(); - Component child = null; - if(childs.size() >= 1) - child = (Component)childs.get(0); - - JScrollPane result; - if(child instanceof JViewport){ - result = new JScrollPane(); - result.setViewport((JViewport)child); - } - else - result = new JScrollPane(child); - - __scrolledwindow2__ = result; - } - return __scrolledwindow2__; - } - - public Vector getScrolledwindow2Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getResumeTextArea()); - return result; - } - - private JTextArea __resumeTextArea__ = null; - public JTextArea getResumeTextArea(){ - if(__resumeTextArea__ == null){ - JTextArea result = new JTextArea(_("isisfish.common.blank")); - result.setEditable(false); - - __resumeTextArea__ = result; - } - return __resumeTextArea__; - } - - private JPanel __matriceInfoGrid__ = null; - public JPanel getMatriceInfoGrid(){ - if(__matriceInfoGrid__ == null){ - Vector childs = getMatriceInfoGridChilds(); - GridBagConstraints [] cs; - cs = new GridBagConstraints[childs.size()]; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __matriceInfoGrid__ = result; - } - return __matriceInfoGrid__; - } - - public Vector getMatriceInfoGridChilds(){ - Vector result; - result = new Vector(); - return result; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/ResumePanelUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface ResumePanelUICallback{ - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBean.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,81 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import com.bbn.openmap.gui.OMToolSet; -import com.bbn.openmap.gui.Tool; - -import fr.ifremer.isisfish.entities.FisheryRegion; -import fr.ifremer.isisfish.map.ResultatLayer; - -/** - * SimpleResultatMapBean.java - * - * - * Created: Fri Jun 7 13:02:18 2002 - * - * @author <a href="mailto:seb.regnier at free.fr"></a> - * @version - */ -public class SimpleResultatMapBean extends SimpleResultatMapBeanUI { - public SimpleResultatMapBean (){ - super(); - init(); - initBean(); - } - - protected void initBean(){ - // Create the directional and zoom control tool - OMToolSet resultatMapOMTS = new OMToolSet(); - - // Associate the tool with the map - resultatMapOMTS.setupListeners(getIsisMapBean()); - - // Add the tool to the map toolbar - getIsisMapBeanToolBar().add((Tool)resultatMapOMTS); - - getInformationDelegator().setMap(getIsisMapBean()); - getInformationDelegator().setShowLights(false); - getInformationDelegator().setLabel(_("isisfish.simpleResult.more.information")); - } - - public void addResultatLayer(String id, ResultatLayer layer) { - getIsisMapBean().addResultatLayer(id, layer); - getLegendPanel().setModel(new LegendModel(0,Math.round(layer.getDataMapList().getMaxDataMapValue()))); - // poussin 20060822 FIXME: migration vers v3, je ne sais pas comment ca merchait avant, la methode n'existe pas :( -// getInformationDelegator().addLayer(layer); - } - - public void removeAllResultatLayer() { - getIsisMapBean().removeAllResultatLayer(); - } - - public void setRegion(FisheryRegion region) { - getIsisMapBean().setFisheryRegion(region); - } - -}// SimpleResultatMapBean Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUI.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,204 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -import static org.nuiton.i18n.I18n._; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; - -import fr.ifremer.isisfish.map.CellSelectionLayer; - -public abstract class SimpleResultatMapBeanUI extends JPanel implements SimpleResultatMapBeanUICallback{ - - protected void init(){ - SimpleResultatMapBeanUI result = this; - this.setLayout(new BorderLayout()); - Vector childs = getSimpleResultatMapBeanChilds(); - if(childs.size() >= 1) - result.add((Component)childs.get(0), - BorderLayout.CENTER); - - result.setBounds(0,0,0,0); - } - - public void center(){ - // Center the screen - Toolkit tk = this.getToolkit(); - Dimension d = this.getSize(); - int x = (tk.getScreenSize().width - d.width) / 2; - int y = (tk.getScreenSize().height - d.height) / 2; - this.setLocation(x, y); - } - - protected HashMap<String,ButtonGroup> hashGroup = null; - /** - * Ajoute un bouton a un groupe - * @param b the button - * @param groupName name fo group - */ - protected void group(AbstractButton b, String groupName){ - if(hashGroup == null) - hashGroup = new HashMap<String,ButtonGroup>(); - ButtonGroup bg = hashGroup.get(groupName); - if(bg == null){ - bg = new ButtonGroup(); - hashGroup.put(groupName, bg); - } - bg.add(b); - } - - public Vector getSimpleResultatMapBeanChilds(){ - Vector<Object> result = new Vector<Object>(); - result.add(getTable12()); - return result; - } - - private JPanel __table12__ = null; - public JPanel getTable12(){ - if(__table12__ == null){ - Vector childs = getTable12Childs(); - GridBagConstraints [] cs = new GridBagConstraints[childs.size()]; - GridBagConstraints c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[0] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 2; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[1] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[2] = c; - - c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 3; - c.weightx = 1; - c.weighty = 0; - c.gridwidth = 1; - c.gridheight = 1; - c.fill = GridBagConstraints.BOTH; - cs[3] = c; - - JPanel result = new JPanel(new GridBagLayout()); - for(int i=0; i<childs.size(); i++) - result.add((Component)childs.get(i), cs[i]); - - __table12__ = result; - } - return __table12__; - } - - public Vector getTable12Childs(){ - Vector<Object> result = new Vector<Object>(); - result.add(getIsisMapBean()); - result.add(getInformationDelegator()); - result.add(getIsisMapBeanToolBar()); - result.add(getLegendPanel()); - return result; - } - - private fr.ifremer.isisfish.map.IsisMapBean __resultatMap__ = null; - public fr.ifremer.isisfish.map.IsisMapBean getIsisMapBean(){ - if(__resultatMap__ == null){ - fr.ifremer.isisfish.map.IsisMapBean result = new fr.ifremer.isisfish.map.IsisMapBean(); - - // EC-20090706 : fix bug 1777 : no selection on result map - result.setSelectionMode(CellSelectionLayer.NO_SELECTION); - - __resultatMap__ = result; - } - return __resultatMap__; - } - - private com.bbn.openmap.InformationDelegator __informationDelegator__ = null; - public com.bbn.openmap.InformationDelegator getInformationDelegator(){ - if(__informationDelegator__ == null){ - com.bbn.openmap.InformationDelegator result; - result = new com.bbn.openmap.InformationDelegator(); - __informationDelegator__ = result; - } - return __informationDelegator__; - } - - private com.bbn.openmap.gui.ToolPanel - __resultatMapToolBar__ = null; - public com.bbn.openmap.gui.ToolPanel - getIsisMapBeanToolBar(){ - if(__resultatMapToolBar__ == null){ - com.bbn.openmap.gui.ToolPanel - result = new com.bbn.openmap.gui.ToolPanel -(); - - __resultatMapToolBar__ = result; - } - return __resultatMapToolBar__; - } - - private LegendPanel __legendPanel__ = null; - public LegendPanel getLegendPanel(){ - if(__legendPanel__ == null){ - LegendPanel result = new LegendPanel(); - - __legendPanel__ = result; - } - return __legendPanel__; - } - - - -} Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/SimpleResultatMapBeanUICallback.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -1,30 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2002 - 2010 Ifremer, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-2.0.html>. - * #L% - */ - -package fr.ifremer.isisfish.ui.result; - -public interface SimpleResultatMapBeanUICallback{ - -} Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java 2011-04-08 14:26:03 UTC (rev 3239) @@ -0,0 +1,71 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.result; + +import javax.swing.Icon; + +import org.nuiton.math.matrix.viewer.MatrixDimensionAction; +import org.nuiton.util.Resource; + +import fr.ifremer.isisfish.types.Date; + +/** + * Action de somme des elements par 12 (année) pour la dimension des pas de temps. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class YearSumDimensionAction implements MatrixDimensionAction { + + @Override + public Icon getIcon() { + return Resource.getIcon("/images/sigma_an-barre.gif"); + } + + @Override + public Icon getSelectedIcon() { + return Resource.getIcon("/images/sigma_an.gif"); + } + + @Override + public int getDimensionIndex() { + return 0; + } + + @Override + public Class<?> getDimensionType() { + return Date.class; + } + + @Override + public int getSumStep() { + return 12; + } + +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/result/YearSumDimensionAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties 2011-04-08 14:26:03 UTC (rev 3239) @@ -818,6 +818,7 @@ isisfish.result.quit=Quitter isisfish.result.reject.metier=Rejet par metier isisfish.result.remove.simulation=Remove simulation +isisfish.result.selectResult=Result \: isisfish.result.show.simulation.log=Show logs isisfish.result.statusBar=\ isisfish.result.stress.metier=Effort par metier @@ -1142,5 +1143,8 @@ isisfish.zone.cells=Zone cells isisfish.zone.comments=Comments isisfish.zone.name=Name +matrixAbundance= +matrixCatchPerStrategyMetPerZoneMet= +matrixDiscardsPerStrMetPerZonePop= region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= simulate\ %s\ with\ file\ %s= Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2011-04-07 09:17:21 UTC (rev 3238) +++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2011-04-08 14:26:03 UTC (rev 3239) @@ -818,6 +818,7 @@ isisfish.result.quit=Quitter isisfish.result.reject.metier=Rejet par metier isisfish.result.remove.simulation=Supprimer Simulation +isisfish.result.selectResult=R\u00E9sultat \: isisfish.result.show.simulation.log=Voir les logs isisfish.result.statusBar=\ isisfish.result.stress.metier=Effort par metier @@ -1142,5 +1143,8 @@ isisfish.zone.cells=Cellules de la zone isisfish.zone.comments=Commentaires isisfish.zone.name=Nom +matrixAbundance= +matrixCatchPerStrategyMetPerZoneMet= +matrixDiscardsPerStrMetPerZonePop= region\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= simulate\ %s\ with\ file\ %s= Deleted: isis-fish/branches/3.3.1/src/main/resources/images/sigma-barre.gif =================================================================== (Binary files differ) Deleted: isis-fish/branches/3.3.1/src/main/resources/images/sigma.gif =================================================================== (Binary files differ)
participants (1)
-
chatellier@users.labs.libre-entreprise.org