Coser-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- 1258 discussions
r163 - trunk/coser-business/src/test/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
04 Nov '10
Author: chatellier
Date: 2010-11-04 10:09:36 +0000 (Thu, 04 Nov 2010)
New Revision: 163
Log:
Correction du test (les lignes sont maintenant numerot?\195?\169e ?\195?\160 partir de 1)
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-11-04 09:56:07 UTC (rev 162)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CommandServiceTest.java 2010-11-04 10:09:36 UTC (rev 163)
@@ -98,16 +98,16 @@
@Test
public void testDeleteLineUndo() throws CoserBusinessException {
Project project = createTestProject(projectService);
- Assert.assertEquals("3", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
+ Assert.assertEquals("4", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
DeleteLineCommand command = new DeleteLineCommand();
- command.setLineNumber("3");
+ command.setLineNumber("4");
command.setCategory(Category.LENGTH);
commandService.doAction(command, project, project.getControl());
+ Assert.assertEquals("5", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
+ commandService.undoAction(project, project.getControl());
Assert.assertEquals("4", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
- commandService.undoAction(project, project.getControl());
- Assert.assertEquals("3", project.getControl().getLength().get(4)[Length.INDEX_LINE]);
}
/**
1
0
r162 - in trunk/coser-ui/src/main/java/fr/ifremer/coser/ui: . project
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
04 Nov '10
Author: chatellier
Date: 2010-11-04 09:56:07 +0000 (Thu, 04 Nov 2010)
New Revision: 162
Log:
Move project ui to project package
Added:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectOpenView.jaxx
Removed:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectOpenView.jaxx
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectNamesListModel.java
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-04 09:47:44 UTC (rev 161)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-04 09:56:07 UTC (rev 162)
@@ -62,12 +62,14 @@
import fr.ifremer.coser.services.ProjectService;
import fr.ifremer.coser.ui.control.ControlHandler;
import fr.ifremer.coser.ui.control.ControlView;
+import fr.ifremer.coser.ui.project.ProjectCreationView;
+import fr.ifremer.coser.ui.project.ProjectOpenView;
import fr.ifremer.coser.ui.selection.SelectionHandler;
import fr.ifremer.coser.ui.selection.SelectionView;
import fr.ifremer.coser.ui.widgets.LookAndFeelViewMenuItem;
/**
- * Coser hendler for main frame.
+ * Coser handler for main frame.
*
* @author chatellier
* @version $Revision$
Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx 2010-11-04 09:47:44 UTC (rev 161)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx 2010-11-04 09:56:07 UTC (rev 162)
@@ -1,153 +0,0 @@
-<!--
- #%L
- Coser :: UI
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 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%
- -->
-<Table>
- <CoserFrameHandler id="handler" javaBean="null" />
-
- <!-- Validation -->
- <fr.ifremer.coser.bean.Project id="project" />
- <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel'
- onTableChanged='createProjectButton.setEnabled(errorsTableModel.getRowCount()==0)'/>
- <BeanValidator id='validatorProject' bean='project'
- uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"
- errorTableModel="errorsTableModel">
- <field name="name" component="projectProjectName" />
- </BeanValidator>
-
- <script><![CDATA[
- JCheckBox customReferenceCheckBox = new JCheckBox(_("coser.ui.project.useCustomReferenceSpeciesFile"));
- void $afterCompleteSetup() {
- fr.ifremer.coser.ui.widgets.ComponentTitledBorder componentBorder =
- new fr.ifremer.coser.ui.widgets.ComponentTitledBorder(customReferenceCheckBox, useCustomReferenceFilePanel, BorderFactory.createEtchedBorder());
- useCustomReferenceFilePanel.setBorder(componentBorder);
- }
- public JCheckBox getCustomReferenceCheckBox() {
- return customReferenceCheckBox;
- }
- ]]></script>
-
- <row>
- <cell weightx="1" fill="horizontal">
- <Table border='{BorderFactory.createTitledBorder(_("coser.ui.project.newProject"))}'>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.projectname" />
- </cell>
- <cell anchor="west">
- <JTextField id="projectProjectName" text="{project.getName()}" />
- <javax.swing.text.Document javaBean="projectProjectName.getDocument()"
- onInsertUpdate='getProject().setName(projectProjectName.getText())'
- onRemoveUpdate='getProject().setName(projectProjectName.getText())' />
-
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.captureFile" />
- </cell>
- <cell weightx="1" fill="horizontal">
- <JTextField id="projectCapturesFileField" />
- </cell>
- <cell>
- <JButton id="projectCapturesSelectButton" text="coser.ui.common.selectFile"
- onActionPerformed="getHandler().selectInputFile(this, projectCapturesFileField)" />
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.stratesFile" />
- </cell>
- <cell fill="horizontal">
- <JTextField id="projectStratesFileField" />
- </cell>
- <cell>
- <JButton id="projectStratesFileSelectButton" text="coser.ui.common.selectFile"
- onActionPerformed="getHandler().selectInputFile(this, projectStratesFileField)" />
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.lengthFile" />
- </cell>
- <cell fill="horizontal">
- <JTextField id="projectLengthFileField" />
- </cell>
- <cell>
- <JButton id="projectSizeFileSelectButton" text="coser.ui.common.selectFile"
- onActionPerformed="getHandler().selectInputFile(this, projectLengthFileField)" />
- </cell>
- </row>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.traitsFile" />
- </cell>
- <cell fill="horizontal">
- <JTextField id="projectTraitsFileField" />
- </cell>
- <cell>
- <JButton id="projectTraitsFileSelectButton" text="coser.ui.common.selectFile"
- onActionPerformed="getHandler().selectInputFile(this, projectTraitsFileField)" />
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id="referenceSpeciesDescriptionLabel" text="coser.ui.project.usedReferenceSpeciesFile"
- enabled="{!customReferenceCheckBox.isSelected()}" />
- </cell>
- <cell anchor="west">
- <JLabel id="referenceSpeciesFileLabel" text="{getContextValue(fr.ifremer.coser.CoserConfig.class).getReferenceSpeciesPath()}"
- enabled="{!customReferenceCheckBox.isSelected()}" />
- </cell>
- </row>
- <row>
- <cell columns="3" fill="horizontal">
- <Table id="useCustomReferenceFilePanel">
- <row>
- <cell>
- <JLabel id="customReferenceSpeciesFileLabel" text="coser.ui.project.customReferenceSpeciesFile"
- enabled="{customReferenceCheckBox.isSelected()}"/>
- </cell>
- <cell weightx="1" fill="horizontal">
- <JTextField id="customReferenceSpeciesFileTextField"
- enabled="{customReferenceCheckBox.isSelected()}"/>
- </cell>
- <cell>
- <JButton text="coser.ui.common.selectFile"
- onActionPerformed="getHandler().selectInputFile(this, customReferenceSpeciesFileTextField)"
- enabled="{customReferenceCheckBox.isSelected()}"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell columns="3" anchor="east">
- <JButton id="createProjectButton" text="coser.ui.project.createProject"
- onActionPerformed="getHandler().createProject(this)" />
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectOpenView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectOpenView.jaxx 2010-11-04 09:47:44 UTC (rev 161)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectOpenView.jaxx 2010-11-04 09:56:07 UTC (rev 162)
@@ -1,54 +0,0 @@
-<!--
- #%L
- Coser :: UI
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 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%
- -->
-<Table>
- <CoserFrameHandler id="handler" javaBean="null" />
-
- <row>
- <cell weightx="1" fill="horizontal">
- <Table border='{BorderFactory.createTitledBorder(_("coser.ui.project.openProjectTitle"))}'>
- <row>
- <cell anchor="west">
- <JLabel text="coser.ui.project.project" />
- </cell>
- <cell anchor="west" weightx="1">
- <JComboBox id="projectsComboBox" model="{new fr.ifremer.coser.ui.project.ProjectNamesListModel(this)}" />
- </cell>
- </row>
- <row>
- <cell weightx="1" anchor="east" columns="2">
- <JButton text="coser.ui.project.openProject"
- enabled="{projectsComboBox.getSelectedItem() != null}"
- onActionPerformed="getHandler().loadProject(this)" />
- </cell>
- </row>
- <row>
- <cell weightx="1" fill="horizontal" columns="2">
- <JProgressBar id="loadingProgressBar" indeterminate="true" visible="false" />
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
Copied: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx (from rev 155, trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx)
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx 2010-11-04 09:56:07 UTC (rev 162)
@@ -0,0 +1,153 @@
+<!--
+ #%L
+ Coser :: UI
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 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%
+ -->
+<Table>
+ <fr.ifremer.coser.ui.CoserFrameHandler id="handler" javaBean="null" />
+
+ <!-- Validation -->
+ <fr.ifremer.coser.bean.Project id="project" />
+ <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel'
+ onTableChanged='createProjectButton.setEnabled(errorsTableModel.getRowCount()==0)'/>
+ <BeanValidator id='validatorProject' bean='project'
+ uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"
+ errorTableModel="errorsTableModel">
+ <field name="name" component="projectProjectName" />
+ </BeanValidator>
+
+ <script><![CDATA[
+ JCheckBox customReferenceCheckBox = new JCheckBox(_("coser.ui.project.useCustomReferenceSpeciesFile"));
+ void $afterCompleteSetup() {
+ fr.ifremer.coser.ui.widgets.ComponentTitledBorder componentBorder =
+ new fr.ifremer.coser.ui.widgets.ComponentTitledBorder(customReferenceCheckBox, useCustomReferenceFilePanel, BorderFactory.createEtchedBorder());
+ useCustomReferenceFilePanel.setBorder(componentBorder);
+ }
+ public JCheckBox getCustomReferenceCheckBox() {
+ return customReferenceCheckBox;
+ }
+ ]]></script>
+
+ <row>
+ <cell weightx="1" fill="horizontal">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.project.newProject"))}'>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.projectname" />
+ </cell>
+ <cell anchor="west">
+ <JTextField id="projectProjectName" text="{project.getName()}" />
+ <javax.swing.text.Document javaBean="projectProjectName.getDocument()"
+ onInsertUpdate='getProject().setName(projectProjectName.getText())'
+ onRemoveUpdate='getProject().setName(projectProjectName.getText())' />
+
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.captureFile" />
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JTextField id="projectCapturesFileField" />
+ </cell>
+ <cell>
+ <JButton id="projectCapturesSelectButton" text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectInputFile(this, projectCapturesFileField)" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.stratesFile" />
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="projectStratesFileField" />
+ </cell>
+ <cell>
+ <JButton id="projectStratesFileSelectButton" text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectInputFile(this, projectStratesFileField)" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.lengthFile" />
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="projectLengthFileField" />
+ </cell>
+ <cell>
+ <JButton id="projectSizeFileSelectButton" text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectInputFile(this, projectLengthFileField)" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.traitsFile" />
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="projectTraitsFileField" />
+ </cell>
+ <cell>
+ <JButton id="projectTraitsFileSelectButton" text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectInputFile(this, projectTraitsFileField)" />
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="referenceSpeciesDescriptionLabel" text="coser.ui.project.usedReferenceSpeciesFile"
+ enabled="{!customReferenceCheckBox.isSelected()}" />
+ </cell>
+ <cell anchor="west">
+ <JLabel id="referenceSpeciesFileLabel" text="{getContextValue(fr.ifremer.coser.CoserConfig.class).getReferenceSpeciesPath()}"
+ enabled="{!customReferenceCheckBox.isSelected()}" />
+ </cell>
+ </row>
+ <row>
+ <cell columns="3" fill="horizontal">
+ <Table id="useCustomReferenceFilePanel">
+ <row>
+ <cell>
+ <JLabel id="customReferenceSpeciesFileLabel" text="coser.ui.project.customReferenceSpeciesFile"
+ enabled="{customReferenceCheckBox.isSelected()}"/>
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JTextField id="customReferenceSpeciesFileTextField"
+ enabled="{customReferenceCheckBox.isSelected()}"/>
+ </cell>
+ <cell>
+ <JButton text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectInputFile(this, customReferenceSpeciesFileTextField)"
+ enabled="{customReferenceCheckBox.isSelected()}"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell columns="3" anchor="east">
+ <JButton id="createProjectButton" text="coser.ui.project.createProject"
+ onActionPerformed="getHandler().createProject(this)" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+</Table>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectNamesListModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectNamesListModel.java 2010-11-04 09:47:44 UTC (rev 161)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectNamesListModel.java 2010-11-04 09:56:07 UTC (rev 162)
@@ -31,7 +31,6 @@
import javax.swing.ComboBoxModel;
import fr.ifremer.coser.services.ProjectService;
-import fr.ifremer.coser.ui.ProjectOpenView;
/**
* Validation categories list model.
Copied: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectOpenView.jaxx (from rev 84, trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectOpenView.jaxx)
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectOpenView.jaxx (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectOpenView.jaxx 2010-11-04 09:56:07 UTC (rev 162)
@@ -0,0 +1,54 @@
+<!--
+ #%L
+ Coser :: UI
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 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%
+ -->
+<Table>
+ <fr.ifremer.coser.ui.CoserFrameHandler id="handler" javaBean="null" />
+
+ <row>
+ <cell weightx="1" fill="horizontal">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.project.openProjectTitle"))}'>
+ <row>
+ <cell anchor="west">
+ <JLabel text="coser.ui.project.project" />
+ </cell>
+ <cell anchor="west" weightx="1">
+ <JComboBox id="projectsComboBox" model="{new fr.ifremer.coser.ui.project.ProjectNamesListModel(this)}" />
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" anchor="east" columns="2">
+ <JButton text="coser.ui.project.openProject"
+ enabled="{projectsComboBox.getSelectedItem() != null}"
+ onActionPerformed="getHandler().loadProject(this)" />
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" fill="horizontal" columns="2">
+ <JProgressBar id="loadingProgressBar" indeterminate="true" visible="false" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+</Table>
1
0
r161 - in trunk/coser-ui/src/main: java/fr/ifremer/coser/ui java/fr/ifremer/coser/ui/control resources/i18n
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
by chatellier@users.labs.libre-entreprise.org 04 Nov '10
04 Nov '10
Author: chatellier
Date: 2010-11-04 09:47:44 +0000 (Thu, 04 Nov 2010)
New Revision: 161
Log:
Ajout d'un check (avec messages d'avertissement) si l'on tente de creer une selection avec des erreurs et warning encore pr?\195?\169sents
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-03 16:11:15 UTC (rev 160)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-04 09:47:44 UTC (rev 161)
@@ -119,12 +119,21 @@
setMainComponent(projectOpenView);
}
- public void setMainComponent(Component component) {
+ /**
+ * Replace window main component.
+ *
+ * @param component new component
+ */
+ protected void setMainComponent(Component component) {
view.getMainViewContent().removeAll();
view.getMainViewContent().add(component, BorderLayout.CENTER);
view.getMainViewContent().validate();
}
+ /**
+ * Exit application.
+ *
+ */
public void quit() {
System.exit(0);
}
@@ -358,7 +367,7 @@
if (reloadData) {
project = projectService.loadControlData(project);
}
-
+
ControlView controlView = new ControlView(view);
controlView.setHandler(new ControlHandler());
setMainComponent(controlView);
@@ -371,7 +380,12 @@
* Show selection view to create new selection.
*/
public void showSelectionView() {
-
+
+ // verifie que les données sont toutes validée d'abord
+ if (!checkControlSession()) {
+ return;
+ }
+
// create new selection
ProjectService projectService = view.getContextValue(ProjectService.class);
Project project = view.getContextValue(Project.class);
@@ -394,7 +408,7 @@
ImageIcon icon = new ImageIcon(file.toURI().toURL());
selectionView.getSelectionDetailsTab().getZonesMap().setIcon(icon);
- } catch(Exception e){
+ } catch(Exception e) {
e.printStackTrace();
};
setMainComponent(selectionView);
@@ -406,6 +420,29 @@
}
/**
+ * Cette methode vérifie que si une session de control est en cours on
+ * verifie que la liste des erreurs ne contient pas d'erreur ou
+ * de message warning non coché.
+ *
+ * @return {@code true} if user confirm selection creation even if there is some errors
+ */
+ protected boolean checkControlSession() {
+
+ boolean result = false;
+
+ // basé sur un hack, car ici, on ne sais pas ce que contient
+ // le panel principal
+ // attention, c'est du big hack ;)
+ Component comp = view.getMainViewContent().getComponent(0);
+ if (comp instanceof ControlView) {
+ ControlView controlView = (ControlView)comp;
+ result = controlView.getHandler().checkValidationModelErrors(controlView);
+ }
+
+ return result;
+ }
+
+ /**
* Show selection view to open selection.
*
* @param selectionName selection name to open
@@ -439,8 +476,10 @@
}
/**
+ * Called by {@link LookAndFeelViewMenuItem} when look and feel selection
+ * change.
*
- * @param event
+ * @param event change event
*/
public void saveLookAndFeelConfiguration(PropertyChangeEvent event) {
if (event.getPropertyName().equals(LookAndFeelViewMenuItem.PROPERTY_LOOK_AND_FEEL)) {
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-03 16:11:15 UTC (rev 160)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-04 09:47:44 UTC (rev 161)
@@ -338,9 +338,7 @@
errorFound = true;
}
}
- if (!errorFound) {
- view.getSaveButton().setEnabled(true);
- }
+ view.getSaveButton().setEnabled(true);
} catch (Exception ex) {
throw new CoserException("Can't validate data", ex);
}
@@ -582,8 +580,12 @@
String headerValue = header[fieldIndex];
String fieldValue = line[fieldIndex];
- final String beanFieldName = Introspector.decapitalize(enHeaders[fieldIndex - 1]);
+ String beanFieldName = Introspector.decapitalize(enHeaders[fieldIndex - 1]);
+ // l'ui ne peut utiliser les getter/setter que sur les champs
+ // xxxAsString
+ final String stringBeanFieldName = beanFieldName + "AsString";
+
JLabel label = new JLabel(headerValue + "\u2009:");
final JTextField fieldTextField = new JTextField(fieldValue);
fieldTextField.getDocument().addDocumentListener(new DocumentListener() {
@@ -604,10 +606,10 @@
protected void valueChanged(DocumentEvent event) {
try {
- PropertyUtils.setProperty(finalBean, beanFieldName, fieldTextField.getText());
+ PropertyUtils.setProperty(finalBean, stringBeanFieldName, fieldTextField.getText());
} catch (Exception ex) {
if (log.isErrorEnabled()) {
- log.error("Can't set property value (" + beanFieldName + ")", ex);
+ log.error("Can't set property value (" + stringBeanFieldName + ")", ex);
}
}
}
@@ -620,7 +622,11 @@
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(
1, 1, 1, 1), 0, 0));
+ // permet de dire a jaxx que les erreurs sur les
+ // champs d'origine, et les champs string pointent sur le
+ // même composant
validator.setFieldRepresentation(beanFieldName, fieldTextField);
+ validator.setFieldRepresentation(stringBeanFieldName, fieldTextField);
}
validator.installUIs();
@@ -649,12 +655,16 @@
/**
* Save project after control.
*
+ * Can't save if :
+ * - validation contains error
+ * - validation contains non checked warning
+ *
* @param view view
*/
public void saveControl(ControlView view) {
Project project = view.getContextValue(Project.class);
ProjectService service = view.getContextValue(ProjectService.class);
-
+
try {
long before = System.currentTimeMillis();
service.saveProjectControl(project);
@@ -669,8 +679,67 @@
}
/**
- * Display data graph.
+ * Verifie que le modele ne contient pas d'erreur (error/fatal) et
+ * demande à l'utilisateur s'il confirme vouloir sauver lorsque des warning
+ * ont été trouvé.
*
+ * La liste peut être vide, soit parce que le check global n'a pas été
+ * lancé, soit parce qu'il n'y a réelement pas d'erreur.
+ *
+ * @param controlView view
+ * @return {@code true} if should perform save
+ */
+ public boolean checkValidationModelErrors(ControlView controlView) {
+ GlobalValidationModel model = controlView.getGlobalValidationModel();
+ controlView.getControlDataTableSelectionModel().clearSelection();
+
+ int errorFound = 0;
+ int nonCheckedWarningFound = 0;
+
+ int groupCount = model.getChildCount(model.getRoot());
+ for (int indexGroup = 0 ; indexGroup < groupCount ; ++indexGroup) {
+ Object group = model.getChild(model.getRoot(), indexGroup);
+
+ int childCount = model.getChildCount(group);
+ for (int indexChild = 0 ; indexChild < childCount ; ++indexChild) {
+ ValidationError validationError = (ValidationError)model.getChild(group, indexChild);
+ if (validationError.getLevel() == ValidationLevel.ERROR ||
+ validationError.getLevel() == ValidationLevel.FATAL) {
+ errorFound++;
+ }
+ else if (validationError.getLevel() == ValidationLevel.WARNING) {
+
+ // on verifie que le warning est coché ou pas
+ Boolean checked = (Boolean)model.getValueAt(validationError, 1);
+ if (!checked) {
+ nonCheckedWarningFound++;
+ }
+ }
+ }
+ }
+
+ boolean perform = true;
+ if (errorFound > 0) {
+ int response = JOptionPane.showConfirmDialog(controlView, _("coser.ui.control.check.containsError"),
+ _("coser.ui.control.check.title"), JOptionPane.ERROR_MESSAGE, JOptionPane.YES_NO_OPTION);
+ if (response == JOptionPane.NO_OPTION) {
+ perform = false;
+ }
+ }
+ else if (nonCheckedWarningFound > 0) {
+ int response = JOptionPane.showConfirmDialog(controlView, _("coser.ui.control.check.containsUncheckedWarning", nonCheckedWarningFound),
+ _("coser.ui.control.check.title"), JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION);
+ if (response == JOptionPane.NO_OPTION) {
+ perform = false;
+ }
+ }
+ return perform;
+ }
+
+ /**
+ * Display data graph, initialized with graph for first specy
+ * selected in specyComboModel.
+ *
* @param view view
*/
public void displayGraph(ControlView view) {
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-03 16:11:15 UTC (rev 160)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-04 09:47:44 UTC (rev 161)
@@ -95,8 +95,7 @@
</JScrollPane>
</cell>
<cell fill="both" weightx="1" weighty="1">
- <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel'
- onTableChanged='saveButton.setEnabled(errorsTableModel.getRowCount()==0)'/>
+ <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel' />
<fr.ifremer.coser.data.Catch id="beanCatch" javaBean="null" />
<fr.ifremer.coser.data.Haul id="beanHaul" javaBean="null" />
<fr.ifremer.coser.data.Strata id="beanStrata" javaBean="null" />
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-03 16:11:15 UTC (rev 160)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-04 09:47:44 UTC (rev 161)
@@ -14,6 +14,9 @@
coser.ui.common.unselectAll=None
coser.ui.common.valid=Valid
coser.ui.config.title=Configuration
+coser.ui.control.check.containsError=
+coser.ui.control.check.containsUncheckedWarning=
+coser.ui.control.check.title=
coser.ui.control.confirmDeletionMessage=Are you sure you want to delete this data ?
coser.ui.control.confirmDeletionTitle=Confirm delete
coser.ui.control.confirmDeletionsMessage=Are you sure you want to delete %d selected lines ?
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-03 16:11:15 UTC (rev 160)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-04 09:47:44 UTC (rev 161)
@@ -14,13 +14,16 @@
coser.ui.common.unselectAll=Aucun
coser.ui.common.valid=Valider
coser.ui.config.title=Configuration
+coser.ui.control.check.containsError=Les donn\u00E9es contiennent encore des erreurs non corrig\u00E9es\npouvant fausser la cr\u00E9ation de la s\u00E9lection.\nVoulez vous poursuivre la cr\u00E9ation de la s\u00E9lection ?
+coser.ui.control.check.containsUncheckedWarning=Les donn\u00E9es contiennent encore %d avertissements non coch\uFFFDs pouvant fausser la cr\u00E9ation de la selection.\nVoulez vous poursuivre la cr\u00E9ation de la s\u00E9lection ?
+coser.ui.control.check.title=V\u00E9rification des erreurs
coser.ui.control.confirmDeletionMessage=\u00CAtes vous s\u00FBr de vouloir supprimer cette donn\u00E9e ?
coser.ui.control.confirmDeletionTitle=Confirmation de suppression
coser.ui.control.confirmDeletionsMessage=\u00CAtes vous s\u00FBr de vouloir supprimer les %d lignes s\u00E9lectionn\u00E9es ?
coser.ui.control.dataMenuDeleteSelected=Supprimer les lignes s\u00E9lectionn\u00E9es
coser.ui.control.dataMenuLabel=Menu des donn\u00E9es
coser.ui.control.dataMenuReplace=Remplacer dans %s pour la s\u00E9lection
-coser.ui.control.dataMenuReplaceAll=Replacer dans %s pour toutes les lignes
+coser.ui.control.dataMenuReplaceAll=Remplacer dans %s pour toutes les lignes
coser.ui.control.deleteLine=Supprimer la ligne
coser.ui.control.global.done=\u2026
coser.ui.control.global.message=Message
1
0
r160 - trunk/coser-ui/src/main/resources/icons
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 16:11:15 +0000 (Wed, 03 Nov 2010)
New Revision: 160
Log:
Add save icon
Added:
trunk/coser-ui/src/main/resources/icons/bullet_disk.png
Added: trunk/coser-ui/src/main/resources/icons/bullet_disk.png
===================================================================
(Binary files differ)
Property changes on: trunk/coser-ui/src/main/resources/icons/bullet_disk.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r159 - in trunk: coser-business/src/main/java/fr/ifremer/coser/control coser-business/src/main/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 16:11:03 +0000 (Wed, 03 Nov 2010)
New Revision: 159
Log:
Ajout des menus contextuel sur l'arbre des erreurs et sur la table des donn?\195?\169es
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationGroup.java
trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java 2010-11-03 16:11:03 UTC (rev 159)
@@ -27,7 +27,6 @@
import java.io.Serializable;
-import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.CoserConstants.ValidationLevel;
/**
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-03 16:11:03 UTC (rev 159)
@@ -605,8 +605,8 @@
* Set content into project depending on category type.
*
* @param project project
+ * @param container data container
* @param category category
- * @param content content to set
* @param deletedContent if content means deleted objects for {@code category}
*/
protected DataStorage getProjectContent(Project project, AbstractDataContainer container,
@@ -661,18 +661,35 @@
* @param control control
* @param category category
* @param index index to delete
+ * @param commandUUID command UUID
* @throws CoserBusinessException
*/
- public void deleteData(Project project, Control control, Category category, String index) throws CoserBusinessException {
+ public void deleteData(Project project, Control control, Category category, String index, String commandUUID) throws CoserBusinessException {
// create new delete action
DeleteLineCommand command = new DeleteLineCommand();
command.setCategory(category);
command.setLineNumber(index);
+ command.setCommandUUID(commandUUID);
commandService.doAction(command, project, control);
}
/**
+ * Supprime une données via son index.
+ *
+ * Used in control ui.
+ *
+ * @param project project
+ * @param control control
+ * @param category category
+ * @param index index to delete
+ * @throws CoserBusinessException
+ */
+ public void deleteData(Project project, Control control, Category category, String index) throws CoserBusinessException {
+ deleteData(project, control, category, index, null);
+ }
+
+ /**
* Replace une valeur d'un champs si nécéssaire.
*
* If {@code currentValue} is not equals to current data value for fieldName,
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-03 16:11:03 UTC (rev 159)
@@ -49,12 +49,15 @@
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.tree.TreePath;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.chart.ChartPanel;
@@ -112,12 +115,15 @@
int[] dataSelectedRows = controlView.getControlDataTable().getSelectedRows();
final int columnIndex = controlView.getControlDataTable().getColumnModel().getColumnIndexAtX(event.getX());
+ JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.dataMenuLabel"));
+
// plusieurs lignes selectionnées et pas la premiere colonne (Line index)
if (dataSelectedRows.length > 0 && columnIndex > 0) {
ControlDataTableModel controlDataModel = controlView.getControlDataTableModel();
final String columnName = controlView.getControlDataTable().getColumnName(columnIndex);
final String firstValue = (String)controlDataModel.getValueAt(dataSelectedRows[0], columnIndex);
- JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.dataMenuLabel"));
+
+ // replace in selection
JMenuItem replaceMenu = new JMenuItem(_("coser.ui.control.dataMenuReplace", columnName));
replaceMenu.addActionListener(new ActionListener() {
@Override
@@ -132,12 +138,84 @@
}
});
popupMenu.add(replaceMenu);
- popupMenu.show(controlView.getControlDataTable(), event.getX(), event.getY());
}
+
+ // replace in everywhere
+ if (columnIndex > 0) {
+ final String columnName = controlView.getControlDataTable().getColumnName(columnIndex);
+ JMenuItem replaceAllMenu = new JMenuItem(_("coser.ui.control.dataMenuReplaceAll", columnName));
+ replaceAllMenu.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ControlFindReplaceDialog viewDialog = new ControlFindReplaceDialog(controlView);
+ viewDialog.setHandler(ControlHandler.this);
+ viewDialog.setColumnIndex(columnIndex);
+ viewDialog.getReplaceFieldNameLabel().setText(columnName);
+ viewDialog.setLocationRelativeTo(controlView);
+ viewDialog.setVisible(true);
+ }
+ });
+ popupMenu.add(replaceAllMenu);
+ }
+
+ // delete selected
+ if (dataSelectedRows.length > 0) {
+
+ JMenuItem deleteSelectedMenu = new JMenuItem(_("coser.ui.control.dataMenuDeleteSelected"));
+ deleteSelectedMenu.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ deletedSelectedDataLines(controlView);
+ }
+ });
+ popupMenu.add(deleteSelectedMenu);
+ }
+
+ popupMenu.show(controlView.getControlDataTable(), event.getX(), event.getY());
}
}
/**
+ * Delete selected line in data table (called from context menu).
+ *
+ * @param controlView view
+ */
+ protected void deletedSelectedDataLines(ControlView controlView) {
+
+ JTable controlDataTable = controlView.getControlDataTable();
+ int[] selectedLines = controlDataTable.getSelectedRows();
+ if (ArrayUtils.isNotEmpty(selectedLines)) {
+
+ int response = JOptionPane.showConfirmDialog(controlView, _("coser.ui.control.confirmDeletionsMessage", selectedLines.length),
+ _("coser.ui.control.confirmDeletionTitle"),
+ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+
+ if (response == JOptionPane.YES_OPTION) {
+ Project project = controlView.getContextValue(Project.class);
+ ProjectService projectService = controlView.getContextValue(ProjectService.class);
+ Category category = (Category)controlView.getCategoryComboBox().getSelectedItem();
+
+ ControlDataTableModel model = (ControlDataTableModel)controlDataTable.getModel();
+ String commandUUID = UUID.randomUUID().toString();
+
+ // il faut le faire à l'envers, sinon, les index de
+ // selection change en cours de route
+ for (int indexSelected = selectedLines.length - 1 ; indexSelected >= 0 ; --indexSelected) {
+ int selectedLine = selectedLines[indexSelected];
+ String[] data = model.getDataAt(selectedLine);
+ try {
+ projectService.deleteData(project, project.getControl(), category, data[AbstractDataEntity.INDEX_LINE], commandUUID);
+ model.fireTableRowsDeleted(selectedLine, selectedLine);
+ }
+ catch (CoserBusinessException ex) {
+ throw new CoserException("Can't delete data", ex);
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Perform find and replace.
*
* @param replaceView view
@@ -336,22 +414,91 @@
* @param view view
* @param event selection event
*/
- public void showSelectedError(ControlView view, ListSelectionEvent event) {
- int selectedError = view.getValidationGlobalErrorsTable().getSelectedRow();
- if (selectedError != -1) {
- /*ValidationError error = view.getGlobalValidationModel().getErrorAt(selectedError);
- String errorLineNumber = error.getLineNumber();
-
- // peut être null, si l'erreur ne porte pas sur un bean en particulier
- if (errorLineNumber != null) {
- int errorLineIndex = view.getControlDataTableModel().getRealIndexOfLine(errorLineNumber);
- view.getControlDataTableSelectionModel().setSelectionInterval(errorLineIndex, errorLineIndex);
- scrollToVisible(view.getControlDataTable(), errorLineIndex, 0);
- }*/
+ public void showSelectedError(ControlView view, TreeSelectionEvent event) {
+ TreePath selectedError = view.getValidationGlobalErrorsTable().getTreeSelectionModel().getSelectionPath();
+ if (selectedError != null) {
+ Object[] pathWay = selectedError.getPath();
+
+ // 2 = validation group (middle level)
+ // 3 = validation error (last level)
+ if (pathWay.length == 3) {
+ ValidationError error = (ValidationError)pathWay[2];
+ String errorLineNumber = error.getLineNumber();
+ // peut être null, si l'erreur ne porte pas sur un bean en particulier
+ if (errorLineNumber != null) {
+ int errorLineIndex = view.getControlDataTableModel().getRealIndexOfLine(errorLineNumber);
+
+ // ca peut arriver si la ligne a été supprimée
+ if (errorLineIndex >= 0) {
+ view.getControlDataTableSelectionModel().setSelectionInterval(errorLineIndex, errorLineIndex);
+ scrollToVisible(view.getControlDataTable(), errorLineIndex, 0);
+ }
+ }
+ }
}
}
+
+ /**
+ * Affiche le menu contextuel de l'arbre qui contient les erreurs de
+ * validation globales.
+ *
+ * @param controlView view
+ * @param event mouse event
+ */
+ public void showGlobalErrorTableContextMenu(final ControlView controlView, MouseEvent event) {
+ // clic contextuel
+ if (event.getButton() == MouseEvent.BUTTON3) {
+ TreePath selectedError = controlView.getValidationGlobalErrorsTable().getTreeSelectionModel().getSelectionPath();
+
+ // plusieurs lignes selectionnées et pas la premiere colonne (Line index)
+ if (selectedError != null) {
+ Object[] pathWay = selectedError.getPath();
+
+ // 2 = validation group (middle level)
+ if (pathWay.length == 2) {
+ final GlobalValidationGroup validationGroup = (GlobalValidationGroup)pathWay[1];
+ JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.globalErrorMenuLabel"));
+ JMenuItem replaceMenu = new JMenuItem(_("coser.ui.control.globalErrorMenuSelectAll"));
+ replaceMenu.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ selectAllErrorGroupLines(controlView, validationGroup);
+ }
+ });
+ popupMenu.add(replaceMenu);
+ popupMenu.show(controlView.getValidationGlobalErrorsTable(), event.getX(), event.getY());
+ }
+ }
+ }
+ }
+
/**
+ * Selectionne toutes les lignes associés au erreur d'un group d'erreur.
+ *
+ * @param controlView controlView
+ * @param validationGroup validationGroup
+ */
+ protected void selectAllErrorGroupLines(ControlView controlView, GlobalValidationGroup validationGroup) {
+ GlobalValidationModel model = controlView.getGlobalValidationModel();
+ controlView.getControlDataTableSelectionModel().clearSelection();
+ int childCount = model.getChildCount(validationGroup);
+ for (int indexChild = 0 ; indexChild < childCount ; ++indexChild) {
+ ValidationError validationError = (ValidationError)model.getChild(validationGroup, indexChild);
+ String errorLineNumber = validationError.getLineNumber();
+ int errorLineIndex = controlView.getControlDataTableModel().getRealIndexOfLine(errorLineNumber);
+
+ // ca peut arriver si la ligne a été supprimée
+ if (errorLineIndex >= 0) {
+ controlView.getControlDataTableSelectionModel().addSelectionInterval(errorLineIndex, errorLineIndex);
+ if (indexChild == 0) {
+ scrollToVisible(controlView.getControlDataTable(), errorLineIndex, 0);
+ }
+ }
+ }
+ }
+
+ /**
* Scroll le viewport de la table à la ligne demandée.
*
* @param table table
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-03 16:11:03 UTC (rev 159)
@@ -39,6 +39,10 @@
<row>
<cell fill="horizontal" insets="0" anchor="west" columns="2">
<JToolBar floatable="false">
+ <JButton id="saveButton" icon="bullet_disk.png"
+ text="coser.ui.control.save" enabled="false"
+ onActionPerformed="getHandler().saveControl(this)" />
+ <JSeparator />
<fr.ifremer.coser.ui.control.ControlCategoryListModel id="categoryComboBoxModel" />
<JComboBox id="categoryComboBox" model="{categoryComboBoxModel}"
renderer="{new fr.ifremer.coser.ui.control.ControlCategoryListRenderer()}"
@@ -122,9 +126,11 @@
<GlobalValidationModel id="globalValidationModel" />
<JXTreeTable id='validationGlobalErrorsTable' treeTableModel="{globalValidationModel}"
rootVisible="false" showsRootHandles="true"
- treeCellRenderer="{new ControlValidationRenderer()}" />
- <ListSelectionModel id="globalValidationTableSelectionModel"
- javaBean="validationGlobalErrorsTable.getSelectionModel()"
+ treeCellRenderer="{new ControlValidationRenderer()}"
+ onMouseClicked="getHandler().showGlobalErrorTableContextMenu(this, event)"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
+ <javax.swing.tree.TreeSelectionModel id="globalValidationTableSelectionModel"
+ javaBean="validationGlobalErrorsTable.getTreeSelectionModel()"
onValueChanged="getHandler().showSelectedError(this, event)" />
</JScrollPane>
</cell>
@@ -142,10 +148,4 @@
<JButton text="coser.ui.validation.checkData" onActionPerformed="getHandler().checkData(this)" />
</cell>
</row>
- <row>
- <cell anchor="east" columns="2">
- <JButton id="saveButton" text="coser.ui.control.save" enabled="false"
- onActionPerformed="getHandler().saveControl(this)" />
- </cell>
- </row>
</Table>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationGroup.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationGroup.java 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationGroup.java 2010-11-03 16:11:03 UTC (rev 159)
@@ -1,25 +1,23 @@
/*
* #%L
- *
- *
* $Id$
* $HeadURL$
* %%
* Copyright (C) 2010 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
+ * 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 Lesser Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Lesser Public
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-03 16:11:03 UTC (rev 159)
@@ -9,7 +9,6 @@
coser.config.support.email.description=Support email address
coser.ui.common.cancel=Cancel
coser.ui.common.comment=Comment
-coser.ui.common.delete=Delete
coser.ui.common.selectAll=All
coser.ui.common.selectFile=Select\u2026
coser.ui.common.unselectAll=None
@@ -17,12 +16,16 @@
coser.ui.config.title=Configuration
coser.ui.control.confirmDeletionMessage=Are you sure you want to delete this data ?
coser.ui.control.confirmDeletionTitle=Confirm delete
+coser.ui.control.confirmDeletionsMessage=Are you sure you want to delete %d selected lines ?
+coser.ui.control.dataMenuDeleteSelected=Deleted selected lines
coser.ui.control.dataMenuLabel=Data menu
-coser.ui.control.dataMenuReplace=Replace in %s
+coser.ui.control.dataMenuReplace=Replace in %s for selection
+coser.ui.control.dataMenuReplaceAll=Replace in %s in all data
coser.ui.control.deleteLine=Delete line
coser.ui.control.global.done=\u2026
-coser.ui.control.global.level=Type
coser.ui.control.global.message=Message
+coser.ui.control.globalErrorMenuLabel=Error menu
+coser.ui.control.globalErrorMenuSelectAll=Select all lines
coser.ui.control.graph.specy=Specy \:
coser.ui.control.graphtitle=Graph
coser.ui.control.replace.find=Find \:
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-03 16:10:01 UTC (rev 158)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-03 16:11:03 UTC (rev 159)
@@ -9,7 +9,6 @@
coser.config.support.email.description=Adresse de suport pour l'envoi des erreurs
coser.ui.common.cancel=Annuler
coser.ui.common.comment=Commentaire
-coser.ui.common.delete=Supprimer
coser.ui.common.selectAll=Tous
coser.ui.common.selectFile=S\u00E9lectionner\u2026
coser.ui.common.unselectAll=Aucun
@@ -17,12 +16,16 @@
coser.ui.config.title=Configuration
coser.ui.control.confirmDeletionMessage=\u00CAtes vous s\u00FBr de vouloir supprimer cette donn\u00E9e ?
coser.ui.control.confirmDeletionTitle=Confirmation de suppression
+coser.ui.control.confirmDeletionsMessage=\u00CAtes vous s\u00FBr de vouloir supprimer les %d lignes s\u00E9lectionn\u00E9es ?
+coser.ui.control.dataMenuDeleteSelected=Supprimer les lignes s\u00E9lectionn\u00E9es
coser.ui.control.dataMenuLabel=Menu des donn\u00E9es
-coser.ui.control.dataMenuReplace=Remplacer dans %s
+coser.ui.control.dataMenuReplace=Remplacer dans %s pour la s\u00E9lection
+coser.ui.control.dataMenuReplaceAll=Replacer dans %s pour toutes les lignes
coser.ui.control.deleteLine=Supprimer la ligne
coser.ui.control.global.done=\u2026
-coser.ui.control.global.level=Type
coser.ui.control.global.message=Message
+coser.ui.control.globalErrorMenuLabel=Menu des erreurs
+coser.ui.control.globalErrorMenuSelectAll=S\u00E9lectionner toutes les lignes
coser.ui.control.graph.specy=Esp\u00E8ces \:
coser.ui.control.graphtitle=Graphique
coser.ui.control.replace.find=Chercher \:
1
0
r158 - trunk/coser-business/src/test/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 16:10:01 +0000 (Wed, 03 Nov 2010)
New Revision: 158
Log:
Selection de l'espece sur laquelle porte le graphique.
Changement du type de graphique en ligne (xy).
Ajoute de la deuxieme s?\195?\169rie taille sur le graphique des captures.
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java 2010-11-03 16:07:52 UTC (rev 157)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java 2010-11-03 16:10:01 UTC (rev 158)
@@ -45,6 +45,7 @@
* Last update : $Date$
* By : $Author$
*/
+ at Ignore
public class ChartServiceTest extends CoserTestAbstract {
protected ProjectService projectService;
1
0
Author: chatellier
Date: 2010-11-03 16:07:52 +0000 (Wed, 03 Nov 2010)
New Revision: 157
Log:
Add license header
Modified:
trunk/src/site/rst/user/validation.rst
Modified: trunk/src/site/rst/user/validation.rst
===================================================================
--- trunk/src/site/rst/user/validation.rst 2010-11-03 16:02:00 UTC (rev 156)
+++ trunk/src/site/rst/user/validation.rst 2010-11-03 16:07:52 UTC (rev 157)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * Coser
+.. *
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2010 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%
+.. -
Validation
==========
1
0
r156 - in trunk/coser-business/src/main: java/fr/ifremer/coser/services resources/i18n
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 16:02:00 +0000 (Wed, 03 Nov 2010)
New Revision: 156
Log:
Modification du message d'erreur concernant le s?\195?\169parateur
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties
trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2010-11-03 13:49:04 UTC (rev 155)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2010-11-03 16:02:00 UTC (rev 156)
@@ -102,8 +102,8 @@
// check header
String[] line = csvReader.readNext();
if (line == null || line.length <= 1) {
- throw new CoserBusinessException(_("Can't read file '%s'. Check CSV file separator (%c)",
- file.getAbsolutePath(), CoserConstants.CSV_SEPARATOR_CHAR));
+ throw new CoserBusinessException(_("Can't read file '%s'. Check CSV file separator",
+ file.getAbsolutePath()));
}
else {
if (originalLoading) {
Modified: trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-11-03 13:49:04 UTC (rev 155)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-11-03 16:02:00 UTC (rev 156)
@@ -2,7 +2,7 @@
Can't\ create\ project=
Can't\ find\ line\ %s\ for\ deletion=
Can't\ find\ line\ %s\ for\ undeletion=
-Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator\ (%c)=
+Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator=
Can't\ replace\ data\ value.\ Expected\ %s\ but\ was\ %s=
Depth\ attribute\ is\ not\ a\ valid\ double=
Maturity\ attribute\ is\ required=
Modified: trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-11-03 13:49:04 UTC (rev 155)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-11-03 16:02:00 UTC (rev 156)
@@ -2,7 +2,7 @@
Can't\ create\ project=Impossible de cr\u00E9er le projet
Can't\ find\ line\ %s\ for\ deletion=
Can't\ find\ line\ %s\ for\ undeletion=
-Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator\ (%c)=Impossible de lire le fichier '%s'.\nMerci de v\u00E9rifier le s\u00E9parateur utilis\u00E9 (%c).
+Can't\ read\ file\ '%s'.\ Check\ CSV\ file\ separator=Impossible de lire le fichier '%s'.\nMerci de v\u00E9rifier le s\u00E9parateur utilis\u00E9 est bien un point-virgule ';'
Can't\ replace\ data\ value.\ Expected\ %s\ but\ was\ %s=
Depth\ attribute\ is\ not\ a\ valid\ double=
Maturity\ attribute\ is\ required=
1
0
r155 - in trunk/coser-ui/src/main/java/fr/ifremer/coser/ui: . selection
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 13:49:04 +0000 (Wed, 03 Nov 2010)
New Revision: 155
Log:
Retrait des valeurs par defaut (tests)
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx 2010-11-03 13:45:45 UTC (rev 154)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/ProjectCreationView.jaxx 2010-11-03 13:49:04 UTC (rev 155)
@@ -67,7 +67,7 @@
<JLabel text="coser.ui.project.captureFile" />
</cell>
<cell weightx="1" fill="horizontal">
- <JTextField id="projectCapturesFileField" text="/home/chatellier/tmp/coser/rsufi/base/captures.csv" />
+ <JTextField id="projectCapturesFileField" />
</cell>
<cell>
<JButton id="projectCapturesSelectButton" text="coser.ui.common.selectFile"
@@ -79,7 +79,7 @@
<JLabel text="coser.ui.project.stratesFile" />
</cell>
<cell fill="horizontal">
- <JTextField id="projectStratesFileField" text="/home/chatellier/tmp/coser/rsufi/base/strates.csv" />
+ <JTextField id="projectStratesFileField" />
</cell>
<cell>
<JButton id="projectStratesFileSelectButton" text="coser.ui.common.selectFile"
@@ -91,7 +91,7 @@
<JLabel text="coser.ui.project.lengthFile" />
</cell>
<cell fill="horizontal">
- <JTextField id="projectLengthFileField" text="/home/chatellier/tmp/coser/rsufi/base/tailles.csv" />
+ <JTextField id="projectLengthFileField" />
</cell>
<cell>
<JButton id="projectSizeFileSelectButton" text="coser.ui.common.selectFile"
@@ -103,7 +103,7 @@
<JLabel text="coser.ui.project.traitsFile" />
</cell>
<cell fill="horizontal">
- <JTextField id="projectTraitsFileField" text="/home/chatellier/tmp/coser/rsufi/base/traits.csv" />
+ <JTextField id="projectTraitsFileField" />
</cell>
<cell>
<JButton id="projectTraitsFileSelectButton" text="coser.ui.common.selectFile"
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx 2010-11-03 13:45:45 UTC (rev 154)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionResultView.jaxx 2010-11-03 13:49:04 UTC (rev 155)
@@ -32,7 +32,7 @@
<JLabel text="coser.ui.result.extractDataLabel" />
</cell>
<cell weightx="1" fill="horizontal">
- <JTextField id="resultExtractDataField" editable="false" />
+ <JTextField id="resultExtractDataField" />
</cell>
<cell>
<JButton text="coser.ui.common.selectFile" />
1
0
r154 - in trunk: coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/resources/i18n coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
by chatellier@users.labs.libre-entreprise.org 03 Nov '10
03 Nov '10
Author: chatellier
Date: 2010-11-03 13:45:45 +0000 (Wed, 03 Nov 2010)
New Revision: 154
Log:
Selection de l'espece sur laquelle porte le graphique.
Changement du type de graphique en ligne (xy).
Ajoute de la deuxieme s?\195?\169rie taille sur le graphique des captures.
Added:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/SpecyComboModel.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ChartService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties
trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ChartService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ChartService.java 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ChartService.java 2010-11-03 13:45:45 UTC (rev 154)
@@ -25,9 +25,11 @@
package fr.ifremer.coser.services;
-import java.util.ArrayList;
+import static org.nuiton.i18n.I18n._;
+
+import java.text.NumberFormat;
+import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -38,17 +40,21 @@
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.labels.CategoryToolTipGenerator;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
+import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.AreaRenderer;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.Control;
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.data.Catch;
+import fr.ifremer.coser.data.Length;
/**
* Validation service.
@@ -69,34 +75,37 @@
this.config = config;
}
- public JFreeChart getCatchGraph(Project project, Control control) {
-
+ /**
+ * Retourne le graph de comparaison entre le nombre de capture et
+ * le nombre dans les tailles.
+ *
+ * @param project projet
+ * @param control control
+ * @param specyName sepcy name
+ * @return chart
+ */
+ public JFreeChart getCompareCatchLengthGraph(Project project, Control control, String specyName) {
+
+ // look for data (data summed over catch)
+ SortedMap<String, Double> catchForYears = new TreeMap<String, Double>();
Iterator<String[]> itCatchData = control.getCatch().iterator();
itCatchData.next(); // header
-
- // look for data (data summed)
- SortedMap<String, Double> dataForYears = new TreeMap<String, Double>();
- String species = null;
while (itCatchData.hasNext()) {
String[] tuple = itCatchData.next();
-
- if (species == null) {
- species = tuple[Catch.INDEX_SPECIES];
- }
- if (species.equals(tuple[Catch.INDEX_SPECIES])) {
+ if (specyName.equals(tuple[Catch.INDEX_SPECIES])) {
String year = tuple[Catch.INDEX_YEAR];
String nombreValue = tuple[Catch.INDEX_NUMBER];
try {
Double nombreDouble = Double.valueOf(nombreValue);
- if (dataForYears.containsKey(year)) {
- Double oldValue = dataForYears.get(year);
+ if (catchForYears.containsKey(year)) {
+ Double oldValue = catchForYears.get(year);
Double newValue = oldValue + nombreDouble;
- dataForYears.put(year, newValue);
+ catchForYears.put(year, newValue);
}
else {
- dataForYears.put(year, nombreDouble);
+ catchForYears.put(year, nombreDouble);
}
}
catch (NumberFormatException ex) {
@@ -107,43 +116,72 @@
}
}
- List<SortedMap<String, Double>> results = new ArrayList<SortedMap<String,Double>>();
- results.add(dataForYears);
+ // look for data (data summed over length)
+ SortedMap<String, Double> lengthForYears = new TreeMap<String, Double>();
+ Iterator<String[]> itLengthData = control.getLength().iterator();
+ itLengthData.next(); // header
+ while (itLengthData.hasNext()) {
+ String[] tuple = itLengthData.next();
+ if (specyName.equals(tuple[Length.INDEX_SPECIES])) {
+ String year = tuple[Length.INDEX_YEAR];
+ String nombreValue = tuple[Length.INDEX_NUMBER];
+ try {
+ Double nombreDouble = Double.valueOf(nombreValue);
+
+ if (lengthForYears.containsKey(year)) {
+ Double oldValue = lengthForYears.get(year);
+ Double newValue = oldValue + nombreDouble;
+ lengthForYears.put(year, newValue);
+ }
+ else {
+ lengthForYears.put(year, nombreDouble);
+ }
+ }
+ catch (NumberFormatException ex) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse " + nombreValue + " as double");
+ }
+ }
+ }
+ }
+
+ Map<String, SortedMap<String, Double>> results = new HashMap<String, SortedMap<String,Double>>();
+ results.put(_(Category.CATCH.getTranslationKey()), catchForYears);
+ results.put(_(Category.LENGTH.getTranslationKey()), lengthForYears);
JFreeChart chart = displayGraph(results);
return chart;
}
- protected JFreeChart displayGraph(List<SortedMap<String, Double>> results) {
-
+ protected JFreeChart displayGraph(Map<String, SortedMap<String, Double>> resultSeries) {
+
// create a chart with the dataset
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- for (Map<String, Double> map : results) {
- for (Map.Entry<String, Double> data : map.entrySet()) {
- dataset.setValue(data.getValue(), "Capture campagne", data.getKey());
+ for (Map.Entry<String, SortedMap<String, Double>> resultSerie : resultSeries.entrySet()) {
+ for (Map.Entry<String, Double> data : resultSerie.getValue().entrySet()) {
+ dataset.setValue(data.getValue(), resultSerie.getKey(), data.getKey());
}
}
-
- CategoryAxis categoryAxis = new CategoryAxis("Année");
+
+ CategoryAxis categoryAxis = new CategoryAxis(_("coser.business.common.year"));
categoryAxis.setCategoryMargin(0);
// label horizontaux
//categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- ValueAxis valueAxis = new NumberAxis("Nombre");
+ ValueAxis valueAxis = new NumberAxis(_("coser.business.common.number"));
valueAxis.setUpperMargin(0.1);
- //XYSplineRenderer renderer = new XYSplineRenderer();
- //AreaRenderer renderer = new AreaRenderer();
- //StackedBarRenderer renderer = new StackedBarRenderer();
-
- CategoryItemRenderer renderer = new AreaRenderer();
+ CategoryItemRenderer renderer = new LineAndShapeRenderer();
StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
renderer.setBaseItemLabelGenerator(itemLabelGenerator);
renderer.setBaseItemLabelsVisible(true);
+
+ CategoryToolTipGenerator cttg = new StandardCategoryToolTipGenerator("{0}: {2}", NumberFormat.getInstance());
+ renderer.setBaseToolTipGenerator(cttg);
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart("Captures", JFreeChart.DEFAULT_TITLE_FONT,
- plot, true);
+ JFreeChart chart = new JFreeChart(_("coser.business.chart.compareCatchLengthNumberTitle"),
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
return chart;
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-03 13:45:45 UTC (rev 154)
@@ -30,6 +30,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -801,37 +802,63 @@
List<Integer> result = new ArrayList<Integer>(years);
return result;
}
-
+
/**
+ * Get species name in project.
+ *
+ * Used in control ui (graph).
+ *
+ * @param container data container
+ * @return species
+ */
+ public List<String> getProjectSpecies(AbstractDataContainer container) {
+ List<String> result = new ArrayList<String>();
+
+ Iterator<String[]> itTuple = container.getCatch().iterator();
+ itTuple.next(); // skip header
+ while (itTuple.hasNext()) {
+ String[] tuple = itTuple.next();
+ String species = tuple[Catch.INDEX_SPECIES];
+ if (!result.contains(species)) {
+ result.add(species);
+ }
+ }
+
+ Collections.sort(result);
+ return result;
+ }
+
+ /**
* Get species name in project with data in [{@code beginYear}-{@code endYear}].
*
* Used in selection ui.
*
- * @param selection selection
- * @param beginYear begin year
- * @param endYear end year
- * @return zones
+ * @param container data container
+ * @param beginYear begin year (can be null)
+ * @param endYear end year (can be null)
+ * @return species
*/
- public List<Specy> getProjectSpecies(Selection selection, Integer beginYear, Integer endYear) {
+ public List<Specy> getProjectSpecies(AbstractDataContainer container, Integer beginYear, Integer endYear) {
SortedMap<String, Specy> result = new TreeMap<String, Specy>();
- Iterator<String[]> itTuple = selection.getCatch().iterator();
+ Iterator<String[]> itTuple = container.getCatch().iterator();
itTuple.next(); // skip header
while (itTuple.hasNext()) {
String[] tuple = itTuple.next();
+ String species = tuple[Catch.INDEX_SPECIES];
+
// "Campagne","Annee","Trait","Espece","Nombre","Poids"
String annee = tuple[Catch.INDEX_YEAR];
try {
int intAnnee = Integer.parseInt(annee);
if (intAnnee >= beginYear && intAnnee <= endYear) {
- String species = tuple[Catch.INDEX_SPECIES];
if (!result.containsKey(species)) {
Specy specy = new Specy();
specy.setName(species);
result.put(species, specy);
- }
+ }
}
}
catch (NumberFormatException ex) {
Modified: trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-en_GB.properties 2010-11-03 13:45:45 UTC (rev 154)
@@ -31,6 +31,9 @@
coser.business.category.length=Length
coser.business.category.reftax.species=
coser.business.category.strata=Stata
+coser.business.chart.compareCatchLengthNumberTitle=
+coser.business.common.number=
+coser.business.common.year=
coser.business.control.error.duplicatedLine=
coser.business.control.error.minObservationCount=
coser.business.control.error.minObservationCountDetail=
Modified: trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-business/src/main/resources/i18n/coser-business-fr_FR.properties 2010-11-03 13:45:45 UTC (rev 154)
@@ -31,6 +31,9 @@
coser.business.category.length=Tailles
coser.business.category.reftax.species=Reftax (esp\u00E8ce)
coser.business.category.strata=Strates
+coser.business.chart.compareCatchLengthNumberTitle=Comparaison des nombre dans Capture et Taille
+coser.business.common.number=Nombre
+coser.business.common.year=Ann\u00E9e
coser.business.control.error.duplicatedLine=Ligne en doublon
coser.business.control.error.minObservationCount=Nombre minimal d'observation non atteint
coser.business.control.error.minObservationCountDetail=Nombre minimal d'observation non atteint (%s) \: %.2f
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ChartServiceTest.java 2010-11-03 13:45:45 UTC (rev 154)
@@ -25,9 +25,7 @@
package fr.ifremer.coser.services;
-import javax.swing.ImageIcon;
import javax.swing.JDialog;
-import javax.swing.JLabel;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
@@ -47,7 +45,6 @@
* Last update : $Date$
* By : $Author$
*/
- at Ignore
public class ChartServiceTest extends CoserTestAbstract {
protected ProjectService projectService;
@@ -62,7 +59,7 @@
@Test
public void testCatchChart() throws CoserBusinessException {
Project project = createTestProject(projectService);
- JFreeChart chart = chartService.getCatchGraph(project, project.getControl());
+ JFreeChart chart = chartService.getCompareCatchLengthGraph(project, project.getControl(), "COSER_SPECIES1");
JDialog f = new JDialog();
f.setModal(true);
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx 2010-11-03 13:45:45 UTC (rev 154)
@@ -24,8 +24,22 @@
-->
<JDialog title="coser.ui.control.graphtitle">
- <JScrollPane>
- <JPanel id="controlGraphPanel" />
- </JScrollPane>
+ <ControlHandler id="handler" javaBean="null" />
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="coser.ui.control.graph.specy"/>
+ </cell>
+ <cell fill="horizontal">
+ <SpecyComboModel id="specyComboModel" />
+ <JComboBox model="{specyComboModel}" onActionPerformed="getHandler().updateGraphSpecy(this)" />
+ </cell>
+ </row>
+ <row fill="both" weightx="1" weighty="1" columns="2">
+ <cell>
+ <JPanel id="controlGraphPanel" />
+ </cell>
+ </row>
+ </Table>
</JDialog>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-03 13:45:45 UTC (rev 154)
@@ -527,17 +527,35 @@
* @param view view
*/
public void displayGraph(ControlView view) {
- ChartService chartService = view.getContextValue(ChartService.class);
+ ProjectService projectService = view.getContextValue(ProjectService.class);
Project project = view.getContextValue(Project.class);
- JFreeChart chart = chartService.getCatchGraph(project, project.getControl());
+ List<String> species = projectService.getProjectSpecies(project.getControl());
+
ControlGraphDialog dialog = new ControlGraphDialog(view);
- dialog.getControlGraphPanel().add(new ChartPanel(chart));
+ dialog.setHandler(this);
+ dialog.getSpecyComboModel().setSpecy(species);
+ updateGraphSpecy(dialog);
dialog.pack();
dialog.setLocationRelativeTo(view);
dialog.setVisible(true);
}
/**
+ * Met a jour le graphique lorsque la selection de l'espece change.
+ *
+ * @param view view
+ */
+ public void updateGraphSpecy(ControlGraphDialog view) {
+ ChartService chartService = view.getContextValue(ChartService.class);
+ Project project = view.getContextValue(Project.class);
+ String specyName = (String)view.getSpecyComboModel().getSelectedItem();
+ JFreeChart chart = chartService.getCompareCatchLengthGraph(project, project.getControl(), specyName);
+ view.getControlGraphPanel().removeAll();
+ view.getControlGraphPanel().add(new ChartPanel(chart));
+ view.getControlGraphPanel().validate();
+ }
+
+ /**
* Valide les modifications faites sur le bean actuellement edité.
*
* @param view view
Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/SpecyComboModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/SpecyComboModel.java (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/SpecyComboModel.java 2010-11-03 13:45:45 UTC (rev 154)
@@ -0,0 +1,97 @@
+/*
+ * #%L
+ * Coser :: UI
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 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.coser.ui.control;
+
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+
+/**
+ * Model de selection d'especu utilise sur la dialog de graph pour
+ * changer l'espece sur laquelle le graphique porte.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class SpecyComboModel extends AbstractListModel implements ComboBoxModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -4769109927915812519L;
+
+ protected List<String> species;
+
+ protected Object selectedItem;
+
+ public void setSpecy(List<String> species) {
+ this.species = species;
+ selectedItem = species.get(0);
+ fireContentsChanged(this, 0, species.size());
+ }
+
+ /*
+ * @see javax.swing.ListModel#getSize()
+ */
+ @Override
+ public int getSize() {
+ int result = 0;
+ if (species != null) {
+ result = species.size();
+ }
+ return result;
+ }
+
+ /*
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+ @Override
+ public Object getElementAt(int index) {
+ return species.get(index);
+ }
+
+ public int getIndexOf(Object o) {
+ return species.indexOf(o);
+ }
+
+ /*
+ * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object)
+ */
+ @Override
+ public void setSelectedItem(Object anItem) {
+ this.selectedItem = anItem;
+ }
+
+ /*
+ * @see javax.swing.ComboBoxModel#getSelectedItem()
+ */
+ @Override
+ public Object getSelectedItem() {
+ return selectedItem;
+ }
+}
Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/SpecyComboModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-en_GB.properties 2010-11-03 13:45:45 UTC (rev 154)
@@ -23,6 +23,7 @@
coser.ui.control.global.done=\u2026
coser.ui.control.global.level=Type
coser.ui.control.global.message=Message
+coser.ui.control.graph.specy=Specy \:
coser.ui.control.graphtitle=Graph
coser.ui.control.replace.find=Find \:
coser.ui.control.replace.inField=In field \:
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-03 11:27:39 UTC (rev 153)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui-fr_FR.properties 2010-11-03 13:45:45 UTC (rev 154)
@@ -23,6 +23,7 @@
coser.ui.control.global.done=\u2026
coser.ui.control.global.level=Type
coser.ui.control.global.message=Message
+coser.ui.control.graph.specy=Esp\u00E8ces \:
coser.ui.control.graphtitle=Graphique
coser.ui.control.replace.find=Chercher \:
coser.ui.control.replace.inField=Dans le champ \:
1
0