Tutti-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
- 4058 discussions
04 Dec '12
Author: tchemit
Date: 2012-12-05 00:32:56 +0100 (Wed, 05 Dec 2012)
New Revision: 29
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/29
Log:
introduce a package for each trait catches
save trait species specific fields
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -119,7 +119,14 @@
protected Float averageBottomSalinity;
+ protected Float speciesTotalWeight;
+ protected Float speciesTotalVracWeight;
+
+ protected Float speciesSampleVracWeight;
+
+ protected Float speciesTotalHorsVracWeight;
+
public CampaignBean getCampaign() {
return campaign;
}
@@ -431,4 +438,36 @@
public void setAverageBottomSalinity(Float averageBottomSalinity) {
this.averageBottomSalinity = averageBottomSalinity;
}
+
+ public Float getSpeciesTotalWeight() {
+ return speciesTotalWeight;
+ }
+
+ public void setSpeciesTotalWeight(Float speciesTotalWeight) {
+ this.speciesTotalWeight = speciesTotalWeight;
+ }
+
+ public Float getSpeciesTotalVracWeight() {
+ return speciesTotalVracWeight;
+ }
+
+ public void setSpeciesTotalVracWeight(Float speciesTotalVracWeight) {
+ this.speciesTotalVracWeight = speciesTotalVracWeight;
+ }
+
+ public Float getSpeciesSampleVracWeight() {
+ return speciesSampleVracWeight;
+ }
+
+ public void setSpeciesSampleVracWeight(Float speciesSampleVracWeight) {
+ this.speciesSampleVracWeight = speciesSampleVracWeight;
+ }
+
+ public Float getSpeciesTotalHorsVracWeight() {
+ return speciesTotalHorsVracWeight;
+ }
+
+ public void setSpeciesTotalHorsVracWeight(Float speciesTotalHorsVracWeight) {
+ this.speciesTotalHorsVracWeight = speciesTotalHorsVracWeight;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.entities.CampaignBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
@@ -137,7 +138,7 @@
CampaignBean bean = model.toBean();
CampaignBean saved;
- if (model.isCreate()) {
+ if (TuttiBeans.isNew(bean)) {
saved = persistenceService.createCampaign(bean);
} else {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -25,6 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.SurveyBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
@@ -120,7 +121,7 @@
SurveyBean bean = model.toBean();
SurveyBean saved;
- if (model.isCreate()) {
+ if (TuttiBeans.isNew(bean)) {
saved = persistenceService.createSurvey(bean);
} else {
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.benthos.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.benthos.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public BenthosTabUI(CatchesUI parentUI) {
- BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <BenthosTabUIHandler id='handler'
- initializer='getContextValue(BenthosTabUIHandler.class)'/>
-
- <BenthosTabUIModel id='model'
- initializer='getContextValue(BenthosTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
-
- private final BenthosTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- BenthosTabUIModel model = new BenthosTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- BenthosTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected BenthosTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- BenthosTabUIModel model = ui.getModel();
-
- List<TraitBenthosCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitBenthosCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitBenthosCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitBenthosCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- BenthosTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(BenthosTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public BenthosTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.captureAccidentel.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.captureAccidentel.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<CaptureAccidentelTabUIModel, CaptureAccidentelTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public CaptureAccidentelTabUI(CatchesUI parentUI) {
- CaptureAccidentelTabUIHandler handler = new CaptureAccidentelTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <CaptureAccidentelTabUIHandler id='handler'
- initializer='getContextValue(CaptureAccidentelTabUIHandler.class)'/>
-
- <CaptureAccidentelTabUIModel id='model'
- initializer='getContextValue(CaptureAccidentelTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTabUIHandler extends AbstractTuttiUIHandler<CaptureAccidentelTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CaptureAccidentelTabUIHandler.class);
-
- private final CaptureAccidentelTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public CaptureAccidentelTabUIHandler(CatchesUI parentUi, CaptureAccidentelTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- CaptureAccidentelTabUIModel model = new CaptureAccidentelTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final CaptureAccidentelTableModel tableModel = new CaptureAccidentelTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(CaptureAccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- CaptureAccidentelTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected CaptureAccidentelTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- CaptureAccidentelTabUIModel model = ui.getModel();
-
- List<TraitCaptureAccidentelCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitCaptureAccidentelCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitCaptureAccidentelCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- CaptureAccidentelTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(CaptureAccidentelTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class CaptureAccidentelTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public CaptureAccidentelTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -54,7 +54,7 @@
enabled:{model.getSelectedTrait() != null};
}
-#captureAccidentelTab {
+#accidentelTab {
enabled:{model.getSelectedTrait() != null};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -28,6 +28,10 @@
fr.ifremer.tutti.persistence.entities.TraitBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -84,8 +88,8 @@
<tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
<MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
</tab>
- <tab id='captureAccidentelTab' title='tutti.label.tab.captureAccidentel'>
- <CaptureAccidentelTabUI id='captureAccidentelTabContent' constructorParams='this'/>
+ <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
+ <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
</tab>
<tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
<JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -120,6 +120,9 @@
// ui will be saved so we do not want to keep selected tab indexes
ui.getTabPane().setSelectedIndex(0);
ui.getTraitTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // when quitting ui, let's de-select trait (will save any changes)
+ selectTrait(null);
}
@Override
@@ -156,7 +159,7 @@
ui.getBenthosTabContent().selectTrait(selectedTrait);
ui.getPlanctonTabContent().selectTrait(selectedTrait);
ui.getMacroDechetTabContent().selectTrait(selectedTrait);
- ui.getCaptureAccidentelTabContent().selectTrait(selectedTrait);
+ ui.getAccidentelTabContent().selectTrait(selectedTrait);
// repaint tabs
ui.getTabPane().repaint();
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.macroDechet.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.macroDechet.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public MacroDechetTabUI(CatchesUI parentUI) {
- MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <MacroDechetTabUIHandler id='handler'
- initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
-
- <MacroDechetTabUIModel id='model'
- initializer='getContextValue(MacroDechetTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
-
- private final MacroDechetTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- MacroDechetTabUIModel model = new MacroDechetTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- MacroDechetTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected MacroDechetTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- MacroDechetTabUIModel model = ui.getModel();
-
- List<TraitMacroDechetCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitMacroDechetCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitMacroDechetCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitMacroDechetCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- MacroDechetTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(MacroDechetTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public MacroDechetTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.plancton.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.plancton.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,100 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public PlanctonTabUI(CatchesUI parentUI) {
- PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <PlanctonTabUIHandler id='handler'
- initializer='getContextValue(PlanctonTabUIHandler.class)'/>
-
- <PlanctonTabUIModel id='model'
- initializer='getContextValue(PlanctonTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
-
- private final PlanctonTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- PlanctonTabUIModel model = new PlanctonTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- PlanctonTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected PlanctonTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- PlanctonTabUIModel model = ui.getModel();
-
- List<TraitPlanctonCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<TraitPlanctonCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<TraitPlanctonCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitPlanctonCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- PlanctonTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(PlanctonTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public PlanctonTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.captureAccidentel.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.captureAccidentel.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public AccidentelTabUI(CatchesUI parentUI) {
+ AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <AccidentelTabUIHandler id='handler'
+ initializer='getContextValue(AccidentelTabUIHandler.class)'/>
+
+ <AccidentelTabUIModel id='model'
+ initializer='getContextValue(AccidentelTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIHandler extends AbstractTuttiUIHandler<AccidentelTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(AccidentelTabUIHandler.class);
+
+ private final AccidentelTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public AccidentelTabUIHandler(CatchesUI parentUi, AccidentelTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ AccidentelTabUIModel model = new AccidentelTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final AccidentelTableModel tableModel = new AccidentelTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ AccidentelTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected AccidentelTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ AccidentelTabUIModel model = ui.getModel();
+
+ List<TraitCaptureAccidentelCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitCaptureAccidentelCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitCaptureAccidentelCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ AccidentelTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(AccidentelTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.accidentel;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public AccidentelTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.benthos.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.benthos.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public BenthosTabUI(CatchesUI parentUI) {
+ BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosTabUIHandler id='handler'
+ initializer='getContextValue(BenthosTabUIHandler.class)'/>
+
+ <BenthosTabUIModel id='model'
+ initializer='getContextValue(BenthosTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
+
+ private final BenthosTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ BenthosTabUIModel model = new BenthosTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ BenthosTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected BenthosTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ BenthosTabUIModel model = ui.getModel();
+
+ List<TraitBenthosCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitBenthosCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitBenthosCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitBenthosCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ BenthosTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(BenthosTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public BenthosTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.macroDechet.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.macroDechet.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroDechetTabUI(CatchesUI parentUI) {
+ MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroDechetTabUIHandler id='handler'
+ initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
+
+ <MacroDechetTabUIModel id='model'
+ initializer='getContextValue(MacroDechetTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
+
+ private final MacroDechetTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ MacroDechetTabUIModel model = new MacroDechetTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ MacroDechetTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected MacroDechetTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ MacroDechetTabUIModel model = ui.getModel();
+
+ List<TraitMacroDechetCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitMacroDechetCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitMacroDechetCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitMacroDechetCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ MacroDechetTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(MacroDechetTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.macrodechet;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public MacroDechetTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.plancton.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.plancton.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.TraitBean
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanctonTabUI(CatchesUI parentUI) {
+ PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanctonTabUIHandler id='handler'
+ initializer='getContextValue(PlanctonTabUIHandler.class)'/>
+
+ <PlanctonTabUIModel id='model'
+ initializer='getContextValue(PlanctonTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
+
+ private final PlanctonTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ PlanctonTabUIModel model = new PlanctonTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ PlanctonTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected PlanctonTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ PlanctonTabUIModel model = ui.getModel();
+
+ List<TraitPlanctonCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitPlanctonCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitPlanctonCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitPlanctonCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ PlanctonTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(PlanctonTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches.plancton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public PlanctonTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.TraitBean;
import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
import fr.ifremer.tutti.persistence.entities.referential.SexBean;
@@ -66,13 +65,6 @@
public static final String PROPERTY_COMMENT = "comment";
/**
- * When catch was observed.
- *
- * @since 0.2
- */
- protected TraitBean trait;
-
- /**
* Species observed.
*
* @since 0.2
@@ -149,14 +141,6 @@
*/
protected String comment;
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-
public SpeciesBean getSpecies() {
return species;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 23:32:56 UTC (rev 29)
@@ -25,11 +25,8 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
+
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
@@ -41,8 +38,6 @@
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
javax.swing.ListSelectionModel
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
java.awt.Color
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -90,14 +90,16 @@
private final PersistenceService persistenceService;
- private final BeanMonitor monitor;
+ private final BeanMonitor rowMonitor;
+ private final BeanMonitor traitMonitor;
+
public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
- monitor = new BeanMonitor(
+ rowMonitor = new BeanMonitor(
SpeciesCatchEntryModel.PROPERTY_SPECIES,
SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC,
@@ -109,6 +111,12 @@
SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT,
SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO,
SpeciesCatchEntryModel.PROPERTY_COMMENT);
+ traitMonitor = new BeanMonitor(
+ SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
+ );
}
@Override
@@ -116,6 +124,8 @@
SpeciesTabUIModel model = new SpeciesTabUIModel();
ui.setContextValue(model);
+
+ traitMonitor.setBean(model);
}
@Override
@@ -170,13 +180,19 @@
log.info("New selected row: " + selectedRow);
}
- SpeciesCatchEntryModel entry =
- tableModel.getEntry(selectedRow);
+ SpeciesCatchEntryModel entry;
+ if (selectedRow == -1) {
+ // no selection
+ entry = null;
+ } else {
+ entry = tableModel.getEntry(selectedRow);
+ }
+
if (log.isInfoEnabled()) {
log.info("Will monitor entry: " + entry);
}
- monitor.setBean(entry);
+ rowMonitor.setBean(entry);
}
}
});
@@ -185,9 +201,15 @@
public void saveSelectedRowIfRequired(FocusEvent event) {
Component oppositeComponent = event.getOppositeComponent();
- JXTable parentContainer = SwingUtil.getParentContainer(
- oppositeComponent, JXTable.class);
+ JXTable parentContainer = null;
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
if (parentContainer == null) {
// out of the table can save
@@ -197,12 +219,12 @@
public void saveSelectedRowIfRequired() {
- SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) monitor.getBean();
+ SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) rowMonitor.getBean();
if (bean != null) {
// there is a bean attached to the monitor
- if (monitor.wasModified()) {
+ if (rowMonitor.wasModified()) {
// monitored bean was modified, save it
if (log.isInfoEnabled()) {
@@ -211,8 +233,11 @@
TraitSpeciesCatchBean catchBean = bean.toBean();
- TraitBean trait = parentUi.getModel().getSelectedTrait();
+ TraitBean trait = getModel().getTrait();
catchBean.setTrait(trait);
+ if (log.isInfoEnabled()) {
+ log.info("Selected trait: " + trait.getId());
+ }
if (TuttiBeans.isNew(catchBean)) {
@@ -223,7 +248,7 @@
}
// clear modified flag on the monitor
- monitor.clearModified();
+ rowMonitor.clearModified();
}
}
}
@@ -234,58 +259,68 @@
public void selectTrait(TraitBean bean) {
+ if (traitMonitor.wasModified()) {
+
+ // previous trait was modified, let's save it
+ SpeciesTabUIModel traitMonitorBean =
+ (SpeciesTabUIModel) traitMonitor.getBean();
+
+ TraitBean traitBean = traitMonitorBean.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Trait " + traitBean.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveTrait(traitBean);
+ }
+
// make sure selection is empty (will remove bean from monitor)
ui.getTable().clearSelection();
boolean empty = bean == null;
- SpeciesTabUIModel model = ui.getModel();
+ SpeciesTabUIModel model = getModel();
List<SpeciesCatchEntryModel> rows;
if (empty) {
rows = null;
bean = new TraitBean();
+ model.setTrait(null);
} else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species catches for trait: " + bean.getId());
+ }
List<TraitSpeciesCatchBean> catches =
persistenceService.getAllTraitSpeciesCatch(bean.getId());
rows = Lists.newArrayList();
for (TraitSpeciesCatchBean aCatch : catches) {
SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel();
- entry.setTrait(bean);
entry.fromBean(aCatch);
rows.add(entry);
}
+ model.setTrait(bean);
}
model.fromBean(bean);
- model.setCatches(rows);
+ model.setRows(rows);
+
//monitor.setBean(null);
rows = model.getRows();
- monitor.setBean(rows.get(0));
+ rowMonitor.setBean(rows.get(0));
+ traitMonitor.clearModified();
}
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
@Override
protected SpeciesTabUIModel getModel() {
return ui.getModel();
}
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-
protected TableColumnModel createTableColumnModel(JXTable table) {
KeyListener keyAdapter = createTableKeyListener(getModel(), table);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 23:32:56 UTC (rev 29)
@@ -30,7 +30,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
import java.util.List;
@@ -57,6 +58,8 @@
public static final String PROPERTY_NEW_ROW = "newRow";
+ protected TraitBean trait;
+
protected Float totalWeight;
protected Float totalVracWeight;
@@ -72,6 +75,28 @@
*/
protected List<SpeciesCatchEntryModel> rows;
+ protected final Binder<TraitBean, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(TraitBean.class, SpeciesTabUIModel.class)
+ .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
+ .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
+ .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
+ .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT)
+ .toBinder();
+
+ protected final Binder<SpeciesTabUIModel, TraitBean> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, TraitBean.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
+ .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
+ .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
+ .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
+ .toBinder();
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
public Float getTotalWeight() {
return totalWeight;
}
@@ -120,7 +145,7 @@
return rows;
}
- public void setCatches(List<SpeciesCatchEntryModel> rows) {
+ public void setRows(List<SpeciesCatchEntryModel> rows) {
Object oldValue = getRowCount();
if (rows == null) {
rows = Lists.newArrayList();
@@ -142,15 +167,17 @@
}
public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- SpeciesTabUIModel.class).copy(bean, this);
+
+ fromBeanBinder.copy(bean, this);
}
public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(SpeciesTabUIModel.class,
- TraitBean.class).copy(this, result);
+ TraitBean result = trait;
+ toBeanBinder.copy(this, result);
return result;
}
+ public String getId() {
+ return trait == null ? null : trait.getId();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:31:44 UTC (rev 28)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 23:32:56 UTC (rev 29)
@@ -64,8 +64,8 @@
tutti.label.survey=Série de campagne
tutti.label.survey.name=Nom
tutti.label.survey.zone=Zone
+tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
-tutti.label.tab.captureAccidentel=Captures accidentelles
tutti.label.tab.macroDechet=Macro déchets
tutti.label.tab.observationIndividuel=Observations individuelles
tutti.label.tab.plancton=Plancton
1
0
r28 - in trunk: tutti-service/src/main/java/fr/ifremer/tutti/service tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing
by tchemit@users.forge.codelutin.com 04 Dec '12
by tchemit@users.forge.codelutin.com 04 Dec '12
04 Dec '12
Author: tchemit
Date: 2012-12-05 00:31:44 +0100 (Wed, 05 Dec 2012)
New Revision: 28
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/28
Log:
fix service closes
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-12-04 17:59:54 UTC (rev 27)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2012-12-04 23:31:44 UTC (rev 28)
@@ -88,20 +88,6 @@
}
}
- public <S extends TuttiService> void closeService(S service) throws IOException {
-
- services.invalidate(service.getClass());
-
- if (log.isInfoEnabled()) {
- log.info("Close service " + service);
- }
- service.close();
- }
-
- public void open() {
- //TODO
- }
-
@Override
public void close() throws IOException {
@@ -111,6 +97,6 @@
}
IOUtils.closeQuietly(service);
}
- services.cleanUp();
+ services.invalidateAll();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 17:59:54 UTC (rev 27)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-04 23:31:44 UTC (rev 28)
@@ -185,8 +185,6 @@
public void open() {
- serviceContext.open();
-
if (surveyId == null) {
// load it from config
1
0
04 Dec '12
Author: tchemit
Date: 2012-12-04 18:59:54 +0100 (Tue, 04 Dec 2012)
New Revision: 27
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/27
Log:
introduce species package + save species catches batches
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -107,6 +107,8 @@
TraitBean getTrait(String traitId);
+ TraitSpeciesCatchBean getTraitSpeciesCatch(String id);
+
SurveyBean createSurvey(SurveyBean bean);
SurveyBean saveSurvey(SurveyBean bean);
@@ -119,4 +121,8 @@
TraitBean saveTrait(TraitBean bean);
+ TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+
+ TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean);
+
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -34,7 +34,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware {
private static final long serialVersionUID = 1L;
@@ -115,6 +115,13 @@
*/
protected Float elevationRatio;
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
public TraitBean getTrait() {
return trait;
}
@@ -139,14 +146,6 @@
this.speciesToConfirm = speciesToConfirm;
}
- public boolean isSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(boolean speciesToConfirm) {
- this.speciesToConfirm = speciesToConfirm;
- }
-
public VracHorsVracEnum getVracHorsVrac() {
return vracHorsVrac;
}
@@ -210,4 +209,12 @@
public void setElevationRatio(Float elevationRatio) {
this.elevationRatio = elevationRatio;
}
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -37,6 +37,10 @@
*/
public class TuttiBeans {
+ public static <B extends AbstractTuttiBean> boolean isNew(B bean) {
+ return bean.getId() == null;
+ }
+
public static <B extends AbstractTuttiBean> Predicate<B> newIdPredicate(String id) {
return new IdPredicate<B>(id);
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -277,6 +277,12 @@
}
@Override
+ public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
+ TraitSpeciesCatchBean result = TuttiBeans.findById(getData(TraitSpeciesCatchBean.class), id);
+ return result;
+ }
+
+ @Override
public SurveyBean createSurvey(SurveyBean bean) {
SurveyBean result = new SurveyBean();
persist(SurveyBean.class, bean, result);
@@ -318,6 +324,20 @@
return result;
}
+ @Override
+ public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
+ persist(TraitSpeciesCatchBean.class, bean, result);
+ return result;
+ }
+
+ @Override
+ public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ TraitSpeciesCatchBean result = getTraitSpeciesCatch(bean.getId());
+ persist(TraitSpeciesCatchBean.class, bean, result);
+ return result;
+ }
+
protected <B extends AbstractTuttiBean> void persist(Class<B> beanType,
B source, B target) {
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -256,6 +256,12 @@
}
@Override
+ public TraitSpeciesCatchBean getTraitSpeciesCatch(String id) {
+ checkDriverExists();
+ return driver.getTraitSpeciesCatch(id);
+ }
+
+ @Override
public SurveyBean createSurvey(SurveyBean bean) {
checkDriverExists();
return driver.createSurvey(bean);
@@ -291,6 +297,18 @@
return driver.saveTrait(bean);
}
+ @Override
+ public TraitSpeciesCatchBean createTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ checkDriverExists();
+ return driver.createTraitSpeciesCatch(bean);
+ }
+
+ @Override
+ public TraitSpeciesCatchBean saveTraitSpeciesCatch(TraitSpeciesCatchBean bean) {
+ checkDriverExists();
+ return driver.saveTraitSpeciesCatch(bean);
+ }
+
protected void checkDriverExists() {
Preconditions.checkNotNull(
driver,
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -270,6 +270,17 @@
jlist.setSelectedIndices(result);
}
+ protected <O> Decorator<O> getDecorator(Class<O> type, String name) {
+ DecoratorService decoratorService =
+ context.getService(DecoratorService.class);
+
+ Preconditions.checkNotNull(type);
+
+ Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
+ Preconditions.checkNotNull(decorator);
+ return decorator;
+ }
+
protected <O> ListCellRenderer newListCellRender(Class<O> type) {
return newListCellRender(type, null);
@@ -277,15 +288,15 @@
protected <O> ListCellRenderer newListCellRender(Class<O> type, String name) {
- DecoratorService decoratorService =
- context.getService(DecoratorService.class);
+ Decorator<O> decorator = getDecorator(type, name);
+ return newListCellRender(decorator);
+ }
- Preconditions.checkNotNull(type);
+ protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) {
- Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
Preconditions.checkNotNull(decorator);
- DecoratorListCellRenderer result = new DecoratorListCellRenderer(decorator);
+ ListCellRenderer result = new DecoratorListCellRenderer(decorator);
return result;
}
@@ -296,12 +307,14 @@
protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
- DecoratorService decoratorService =
- context.getService(DecoratorService.class);
+ Decorator<O> decorator = getDecorator(type, name);
- Preconditions.checkNotNull(type);
+ TableCellRenderer result = newTableCellRender(decorator);
+ return result;
+ }
- Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
+ protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+
Preconditions.checkNotNull(decorator);
DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -26,11 +26,14 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
+import fr.ifremer.tutti.ui.swing.util.TuttiColorHighlighter;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.nuiton.util.FileUtil;
import javax.swing.Action;
@@ -41,6 +44,7 @@
import javax.swing.JRootPane;
import javax.swing.KeyStroke;
import javax.swing.UIManager;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
@@ -242,4 +246,12 @@
throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
}
}
+
+ public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, false);
+ }
+
+ public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, true);
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -26,7 +26,9 @@
<import>
fr.ifremer.tutti.persistence.entities.TraitBean
+
fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,83 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.fishes.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightLabel {
- text:"tutti.label.fishes.totalVracWeight";
- labelFor:{totalVracWeightField};
-}
-
-#totalVracWeightField {
- property:"totalVracWeight";
- model:{model.getTotalVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightLabel {
- text:"tutti.label.fishes.sampleVracWeight";
- labelFor:{sampleVracWeightField};
-}
-
-#sampleVracWeightField {
- property:"sampleVracWeight";
- model:{model.getSampleVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightLabel {
- text:"tutti.label.fishes.totalHorsVracWeight";
- labelFor:{totalHorsVracWeightField};
-}
-
-#totalHorsVracWeightField {
- property:"totalHorsVracWeight";
- model:{model.getTotalHorsVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,114 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.referential.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public SpeciesTabUI(CatchesUI parentUI) {
- SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <SpeciesTabUIHandler id='handler'
- initializer='getContextValue(SpeciesTabUIHandler.class)'/>
-
- <SpeciesTabUIModel id='model'
- initializer='getContextValue(SpeciesTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='totalVracWeight' component='totalVracWeightField'/>
- <field name='sampleVracWeight' component='sampleVracWeightField'/>
- <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='totalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalVracWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='sampleVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='totalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,290 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.SexBean;
-import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.EnumEditor;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
-
- private final SpeciesTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- SpeciesTabUIModel model = new SpeciesTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // Espèce à confirmer
- col = new TableColumn(0);
- col.setCellEditor(SwingUtil.newBooleanTableCellEditor(defaultRenderer));
- col.setCellRenderer(SwingUtil.newBooleanTableCellRenderer(defaultRenderer));
- col.setHeaderValue(_("tutti.table.species.header.toConfirm"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesToConfirm);
- columnModel.addColumn(col);
-
- // species (by code) column
- col = new TableColumn(1);
-
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- JComboBox speciesEditor = new JComboBox();
- speciesEditor.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
- col.setCellEditor(new ComboBoxCellEditor(speciesEditor));
- col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
- col.setHeaderValue(_("tutti.table.species.header.speciesByCode"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByCode);
- columnModel.addColumn(col);
-
- // species (by genusCode) column
- col = new TableColumn(2);
-
- JComboBox speciesEditor2 = new JComboBox();
- speciesEditor2.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
- SwingUtil.fillComboBox(speciesEditor2, allSpecies, null);
- col.setCellEditor(new ComboBoxCellEditor(speciesEditor2));
- col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
- col.setHeaderValue(_("tutti.table.species.header.speciesByGenusCode"));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByGenusCode);
- columnModel.addColumn(col);
-
- // Vrac / Hors vrac
- col = new TableColumn(3);
-
- EnumEditor<VracHorsVracEnum> vracEditor = EnumEditor.newEditor(VracHorsVracEnum.values());
-
- col.setCellEditor(new ComboBoxCellEditor(vracEditor));
-// col.setCellRenderer(SwingUtil.newEnumTableCellRenderer(defaultRenderer, VracHorsVracEnum.class));
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.vracHorsVrac"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.vracHorsVrac);
- columnModel.addColumn(col);
-
- // Catégorie de poids
- col = new TableColumn(4);
-
- JComboBox weightCategoryCombo = new JComboBox();
- weightCategoryCombo.setRenderer(newListCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
- SwingUtil.fillComboBox(weightCategoryCombo, persistenceService.getAllWeightCategories(), null);
- col.setCellEditor(new ComboBoxCellEditor(weightCategoryCombo));
- col.setCellRenderer(newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
- col.setHeaderValue(_("tutti.table.species.header.weightCategory"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weightCategory);
- columnModel.addColumn(col);
-
- // Sex
- col = new TableColumn(5);
-
- JComboBox sexCombo = new JComboBox();
- sexCombo.setRenderer(newListCellRender(SexBean.class, DecoratorService.BY_NAME));
- SwingUtil.fillComboBox(sexCombo, persistenceService.getAllSex(), null);
- col.setCellEditor(new ComboBoxCellEditor(sexCombo));
- col.setCellRenderer(newTableCellRender(SexBean.class, DecoratorService.BY_NAME));
-
- col.setHeaderValue(_("tutti.table.species.header.sex"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sex);
- columnModel.addColumn(col);
-
- // Maturity
- col = new TableColumn(6);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.maturity"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.maturity);
- columnModel.addColumn(col);
-
- // Age
- col = new TableColumn(7);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.age"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.age);
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(8);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weight);
- columnModel.addColumn(col);
-
- // Poids calculé
- col = new TableColumn(9);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.computedWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedWeight);
- columnModel.addColumn(col);
-
- // Nombre calculé
- col = new TableColumn(10);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.computedNumber"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedNumber);
- columnModel.addColumn(col);
-
- // Poids d'échantillon
- col = new TableColumn(11);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.sampleWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sampleWeight);
- columnModel.addColumn(col);
-
- // Fraction d'élévation
- col = new TableColumn(12);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.species.header.elevationRate"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier(SpeciesTableModel.ColumnIdentifier.elevationRatio);
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
- }
- });
- }
-
- @Override
- public void afterInitUI() {
- SpeciesTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- SpeciesTabUIModel model = ui.getModel();
-
- List<TraitSpeciesCatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllTraitSpeciesCatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
-
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
-
- public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
-
- public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float totalVracWeight;
-
- protected Float sampleVracWeight;
-
- protected Float totalHorsVracWeight;
-
- protected List<TraitSpeciesCatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getTotalVracWeight() {
- return totalVracWeight;
- }
-
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
- }
-
- public Float getSampleVracWeight() {
- return sampleVracWeight;
- }
-
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
- }
-
- public Float getTotalHorsVracWeight() {
- return totalHorsVracWeight;
- }
-
- public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
- Object oldValue = getTotalHorsVracWeight();
- this.totalHorsVracWeight = totalHorsVracWeight;
- firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
- }
-
- public List<TraitSpeciesCatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<TraitSpeciesCatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- SpeciesTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(SpeciesTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -1,180 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
-import jaxx.runtime.SwingUtil;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTableModel extends AbstractTableModel {
-
- public static enum ColumnIdentifier {
- speciesToConfirm,
- speciesByCode("species"),
- speciesByGenusCode("species"),
- vracHorsVrac,
- weightCategory,
- sex,
- maturity,
- age,
- weight,
- computedWeight(null),
- computedNumber(null),
- sampleWeight,
- elevationRatio;
-
- final String propertyName;
-
- ColumnIdentifier() {
- this("");
- }
-
- ColumnIdentifier(String propertyName) {
- this.propertyName = "".equals(propertyName) ? name() : propertyName;
- }
-
- public void setValue(TraitSpeciesCatchBean entry, Object value) {
- if (propertyName != null)
- TuttiUIUtil.setProperty(entry, propertyName, value);
- }
-
- public Object getValue(TraitSpeciesCatchBean entry) {
- Object result = null;
- if (propertyName != null) {
- result = TuttiUIUtil.getProperty(entry, propertyName);
- }
- return result;
- }
- }
-
- private static final long serialVersionUID = 1L;
-
- protected List<TraitSpeciesCatchBean> data;
-
- protected final List<ColumnIdentifier> columnIdentifiers;
-
- protected final TableColumn[] columns;
-
- protected final TraitSpeciesCatchBean newRow = new TraitSpeciesCatchBean();
-
- public SpeciesTableModel(TableColumnModel columnModel) {
-
- int nbcols = columnModel.getColumnCount();
- columns = new TableColumn[nbcols];
- columnIdentifiers = Lists.newArrayList();
- for (int i = 0; i < nbcols; i++) {
- TableColumn column = columnModel.getColumn(i);
- columns[i] = column;
- columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
- }
- }
-
- public void setData(List<TraitSpeciesCatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new TraitSpeciesCatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return (data == null ? 0 : data.size()) + 1;
- }
-
- @Override
- public int getColumnCount() {
- return columns.length;
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- TraitSpeciesCatchBean entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- Object result = propertyName.getValue(entry);
- return result;
- }
-
- @Override
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- TraitSpeciesCatchBean entry = getEntry(rowIndex);
- ColumnIdentifier propertyName = getPropertyName(columnIndex);
- propertyName.setValue(entry, aValue);
-
- if (propertyName == ColumnIdentifier.speciesByCode) {
-
- // update also speciesByGenusCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
-
- // update also speciesByCode column
- int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
- fireTableCellUpdated(rowIndex, otherColumnIndex);
- }
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-
- protected TraitSpeciesCatchBean getEntry(int rowIndex) {
- SwingUtil.ensureRowIndex(this, rowIndex);
- TraitSpeciesCatchBean result;
- if (data == null || rowIndex >= data.size()) {
- result = newRow;
- } else {
- result = data.get(rowIndex);
- }
- return result;
- }
-
- protected TableColumn getColumn(int columnIndex) {
- SwingUtil.ensureColumnIndex(this, columnIndex);
- return columns[columnIndex];
- }
-
- protected ColumnIdentifier getPropertyName(int columnIndex) {
- TableColumn column = getColumn(columnIndex);
- return (ColumnIdentifier) column.getIdentifier();
- }
-
- protected int getColumnIndex(ColumnIdentifier property) {
- int result = columnIdentifiers.indexOf(property);
- return result;
- }
-}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,99 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractAction;
+import javax.swing.JTable;
+
+/**
+ * Abstract action to select something in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractSelectTableAction extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractSelectTableAction.class);
+
+ private final JTable table;
+
+ private final SpeciesTabUIModel model;
+
+ public AbstractSelectTableAction(SpeciesTabUIModel model,
+ JTable table) {
+ this.model = model;
+ this.table = table;
+ }
+
+ protected void doSelectCell(int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will select cell at " +
+ getCellCoordinate(rowIndex, columnIndex));
+ }
+
+ table.editCellAt(rowIndex, columnIndex);
+ table.setColumnSelectionInterval(columnIndex, columnIndex);
+ table.setRowSelectionInterval(rowIndex, rowIndex);
+ }
+
+
+ protected int getSelectedRow() {
+ int result = table.getSelectedRow();
+ return result;
+ }
+
+ protected int getSelectedColumn() {
+ int result = table.getSelectedColumn();
+ return result;
+ }
+
+ protected int getRowCount() {
+ return table.getRowCount();
+ }
+
+ protected int getColumnCount() {
+ return table.getColumnCount();
+ }
+
+ protected boolean isCellEditable(int rowIndex, int columnIndex) {
+ return table.isCellEditable(rowIndex, columnIndex);
+ }
+
+ protected String getCellCoordinate(int rowIndex, int columnIndex) {
+ return " [" + rowIndex + ", " + columnIndex + "]";
+ }
+
+ protected SpeciesTabUIModel getModel() {
+ return model;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/AbstractSelectTableAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,104 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CatchTreeModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Root node (with no sampling on it.
+ *
+ * @since 0.2
+ */
+ protected final CatchTreeNode root;
+
+ /**
+ * Property which are used to sub sampling.
+ *
+ * @since 0.2
+ */
+ protected final String[] samplingOrder;
+
+ /**
+ * Samplings view as a linear list (to display in the table).
+ *
+ * @since 0.2
+ */
+ protected final List<CatchTreeNode> lines;
+
+ public CatchTreeModel(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ root = new CatchTreeNode();
+ lines = Lists.newArrayList();
+ }
+
+ public CatchTreeNode getNode(int rowIndex) {
+ return lines.get(rowIndex);
+ }
+
+ public int getSize() {
+ return lines.size();
+ }
+
+ public void populate(List<TraitSpeciesCatchBean> data) {
+
+ // clear tree representation
+ root.removeAllChildren();
+
+ // clear linear representation
+ lines.clear();
+ }
+
+ public Object[] getSamplingKey(TraitSpeciesCatchBean bean) {
+ List<Object> result = Lists.newArrayList();
+ for (String s : samplingOrder) {
+ Object property = TuttiUIUtil.getProperty(bean, s);
+ if (property == null) {
+ // stop findind sample key
+ break;
+ }
+ result.add(property);
+ }
+ return result.toArray();
+ }
+
+ public String[] getSamplingDefinition(TraitSpeciesCatchBean bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.io.Serializable;
+
+/**
+ * Defines a node of a species catches.
+ * <p/>
+ * UserObject is the {@link TraitSpeciesCatchBean}. It can be null on two cases:
+ * <ul>
+ * <li>On root node</li>
+ * <li>For node on a path of sampling but with no filled data </li>
+ * </ul>
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CatchTreeNode extends DefaultMutableTreeNode {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Property name defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final String samplingPropertyKey;
+
+ /**
+ * Property value defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final Serializable samplingPropertyValue;
+
+ public CatchTreeNode() {
+ this(null, null, null);
+ }
+
+ public CatchTreeNode(TraitSpeciesCatchBean userObject,
+ String samplingPropertyKey,
+ Serializable samplingPropertyValue) {
+ this.samplingPropertyKey = samplingPropertyKey;
+ this.samplingPropertyValue = samplingPropertyValue;
+ setUserObject(userObject);
+ }
+
+ public String getSamplingPropertyKey() {
+ return samplingPropertyKey;
+ }
+
+ public Serializable getSamplingPropertyValue() {
+ return samplingPropertyValue;
+ }
+
+ @Override
+ public TraitSpeciesCatchBean getUserObject() {
+ return (TraitSpeciesCatchBean) super.getUserObject();
+ }
+
+ @Override
+ public CatchTreeNode getParent() {
+ return (CatchTreeNode) super.getParent();
+ }
+
+ @Override
+ public CatchTreeNode getRoot() {
+ return (CatchTreeNode) super.getRoot();
+ }
+
+ @Override
+ public CatchTreeNode getFirstChild() {
+ return (CatchTreeNode) super.getFirstChild();
+ }
+
+ @Override
+ public CatchTreeNode getLastChild() {
+ return (CatchTreeNode) super.getLastChild();
+ }
+
+ @Override
+ public CatchTreeNode getChildAfter(TreeNode aChild) {
+ return (CatchTreeNode) super.getChildAfter(aChild);
+ }
+
+ @Override
+ public CatchTreeNode getChildBefore(TreeNode aChild) {
+ return (CatchTreeNode) super.getChildBefore(aChild);
+ }
+
+ @Override
+ public CatchTreeNode getNextSibling() {
+ return (CatchTreeNode) super.getNextSibling();
+ }
+
+ @Override
+ public CatchTreeNode getPreviousSibling() {
+ return (CatchTreeNode) super.getPreviousSibling();
+ }
+
+ @Override
+ public CatchTreeNode getFirstLeaf() {
+ return (CatchTreeNode) super.getFirstLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getLastLeaf() {
+ return (CatchTreeNode) super.getLastLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getNextLeaf() {
+ return (CatchTreeNode) super.getNextLeaf();
+ }
+
+ @Override
+ public CatchTreeNode getPreviousLeaf() {
+ return (CatchTreeNode) super.getPreviousLeaf();
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/CatchTreeNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,98 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableCellAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableCellAction.class);
+
+ public MoveToNextEditableCellAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ int rowCount = getRowCount();
+
+ while (currentRow <= rowCount || currentColumn <= columnCount) {
+
+ // go to next cell
+ currentColumn++;
+
+ // select next cell
+ if (currentColumn >= columnCount) {
+
+ // no more cell, so will move to next editable column on next row
+ currentColumn = 0;
+ currentRow++;
+
+ if (currentRow == rowCount) {
+ // create a new row in model
+ getModel().addNewCatch();
+ }
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+
+ doSelectCell(currentRow, currentColumn);
+
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableCellAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select next editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToNextEditableRowAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToNextEditableRowAction.class);
+
+ public MoveToNextEditableRowAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model, table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to next row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow++;
+
+ if (currentRow >= getRowCount()) {
+ if (log.isDebugEnabled()) {
+ log.debug("No next row");
+ }
+
+ // create a new row in model
+ getModel().addNewCatch();
+ }
+
+ doSelectCell(currentRow, currentColumn);
+
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToNextEditableRowAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable cell in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableCellAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableCellAction.class);
+
+ public MoveToPreviousEditableCellAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model,table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous editable cell, " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+
+ int columnCount = getColumnCount();
+
+ while (currentRow > 0 || currentColumn > 0) {
+
+ // go to next cell
+ currentColumn--;
+
+ // select next cell
+ if (currentColumn < 0) {
+
+ currentColumn = columnCount - 1;
+ currentRow--;
+ }
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ doSelectCell(currentRow, currentColumn);
+ break;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableCellAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,79 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JTable;
+import java.awt.event.ActionEvent;
+
+/**
+ * Action to select previous editable row in a table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MoveToPreviousEditableRowAction extends AbstractSelectTableAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(MoveToPreviousEditableRowAction.class);
+
+ public MoveToPreviousEditableRowAction(SpeciesTabUIModel model,
+ JTable table) {
+ super(model,table);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int currentRow = getSelectedRow();
+ int currentColumn = getSelectedColumn();
+
+ if (isCellEditable(currentRow, currentColumn)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Move to previous row editable cell " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ currentRow--;
+
+ if (currentRow < 0) {
+ if (log.isDebugEnabled()) {
+ log.debug("No previous row");
+ }
+ } else {
+ doSelectCell(currentRow, currentColumn);
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cell not editable at " +
+ getCellCoordinate(currentRow, currentColumn));
+ }
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/MoveToPreviousEditableRowAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,281 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * represents a row in the table
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesCatchEntryModel extends AbstractTuttiBeanUIModel {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac";
+
+ public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
+
+ public static final String PROPERTY_SEX = "sex";
+
+ public static final String PROPERTY_MATURITY = "maturity";
+
+ public static final String PROPERTY_AGE = "age";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Is catch is vrac or horsVrac?.
+ *
+ * @since 0.2
+ */
+ protected VracHorsVracEnum vracHorsVrac;
+
+ /**
+ * Weight category (can be null).
+ *
+ * @since 0.2
+ */
+ protected WeightCategoryBean weightCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected SexBean sex;
+
+ /**
+ * Maturity (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float maturity;
+
+ /**
+ * Age (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float age;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ Object oldValue = getVracHorsVrac();
+ this.vracHorsVrac = vracHorsVrac;
+ firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac);
+ }
+
+ public WeightCategoryBean getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategoryBean weightCategory) {
+ Object oldValue = getWeightCategory();
+ this.weightCategory = weightCategory;
+ firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
+ }
+
+ public SexBean getSex() {
+ return sex;
+ }
+
+ public void setSex(SexBean sex) {
+ Object oldValue = getSex();
+ this.sex = sex;
+ firePropertyChange(PROPERTY_SEX, oldValue, sex);
+ }
+
+ public Float getMaturity() {
+ return maturity;
+ }
+
+ public void setMaturity(Float maturity) {
+ Object oldValue = getMaturity();
+ this.maturity = maturity;
+ firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ Object oldValue = getAge();
+ this.age = age;
+ firePropertyChange(PROPERTY_AGE, oldValue, age);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ Object oldValue = getElevationRatio();
+ this.elevationRatio = elevationRatio;
+ firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public void fromBean(TraitSpeciesCatchBean bean) {
+ BinderFactory.newBinder(TraitSpeciesCatchBean.class,
+ SpeciesCatchEntryModel.class).copy(bean, this);
+ }
+
+ public TraitSpeciesCatchBean toBean() {
+ TraitSpeciesCatchBean result = new TraitSpeciesCatchBean();
+ BinderFactory.newBinder(SpeciesCatchEntryModel.class,
+ TraitSpeciesCatchBean.class).copy(this, result);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesCatchEntryModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,84 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.fishes.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text:"tutti.label.fishes.totalVracWeight";
+ labelFor:{totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property:"totalVracWeight";
+ model:{model.getTotalVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text:"tutti.label.fishes.sampleVracWeight";
+ labelFor:{sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property:"sampleVracWeight";
+ model:{model.getSampleVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text:"tutti.label.fishes.totalHorsVracWeight";
+ labelFor:{totalHorsVracWeightField};
+}
+
+#totalHorsVracWeightField {
+ property:"totalHorsVracWeight";
+ model:{model.getTotalHorsVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode:{ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground:{null};
+ selectionForeground:{Color.BLACK};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,120 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesTabUI(CatchesUI parentUI) {
+ SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesTabUIHandler id='handler'
+ initializer='getContextValue(SpeciesTabUIHandler.class)'/>
+
+ <SpeciesTabUIModel id='model'
+ initializer='getContextValue(SpeciesTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='totalVracWeight' component='totalVracWeightField'/>
+ <field name='sampleVracWeight' component='sampleVracWeightField'/>
+ <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='sampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='totalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,568 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.TuttiBeans;
+import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.JAXXWidgetUtil;
+import jaxx.runtime.swing.editor.EnumEditor;
+import jaxx.runtime.swing.editor.bean.BeanUIUtil;
+import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.jdesktop.swingx.table.TableColumnExt;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.JComboBox;
+import javax.swing.ListSelectionModel;
+import javax.swing.border.LineBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTableModel.ColumnIdentifier;
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+
+ private final SpeciesTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ private final BeanMonitor monitor;
+
+ public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ monitor = new BeanMonitor(
+ SpeciesCatchEntryModel.PROPERTY_SPECIES,
+ SpeciesCatchEntryModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesCatchEntryModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesCatchEntryModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesCatchEntryModel.PROPERTY_SEX,
+ SpeciesCatchEntryModel.PROPERTY_MATURITY,
+ SpeciesCatchEntryModel.PROPERTY_AGE,
+ SpeciesCatchEntryModel.PROPERTY_WEIGHT,
+ SpeciesCatchEntryModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesCatchEntryModel.PROPERTY_ELEVATION_RATIO,
+ SpeciesCatchEntryModel.PROPERTY_COMMENT);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesTabUIModel model = new SpeciesTabUIModel();
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = ui.getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel(table);
+
+ SpeciesTabUIModel model = ui.getModel();
+
+ // create table model
+ final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel, model);
+
+ // when model datas change let's propagate it
+
+ model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.refreshData((List<SpeciesCatchEntryModel>) evt.getNewValue());
+ }
+ });
+ model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_NEW_ROW, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.addNewRow((SpeciesCatchEntryModel) evt.getNewValue());
+ }
+ });
+
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!e.getValueIsAdjusting()) {
+ ListSelectionModel source = (ListSelectionModel) e.getSource();
+ int selectedRow = source.getLeadSelectionIndex();
+
+ // save selected entry if required
+ saveSelectedRowIfRequired();
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected row: " + selectedRow);
+ }
+
+ SpeciesCatchEntryModel entry =
+ tableModel.getEntry(selectedRow);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will monitor entry: " + entry);
+ }
+ monitor.setBean(entry);
+ }
+ }
+ });
+ }
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ saveSelectedRowIfRequired();
+ }
+ }
+
+ public void saveSelectedRowIfRequired() {
+
+ SpeciesCatchEntryModel bean = (SpeciesCatchEntryModel) monitor.getBean();
+ if (bean != null) {
+
+ // there is a bean attached to the monitor
+
+ if (monitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ TraitSpeciesCatchBean catchBean = bean.toBean();
+
+ TraitBean trait = parentUi.getModel().getSelectedTrait();
+ catchBean.setTrait(trait);
+
+ if (TuttiBeans.isNew(catchBean)) {
+
+ catchBean = persistenceService.createTraitSpeciesCatch(catchBean);
+ bean.setId(catchBean.getId());
+ } else {
+ persistenceService.saveTraitSpeciesCatch(catchBean);
+ }
+
+ // clear modified flag on the monitor
+ monitor.clearModified();
+ }
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ // make sure selection is empty (will remove bean from monitor)
+ ui.getTable().clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesTabUIModel model = ui.getModel();
+
+ List<SpeciesCatchEntryModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new TraitBean();
+ } else {
+ List<TraitSpeciesCatchBean> catches =
+ persistenceService.getAllTraitSpeciesCatch(bean.getId());
+ rows = Lists.newArrayList();
+ for (TraitSpeciesCatchBean aCatch : catches) {
+ SpeciesCatchEntryModel entry = new SpeciesCatchEntryModel();
+ entry.setTrait(bean);
+ entry.fromBean(aCatch);
+ rows.add(entry);
+ }
+ }
+
+ model.fromBean(bean);
+ model.setCatches(rows);
+
+ //monitor.setBean(null);
+
+ rows = model.getRows();
+ monitor.setBean(rows.get(0));
+
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ protected TableColumnModel createTableColumnModel(JXTable table) {
+
+ KeyListener keyAdapter = createTableKeyListener(getModel(), table);
+
+ {
+ NumberCellEditor<Float> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().addKeyListener(keyAdapter);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ table.setDefaultEditor(float.class, editor);
+ table.setDefaultEditor(Float.class, editor);
+ }
+
+ // Boolean
+ {
+ TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class);
+ table.setDefaultRenderer(boolean.class, renderer);
+
+ TableCellEditor editor = table.getDefaultEditor(Boolean.class);
+ table.setDefaultEditor(boolean.class, editor);
+ }
+
+ table.addKeyListener(keyAdapter);
+
+ // prepare the table column model
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // Species to confirm
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Boolean.class),
+ table.getDefaultRenderer(Boolean.class),
+ _("tutti.table.species.header.toConfirm"),
+ ColumnIdentifier.speciesToConfirm);
+
+ }
+
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+
+ { // Species (by code)
+
+ Decorator<SpeciesBean> decorator = getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, allSpecies, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.speciesByCode"),
+ ColumnIdentifier.speciesByCode);
+ }
+
+ { // Species (by genusCode)
+
+ Decorator<SpeciesBean> decorator =
+ getDecorator(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE);
+
+ JComboBox comboBox = new JComboBox();
+
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, allSpecies, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer = newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.speciesByGenusCode"),
+ ColumnIdentifier.speciesByGenusCode);
+
+ }
+
+ { // Vrac / Hors vrac
+
+ EnumEditor<VracHorsVracEnum> comboBox =
+ EnumEditor.newEditor(VracHorsVracEnum.values());
+ BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+
+ addColumnToModel(columnModel,
+ editor,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.vracHorsVrac"),
+ ColumnIdentifier.vracHorsVrac);
+ }
+
+ { // Catégorie de poids
+
+ Decorator<WeightCategoryBean> decorator =
+ getDecorator(WeightCategoryBean.class, DecoratorService.BY_NAME);
+
+ JComboBox comboBox = new JComboBox();
+
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, persistenceService.getAllWeightCategories(), null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.weightCategory"),
+ ColumnIdentifier.weightCategory);
+ }
+
+ { // Sex
+
+ Decorator<SexBean> decorator =
+ getDecorator(SexBean.class, DecoratorService.BY_NAME);
+
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+ SwingUtil.fillComboBox(comboBox, persistenceService.getAllSex(), null);
+
+ ObjectToStringConverter converter =
+ BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+
+ TableCellEditor editor = new ComboBoxCellEditor(comboBox);
+ TableCellRenderer renderer =
+ newTableCellRender(SexBean.class, DecoratorService.BY_NAME);
+
+ addColumnToModel(columnModel,
+ editor,
+ renderer,
+ _("tutti.table.species.header.sex"),
+ ColumnIdentifier.sex);
+ }
+
+ { // Maturity
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.maturity"),
+ ColumnIdentifier.maturity);
+ }
+
+ { // Age
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.age"),
+ ColumnIdentifier.age);
+ }
+
+ { // Poids observé
+
+ addColumnToModel(columnModel,
+ table.getDefaultEditor(Float.class),
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.weight"),
+ ColumnIdentifier.weight);
+ }
+
+ { // Poids calculé
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.computedWeight"),
+ ColumnIdentifier.computedWeight);
+ }
+
+ { // Nombre calculé
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.computedNumber"),
+ ColumnIdentifier.computedNumber);
+ }
+
+ { // Poids d'échantillon
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.sampleWeight"),
+ ColumnIdentifier.sampleWeight);
+ }
+
+ { // Fraction d'élévation
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.elevationRate"),
+ ColumnIdentifier.elevationRatio);
+ }
+
+ { // Commentaire
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.comment"),
+ ColumnIdentifier.comment);
+ }
+
+ { // Pièces-jointes
+
+ addColumnToModel(columnModel,
+ null,
+ table.getDefaultRenderer(Object.class),
+ _("tutti.table.species.header.file"),
+ ColumnIdentifier.file);
+ }
+ return columnModel;
+ }
+
+ private KeyListener createTableKeyListener(SpeciesTabUIModel model, JXTable table) {
+ final MoveToNextEditableCellAction nextCellAction = new MoveToNextEditableCellAction(model, table);
+ final MoveToPreviousEditableCellAction previousCellAction = new MoveToPreviousEditableCellAction(model, table);
+
+ final MoveToNextEditableRowAction nextRowAction = new MoveToNextEditableRowAction(model, table);
+ final MoveToPreviousEditableRowAction previousRowAction = new MoveToPreviousEditableRowAction(model, table);
+
+ // Key adapter à ajouter sur les éditeurs où l'on souhaite gérer les
+ // touches "entrer", "gauche", "doite" de facon personnalisée.
+ return new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_RIGHT ||
+ e.getKeyCode() == KeyEvent.VK_TAB) {
+ e.consume();
+ nextCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
+ e.consume();
+ previousCellAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_UP) {
+ e.consume();
+ previousRowAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
+ e.consume();
+ nextRowAction.actionPerformed(null);
+ } else if (e.getKeyCode() == KeyEvent.VK_DOWN && e.isControlDown()) {
+ e.consume();
+
+ // create a new line with same sample
+ }
+ }
+ };
+ }
+
+ protected void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ String header,
+ Object identifier) {
+
+ TableColumn col = new TableColumnExt(model.getColumnCount());
+ col.setCellEditor(editor);
+ col.setCellRenderer(renderer);
+ col.setHeaderValue(header);
+ col.setIdentifier(identifier);
+ model.addColumn(col);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,156 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIModel.class);
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
+
+ public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
+
+ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
+
+ public static final String PROPERTY_ROWS = "rows";
+
+ public static final String PROPERTY_NEW_ROW = "newRow";
+
+ protected Float totalWeight;
+
+ protected Float totalVracWeight;
+
+ protected Float sampleVracWeight;
+
+ protected Float totalHorsVracWeight;
+
+ /**
+ * List of catches (linear representation).
+ *
+ * @since 0.2
+ */
+ protected List<SpeciesCatchEntryModel> rows;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public int getRowCount() {
+ return rows == null ? 0 : rows.size();
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getTotalVracWeight() {
+ return totalVracWeight;
+ }
+
+ public void setTotalVracWeight(Float totalVracWeight) {
+ Object oldValue = getTotalVracWeight();
+ this.totalVracWeight = totalVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ }
+
+ public Float getSampleVracWeight() {
+ return sampleVracWeight;
+ }
+
+ public void setSampleVracWeight(Float sampleVracWeight) {
+ Object oldValue = getSampleVracWeight();
+ this.sampleVracWeight = sampleVracWeight;
+ firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ }
+
+ public Float getTotalHorsVracWeight() {
+ return totalHorsVracWeight;
+ }
+
+ public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
+ Object oldValue = getTotalHorsVracWeight();
+ this.totalHorsVracWeight = totalHorsVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
+ }
+
+ public List<SpeciesCatchEntryModel> getRows() {
+ return rows;
+ }
+
+ public void setCatches(List<SpeciesCatchEntryModel> rows) {
+ Object oldValue = getRowCount();
+ if (rows == null) {
+ rows = Lists.newArrayList();
+ }
+ this.rows = rows;
+ firePropertyChange(PROPERTY_ROWS, oldValue, rows);
+ }
+
+ public void addNewCatch() {
+ Preconditions.checkState(
+ rows != null,
+ "Cant add a row, rows list is null");
+ SpeciesCatchEntryModel newRow = new SpeciesCatchEntryModel();
+ if (log.isInfoEnabled()) {
+ log.info("Add a new catch ");
+ }
+ rows.add(newRow);
+ firePropertyChange(PROPERTY_NEW_ROW, null, newRow);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ SpeciesTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(SpeciesTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java (from rev 25, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,209 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTableModel extends AbstractTableModel {
+
+ public static enum ColumnIdentifier {
+ speciesToConfirm,
+ speciesByCode("species"),
+ speciesByGenusCode("species"),
+ vracHorsVrac,
+ weightCategory,
+ sex,
+ maturity,
+ age,
+ weight,
+ computedWeight(null),
+ computedNumber(null),
+ sampleWeight,
+ elevationRatio,
+ comment,
+ file(null);
+
+ final String propertyName;
+
+ ColumnIdentifier() {
+ this("");
+ }
+
+ ColumnIdentifier(String propertyName) {
+ this.propertyName = "".equals(propertyName) ? name() : propertyName;
+ }
+
+ public void setValue(SpeciesCatchEntryModel entry, Object value) {
+ if (propertyName != null)
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+
+ public Object getValue(SpeciesCatchEntryModel entry) {
+ Object result = null;
+ if (propertyName != null && entry != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ // TODO This will be dynamic by the protocol...
+ final Set<ColumnIdentifier> noneEditableCols = Sets.newHashSet(
+ ColumnIdentifier.age,
+ ColumnIdentifier.maturity,
+ ColumnIdentifier.computedWeight,
+ ColumnIdentifier.computedNumber,
+ ColumnIdentifier.sampleWeight,
+ ColumnIdentifier.elevationRatio,
+ ColumnIdentifier.file
+ );
+
+ protected final List<ColumnIdentifier> columnIdentifiers;
+
+ protected final TableColumn[] columns;
+
+ protected final SpeciesTabUIModel model;
+
+ public SpeciesTableModel(TableColumnModel columnModel,
+ SpeciesTabUIModel model) {
+ this.model = model;
+ int nbcols = columnModel.getColumnCount();
+ columns = new TableColumn[nbcols];
+ columnIdentifiers = Lists.newArrayList();
+ for (int i = 0; i < nbcols; i++) {
+ TableColumn column = columnModel.getColumn(i);
+ columns[i] = column;
+ columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
+ }
+ }
+
+ public void refreshData(List<SpeciesCatchEntryModel> data) {
+
+ // can't accept a empty data list
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ if (data.isEmpty()) {
+
+ // add a first edit line
+ data.add(new SpeciesCatchEntryModel());
+ }
+ fireTableDataChanged();
+ }
+
+ public void addNewRow(SpeciesCatchEntryModel newValue) {
+
+ List<SpeciesCatchEntryModel> data = getData();
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ int rowIndex = data.indexOf(newValue);
+ fireTableRowsInserted(rowIndex, rowIndex);
+ }
+
+ @Override
+ public int getRowCount() {
+ return model.getRowCount();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columns.length;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ SpeciesCatchEntryModel entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ Object result = propertyName.getValue(entry);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ SpeciesCatchEntryModel entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ propertyName.setValue(entry, aValue);
+
+ if (propertyName == ColumnIdentifier.speciesByCode) {
+
+ // update also speciesByGenusCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
+
+ // update also speciesByCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ ColumnIdentifier identifier = getPropertyName(columnIndex);
+ boolean result = !noneEditableCols.contains(identifier);
+ return result;
+ }
+
+ public SpeciesCatchEntryModel getEntry(int rowIndex) {
+ SwingUtil.ensureRowIndex(this, rowIndex);
+ List<SpeciesCatchEntryModel> data = getData();
+ SpeciesCatchEntryModel result = data == null ? null : data.get(rowIndex);
+ return result;
+ }
+
+ protected TableColumn getColumn(int columnIndex) {
+ SwingUtil.ensureColumnIndex(this, columnIndex);
+ return columns[columnIndex];
+ }
+
+ protected ColumnIdentifier getPropertyName(int columnIndex) {
+ TableColumn column = getColumn(columnIndex);
+ return (ColumnIdentifier) column.getIdentifier();
+ }
+
+ protected int getColumnIndex(ColumnIdentifier property) {
+ int result = columnIdentifiers.indexOf(property);
+ return result;
+ }
+
+ protected List<SpeciesCatchEntryModel> getData() {
+ return model.getRows();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java 2012-12-04 17:59:54 UTC (rev 27)
@@ -0,0 +1,70 @@
+package fr.ifremer.tutti.ui.swing.util;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import org.jdesktop.swingx.decorator.AbstractHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.util.PaintUtils;
+
+import javax.swing.JButton;
+import java.awt.Color;
+import java.awt.Component;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TuttiColorHighlighter extends AbstractHighlighter {
+
+ protected Color color;
+
+ protected boolean foreground;
+
+ public TuttiColorHighlighter(HighlightPredicate predicate, Color color, boolean foreground) {
+ super(predicate);
+ this.color = color;
+ this.foreground = foreground;
+ }
+
+ @Override
+ protected Component doHighlight(Component component, ComponentAdapter adapter) {
+ if (component instanceof JButton) {
+ // do nothing
+
+ } else {
+ if (foreground) {
+ component.setForeground(color);
+
+ } else {
+ component.setBackground(color);
+ if (adapter.isSelected()) {
+ component.setForeground(PaintUtils.computeForeground(color));
+ }
+ }
+ }
+ return component;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 17:59:17 UTC (rev 26)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-04 17:59:54 UTC (rev 27)
@@ -133,9 +133,11 @@
tutti.table.plancton.header.speciesByCode=Espèce
tutti.table.plancton.header.weight=Poids observé
tutti.table.species.header.age=Age
+tutti.table.species.header.comment=Commentaire
tutti.table.species.header.computedNumber=Nombre calculé
tutti.table.species.header.computedWeight=Poids calculé
tutti.table.species.header.elevationRate=Fraction d'él
+tutti.table.species.header.file=Pièces jointes
tutti.table.species.header.maturity=Maturité
tutti.table.species.header.sampleWeight=Poids échan
tutti.table.species.header.sex=Sexe
1
0
Author: tchemit
Date: 2012-12-04 18:59:17 +0100 (Tue, 04 Dec 2012)
New Revision: 26
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/26
Log:
optimize dependencies
Modified:
trunk/pom.xml
trunk/tutti-ui-swing/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-11-28 18:17:32 UTC (rev 25)
+++ trunk/pom.xml 2012-12-04 17:59:17 UTC (rev 26)
@@ -213,6 +213,12 @@
</dependency>
<dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-autocomplete</artifactId>
+ <version>${swingXVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.ezware.oxbow</groupId>
<artifactId>swing-bits</artifactId>
<version>0.5.0</version>
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-11-28 18:17:32 UTC (rev 25)
+++ trunk/tutti-ui-swing/pom.xml 2012-12-04 17:59:17 UTC (rev 26)
@@ -274,6 +274,11 @@
<artifactId>swingx-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.swinglabs.swingx</groupId>
+ <artifactId>swingx-autocomplete</artifactId>
+ </dependency>
+
<!-- Logging -->
<dependency>
1
0
28 Nov '12
Author: tchemit
Date: 2012-11-28 19:17:32 +0100 (Wed, 28 Nov 2012)
New Revision: 25
Url: http://forge.codelutin.com/repositories/revision/tutti/25
Log:
add trait catches bean and their screens
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -101,7 +101,6 @@
List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId);
-
SurveyBean getSurvey(String surveyId);
CampaignBean getCampaign(String campaignId);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
/**
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
/**
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,7 +1,31 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
/**
- * TODO
+ * For any bean which relies to a {@link TraitBean}.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
/**
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
/**
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiBeans.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -41,6 +41,10 @@
return new IdPredicate<B>(id);
}
+ public static <B extends AbstractTuttiBean & TraitCatchBeanAware> Predicate<B> newTraitIdPredicate(String id) {
+ return new TraitIdPredicate<B>(id);
+ }
+
public static <B extends AbstractTuttiBean> B findById(Collection<B> beans,
String id) {
B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
@@ -64,4 +68,18 @@
return id.equals(input.getId());
}
}
+
+ protected static class TraitIdPredicate<B extends AbstractTuttiBean & TraitCatchBeanAware> implements Predicate<B> {
+
+ private final String id;
+
+ public TraitIdPredicate(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean apply(B input) {
+ return id.equals(input.getTrait().getId());
+ }
+ }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.persistence.entities.referential;
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
/**
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -223,11 +223,6 @@
se = new SexBean();
se.setId(UUID.randomUUID().toString());
- se.setName("Male");
- cache.put(SexBean.class, se);
-
- se = new SexBean();
- se.setId(UUID.randomUUID().toString());
se.setName("Femelle");
cache.put(SexBean.class, se);
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -446,13 +446,8 @@
return Lists.newArrayList(result);
}
- protected <B extends AbstractTuttiBean & TraitCatchBeanAware> List<B> getAllTraitFilterCatches(Class<B> beanType,final String traitId) {
- List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), new Predicate<B>() {
- @Override
- public boolean apply(B input) {
- return traitId.equals(input.getTrait().getId());
- }
- }));
+ protected <B extends AbstractTuttiBean & TraitCatchBeanAware> List<B> getAllTraitFilterCatches(Class<B> beanType, String traitId) {
+ List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), TuttiBeans.newTraitIdPredicate(traitId)));
return result;
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -36,6 +36,7 @@
import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import org.nuiton.util.decorator.Decorator;
import org.nuiton.util.decorator.DecoratorProvider;
@@ -50,6 +51,12 @@
*/
public class DecoratorService extends AbstractTuttiService {
+ public static final String SPECIES_BY_CODE = "byCode";
+
+ public static final String SPECIES_BY_GENUS = "byGenus";
+
+ public static final String BY_NAME= "byName";
+
/** Delegate decorator provider. */
protected DecoratorProvider decoratorProvider;
@@ -79,7 +86,7 @@
registerMultiJXPathDecorator(SurveyBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(CampaignBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%2$tm/%2$tY", "#", " - ");
+ registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
registerMultiJXPathDecorator(ZoneBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(VesselBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(CountryBean.class, "${name}$s", "#", " - ");
@@ -90,9 +97,10 @@
registerMultiJXPathDecorator(StrataBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(SexBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(SpeciesBean.class, "${codeMemo}#${genusSpecies}$s", "#", " - ");
- registerMultiJXPathDecorator(SpeciesBean.class, "byCode", "${codeMemo}#${genusSpecies}$s", "#", " - ");
- registerMultiJXPathDecorator(SpeciesBean.class, "byGenius", "${genusSpecies}$s#${codeMemo}$s", "#", " - ");
-
+ registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_CODE, "${codeMemo}$s");
+ registerJXPathDecorator(SpeciesBean.class, SPECIES_BY_GENUS, "${genusSpecies}$s");
+ registerJXPathDecorator(WeightCategoryBean.class, BY_NAME, "${name}$s");
+ registerJXPathDecorator(SexBean.class, BY_NAME, "${name}$s");
}
};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -30,7 +30,6 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import jaxx.runtime.swing.OneClicListSelectionModel;
import jaxx.runtime.swing.editor.NumberEditor;
@@ -39,7 +38,6 @@
import jaxx.runtime.swing.editor.bean.BeanListHeader;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
-import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXDatePicker;
@@ -102,12 +100,12 @@
public void setText(KeyEvent event, String property) {
JTextComponent field = (JTextComponent) event.getSource();
String value = field.getText();
- setProperty(getModel(), property, value);
+ TuttiUIUtil.setProperty(getModel(), property, value);
}
public void setBoolean(ItemEvent event, String property) {
boolean value = event.getStateChange() == ItemEvent.SELECTED;
- setProperty(getModel(), property, value);
+ TuttiUIUtil.setProperty(getModel(), property, value);
}
public void selectListData(ListSelectionEvent event, String property) {
@@ -123,21 +121,13 @@
Object o = list.getModel().getElementAt(index);
selectedList.add(o);
}
- setProperty(getModel(), property, selectedList);
+ TuttiUIUtil.setProperty(getModel(), property, selectedList);
} finally {
selectionModel.setValueIsAdjusting(false);
}
}
}
- protected void setProperty(Object bean, String property, Object value) {
- try {
- PropertyUtils.setSimpleProperty(bean, property, value);
- } catch (Exception e) {
- throw new TuttiServiceTechnicalException("Could not set property", e);
- }
- }
-
protected void initUI(TuttiUI ui) {
for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) {
@@ -282,12 +272,17 @@
protected <O> ListCellRenderer newListCellRender(Class<O> type) {
+ return newListCellRender(type, null);
+ }
+
+ protected <O> ListCellRenderer newListCellRender(Class<O> type, String name) {
+
DecoratorService decoratorService =
context.getService(DecoratorService.class);
Preconditions.checkNotNull(type);
- Decorator<O> decorator = decoratorService.getDecoratorByType(type);
+ Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
Preconditions.checkNotNull(decorator);
DecoratorListCellRenderer result = new DecoratorListCellRenderer(decorator);
@@ -296,12 +291,17 @@
protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
+ return newTableCellRender(type, null);
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
+
DecoratorService decoratorService =
context.getService(DecoratorService.class);
Preconditions.checkNotNull(type);
- Decorator<O> decorator = decoratorService.getDecoratorByType(type);
+ Decorator<O> decorator = decoratorService.getDecoratorByType(type, name);
Preconditions.checkNotNull(decorator);
DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -24,8 +24,11 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
+import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.FileUtil;
@@ -219,4 +222,24 @@
JOptionPane.YES_NO_OPTION);
return i == JOptionPane.YES_OPTION;
}
+
+ public static void setProperty(Object bean, String property, Object value) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ PropertyUtils.setSimpleProperty(bean, property, value);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not set property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
+
+ public static Object getProperty(Object bean, String property) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ return PropertyUtils.getSimpleProperty(bean, property);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,11 +25,11 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIModel, EditCampaignUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.CountryBean
- fr.ifremer.tutti.persistence.entities.GearBean
+ fr.ifremer.tutti.persistence.entities.referential.CountryBean
+ fr.ifremer.tutti.persistence.entities.referential.GearBean
fr.ifremer.tutti.persistence.entities.SurveyBean
- fr.ifremer.tutti.persistence.entities.UserBean
- fr.ifremer.tutti.persistence.entities.VesselBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.persistence.entities.referential.VesselBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -26,7 +26,7 @@
import fr.ifremer.tutti.persistence.entities.CampaignBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,11 +25,11 @@
*/
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.BinderFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,7 +25,7 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIModel, EditSurveyUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.ZoneBean
+ fr.ifremer.tutti.persistence.entities.referential.ZoneBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.BinderFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,11 +25,11 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
fr.ifremer.tutti.persistence.entities.StrataBean
fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.UserBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.NumberEditor
@@ -66,7 +66,8 @@
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <!--field name='comment' component='commentField'/-->
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
</BeanValidator>
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -24,9 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import jaxx.runtime.SwingUtil;
@@ -124,7 +125,7 @@
model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<CatchBean>) evt.getNewValue());
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
}
});
@@ -152,13 +153,13 @@
BenthosTabUIModel model = ui.getModel();
- List<CatchBean> catches;
+ List<TraitBenthosCatchBean> catches;
if (empty) {
catches = null;
bean = new TraitBean();
} else {
- catches = persistenceService.getAllCatches(bean.getId());
+ catches = persistenceService.getAllTraitBenthosCatch(bean.getId());
}
model.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.CatchBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -49,7 +49,7 @@
protected Float sampleTotalWeight;
- protected List<CatchBean> catches;
+ protected List<TraitBenthosCatchBean> catches;
public Float getTotalWeight() {
return totalWeight;
@@ -71,11 +71,11 @@
firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
}
- public List<CatchBean> getCatches() {
+ public List<TraitBenthosCatchBean> getCatches() {
return catches;
}
- public void setCatches(List<CatchBean> catches) {
+ public void setCatches(List<TraitBenthosCatchBean> catches) {
Object oldValue = getCatches();
this.catches = catches;
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
- protected List<CatchBean> data;
+ protected List<TraitSpeciesCatchBean> data;
protected final TableColumnModel columnModel;
@@ -47,10 +47,10 @@
this.columnModel = columnModel;
}
- public void setData(List<CatchBean> data) {
+ public void setData(List<TraitSpeciesCatchBean> data) {
if (data == null) {
data = Lists.newArrayList();
- data.add(new CatchBean());
+ data.add(new TraitSpeciesCatchBean());
}
this.data = data;
fireTableDataChanged();
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.captureAccidentel.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.captureAccidentel.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,100 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<CaptureAccidentelTabUIModel, CaptureAccidentelTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public CaptureAccidentelTabUI(CatchesUI parentUI) {
+ CaptureAccidentelTabUIHandler handler = new CaptureAccidentelTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <CaptureAccidentelTabUIHandler id='handler'
+ initializer='getContextValue(CaptureAccidentelTabUIHandler.class)'/>
+
+ <CaptureAccidentelTabUIModel id='model'
+ initializer='getContextValue(CaptureAccidentelTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,181 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CaptureAccidentelTabUIHandler extends AbstractTuttiUIHandler<CaptureAccidentelTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(CaptureAccidentelTabUIHandler.class);
+
+ private final CaptureAccidentelTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public CaptureAccidentelTabUIHandler(CatchesUI parentUi, CaptureAccidentelTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ CaptureAccidentelTabUIModel model = new CaptureAccidentelTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final CaptureAccidentelTableModel tableModel = new CaptureAccidentelTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(CaptureAccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ CaptureAccidentelTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected CaptureAccidentelTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ CaptureAccidentelTabUIModel model = ui.getModel();
+
+ List<TraitCaptureAccidentelCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitCaptureAccidentelCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CaptureAccidentelTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitCaptureAccidentelCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitCaptureAccidentelCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitCaptureAccidentelCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ CaptureAccidentelTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(CaptureAccidentelTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class CaptureAccidentelTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public CaptureAccidentelTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CaptureAccidentelTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -38,7 +38,7 @@
selectedItem:{model.getSelectedTrait()};
}
-#fishesTab {
+#speciesTab {
enabled:{model.getSelectedTrait() != null};
}
@@ -50,14 +50,15 @@
enabled:{model.getSelectedTrait() != null};
}
-#macroDechetsTab {
+#macroDechetTab {
enabled:{model.getSelectedTrait() != null};
}
-#captureAccidentellesTab {
+#captureAccidentelTab {
enabled:{model.getSelectedTrait() != null};
}
-#observationIndividuellesTab {
- enabled:{model.getSelectedTrait() != null};
+#observationIndividuelTab {
+ enabled:{false};
+ /*enabled:{model.getSelectedTrait() != null};*/
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -70,22 +70,22 @@
<tab id='traitTab' title='tutti.label.tab.trait'>
<TraitTabUI id='traitTabContent' constructorParams='this'/>
</tab>
- <tab id='fishesTab' title='tutti.label.tab.fishes'>
- <FishesTabUI id='fishesTabContent' constructorParams='this'/>
+ <tab id='speciesTab' title='tutti.label.tab.species'>
+ <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
</tab>
<tab id='benthosTab' title='tutti.label.tab.benthos'>
<BenthosTabUI id='benthosTabContent' constructorParams='this'/>
</tab>
<tab id='planctonTab' title='tutti.label.tab.plancton'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
</tab>
- <tab id='macroDechetsTab' title='tutti.label.tab.macroDechets'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
+ <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
</tab>
- <tab id='captureAccidentellesTab' title='tutti.label.tab.captureAccidentelles'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ <tab id='captureAccidentelTab' title='tutti.label.tab.captureAccidentel'>
+ <CaptureAccidentelTabUI id='captureAccidentelTabContent' constructorParams='this'/>
</tab>
- <tab id='observationIndividuellesTab' title='tutti.label.tab.observationIndividuelles'>
+ <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
<JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
</tab>
</JTabbedPane>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -152,16 +152,15 @@
// propagate trait to his tabs
ui.getTraitTabContent().selectTrait(selectedTrait);
- ui.getFishesTabContent().selectTrait(selectedTrait);
+ ui.getSpeciesTabContent().selectTrait(selectedTrait);
ui.getBenthosTabContent().selectTrait(selectedTrait);
+ ui.getPlanctonTabContent().selectTrait(selectedTrait);
+ ui.getMacroDechetTabContent().selectTrait(selectedTrait);
+ ui.getCaptureAccidentelTabContent().selectTrait(selectedTrait);
// repaint tabs
ui.getTabPane().repaint();
-
-// ui.getPlanctonTabContent().selectTrait(selectedTrait);
-// ui.getMacroDechetsTabContent().selectTrait(selectedTrait);
-// ui.getCaptureAccidentellesTabContent().selectTrait(selectedTrait);
-// ui.getObservationIndividuellesTabContent().selectTrait(selectedTrait);
+// ui.getObservationIndividuelTabContent().selectTrait(selectedTrait);
}
public void saveTrait(TraitBean toSave) {
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,71 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightTotalVracWeightLabel {
- text:"tutti.label.totalWeightTotalVracWeight";
-}
-
-#sampleVracWeightTotalHorsVracWeightLabel {
- text:"tutti.label.sampleVracWeightTotalHorsVracWeight";
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightField {
- property:"totalVracWeight";
- model:{model.getTotalVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightField {
- property:"sampleVracWeight";
- model:{model.getSampleVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightField {
- property:"totalHorsVracWeight";
- model:{model.getTotalHorsVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,105 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<JPanel id='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishesTabUIModel, FishesTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.SeaStateBean
- fr.ifremer.tutti.persistence.entities.StrataBean
- fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.UserBean
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public FishesTabUI(CatchesUI parentUI) {
- FishesTabUIHandler handler = new FishesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <FishesTabUIHandler id='handler'
- initializer='getContextValue(FishesTabUIHandler.class)'/>
-
- <FishesTabUIModel id='model'
- initializer='getContextValue(FishesTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <!--field name='comment' component='commentField'/-->
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightTotalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- <NumberEditor id='totalVracWeightField' constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='sampleVracWeightTotalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,265 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import javax.swing.table.TableModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishesTabUIHandler extends AbstractTuttiUIHandler<FishesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(FishesTabUIHandler.class);
-
- private final FishesTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public FishesTabUIHandler(CatchesUI parentUi, FishesTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishesTabUIModel model = new FishesTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- DefaultTableCellRenderer dRender = new DefaultTableCellRenderer();
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
- col.setCellRenderer(newTableCellRender(SpeciesBean.class));
- col.setHeaderValue(_("tutti.table.fishes.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Vrac / Hors vrac
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.vracHorsVrac"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("vracHorsVrac");
- columnModel.addColumn(col);
-
- // Catégorie de poids
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.weightCategory"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weightCategory");
- columnModel.addColumn(col);
-
- // Sex
- col = new TableColumn(3);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.sex"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("sex");
- columnModel.addColumn(col);
-
- // Maturity
- col = new TableColumn(4);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.maturity"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("maturity");
- columnModel.addColumn(col);
-
- // Age
- col = new TableColumn(5);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.age"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("age");
- columnModel.addColumn(col);
-
- // Type de mensuration
- col = new TableColumn(6);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.mensurationType"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("mensurationType");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(7);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Poids calculé
- col = new TableColumn(8);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.computedWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedWeight");
- columnModel.addColumn(col);
-
- // Nombre calculé
- col = new TableColumn(9);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.computedNumber"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- // Poids d'échantillon
- col = new TableColumn(10);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.sampleWeight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("sampleWeight");
- columnModel.addColumn(col);
-
- // Fraction d'élévation
- col = new TableColumn(11);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.fishes.header.elevationRate"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("elevationRate");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final FishesTableModel tableModel = new FishesTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(FishesTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<CatchBean>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- FishesTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected FishesTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(TraitBean bean) {
-
- boolean empty = bean == null;
-
- FishesTabUIModel model = ui.getModel();
-
- List<CatchBean> catches;
-
- if (empty) {
- catches = null;
- bean = new TraitBean();
- } else {
- catches = persistenceService.getAllCatches(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
-
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishesTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
-
- public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
-
- public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float totalVracWeight;
-
- protected Float sampleVracWeight;
-
- protected Float totalHorsVracWeight;
-
- protected List<CatchBean> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getTotalVracWeight() {
- return totalVracWeight;
- }
-
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
- }
-
- public Float getSampleVracWeight() {
- return sampleVracWeight;
- }
-
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
- }
-
- public Float getTotalHorsVracWeight() {
- return totalHorsVracWeight;
- }
-
- public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
- Object oldValue = getTotalHorsVracWeight();
- this.totalHorsVracWeight = totalHorsVracWeight;
- firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
- }
-
- public List<CatchBean> getCatches() {
- return catches;
- }
-
- public void setCatches(List<CatchBean> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(TraitBean bean) {
- BinderFactory.newBinder(TraitBean.class,
- FishesTabUIModel.class).copy(bean, this);
- }
-
- public TraitBean toBean() {
- TraitBean result = new TraitBean();
- BinderFactory.newBinder(FishesTabUIModel.class,
- TraitBean.class).copy(this, result);
- return result;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishesTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<CatchBean> data;
-
- protected final TableColumnModel columnModel;
-
- public FishesTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<CatchBean> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new CatchBean());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.macroDechet.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.macroDechet.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,100 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroDechetTabUI(CatchesUI parentUI) {
+ MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroDechetTabUIHandler id='handler'
+ initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
+
+ <MacroDechetTabUIModel id='model'
+ initializer='getContextValue(MacroDechetTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,181 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
+
+ private final MacroDechetTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ MacroDechetTabUIModel model = new MacroDechetTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ MacroDechetTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected MacroDechetTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ MacroDechetTabUIModel model = ui.getModel();
+
+ List<TraitMacroDechetCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitMacroDechetCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitMacroDechetCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitMacroDechetCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitMacroDechetCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ MacroDechetTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(MacroDechetTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public MacroDechetTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/MacroDechetTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.plancton.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.plancton.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,100 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanctonTabUI(CatchesUI parentUI) {
+ PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanctonTabUIHandler id='handler'
+ initializer='getContextValue(PlanctonTabUIHandler.class)'/>
+
+ <PlanctonTabUIModel id='model'
+ initializer='getContextValue(PlanctonTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,181 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
+
+ private final PlanctonTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ PlanctonTabUIModel model = new PlanctonTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ PlanctonTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected PlanctonTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ PlanctonTabUIModel model = ui.getModel();
+
+ List<TraitPlanctonCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitPlanctonCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<TraitPlanctonCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<TraitPlanctonCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitPlanctonCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ PlanctonTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(PlanctonTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public PlanctonTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/PlanctonTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css (from rev 23, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.fishes.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text:"tutti.label.fishes.totalVracWeight";
+ labelFor:{totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property:"totalVracWeight";
+ model:{model.getTotalVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text:"tutti.label.fishes.sampleVracWeight";
+ labelFor:{sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property:"sampleVracWeight";
+ model:{model.getSampleVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text:"tutti.label.fishes.totalHorsVracWeight";
+ labelFor:{totalHorsVracWeightField};
+}
+
+#totalHorsVracWeightField {
+ property:"totalHorsVracWeight";
+ model:{model.getTotalHorsVracWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx (from rev 23, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,114 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesTabUI(CatchesUI parentUI) {
+ SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesTabUIHandler id='handler'
+ initializer='getContextValue(SpeciesTabUIHandler.class)'/>
+
+ <SpeciesTabUIModel id='model'
+ initializer='getContextValue(SpeciesTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='totalVracWeight' component='totalVracWeightField'/>
+ <field name='sampleVracWeight' component='sampleVracWeightField'/>
+ <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='sampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='totalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java (from rev 23, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,290 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.EnumEditor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIHandler extends AbstractTuttiUIHandler<SpeciesTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+
+ private final SpeciesTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesTabUIModel model = new SpeciesTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // Espèce à confirmer
+ col = new TableColumn(0);
+ col.setCellEditor(SwingUtil.newBooleanTableCellEditor(defaultRenderer));
+ col.setCellRenderer(SwingUtil.newBooleanTableCellRenderer(defaultRenderer));
+ col.setHeaderValue(_("tutti.table.species.header.toConfirm"));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesToConfirm);
+ columnModel.addColumn(col);
+
+ // species (by code) column
+ col = new TableColumn(1);
+
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ JComboBox speciesEditor = new JComboBox();
+ speciesEditor.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+ col.setCellEditor(new ComboBoxCellEditor(speciesEditor));
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_CODE));
+ col.setHeaderValue(_("tutti.table.species.header.speciesByCode"));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByCode);
+ columnModel.addColumn(col);
+
+ // species (by genusCode) column
+ col = new TableColumn(2);
+
+ JComboBox speciesEditor2 = new JComboBox();
+ speciesEditor2.setRenderer(newListCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
+ SwingUtil.fillComboBox(speciesEditor2, allSpecies, null);
+ col.setCellEditor(new ComboBoxCellEditor(speciesEditor2));
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class, DecoratorService.SPECIES_BY_GENUS));
+ col.setHeaderValue(_("tutti.table.species.header.speciesByGenusCode"));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.speciesByGenusCode);
+ columnModel.addColumn(col);
+
+ // Vrac / Hors vrac
+ col = new TableColumn(3);
+
+ EnumEditor<VracHorsVracEnum> vracEditor = EnumEditor.newEditor(VracHorsVracEnum.values());
+
+ col.setCellEditor(new ComboBoxCellEditor(vracEditor));
+// col.setCellRenderer(SwingUtil.newEnumTableCellRenderer(defaultRenderer, VracHorsVracEnum.class));
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.vracHorsVrac"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.vracHorsVrac);
+ columnModel.addColumn(col);
+
+ // Catégorie de poids
+ col = new TableColumn(4);
+
+ JComboBox weightCategoryCombo = new JComboBox();
+ weightCategoryCombo.setRenderer(newListCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
+ SwingUtil.fillComboBox(weightCategoryCombo, persistenceService.getAllWeightCategories(), null);
+ col.setCellEditor(new ComboBoxCellEditor(weightCategoryCombo));
+ col.setCellRenderer(newTableCellRender(WeightCategoryBean.class, DecoratorService.BY_NAME));
+ col.setHeaderValue(_("tutti.table.species.header.weightCategory"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weightCategory);
+ columnModel.addColumn(col);
+
+ // Sex
+ col = new TableColumn(5);
+
+ JComboBox sexCombo = new JComboBox();
+ sexCombo.setRenderer(newListCellRender(SexBean.class, DecoratorService.BY_NAME));
+ SwingUtil.fillComboBox(sexCombo, persistenceService.getAllSex(), null);
+ col.setCellEditor(new ComboBoxCellEditor(sexCombo));
+ col.setCellRenderer(newTableCellRender(SexBean.class, DecoratorService.BY_NAME));
+
+ col.setHeaderValue(_("tutti.table.species.header.sex"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sex);
+ columnModel.addColumn(col);
+
+ // Maturity
+ col = new TableColumn(6);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.maturity"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.maturity);
+ columnModel.addColumn(col);
+
+ // Age
+ col = new TableColumn(7);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.age"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.age);
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(8);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.weight);
+ columnModel.addColumn(col);
+
+ // Poids calculé
+ col = new TableColumn(9);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.computedWeight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedWeight);
+ columnModel.addColumn(col);
+
+ // Nombre calculé
+ col = new TableColumn(10);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.computedNumber"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.computedNumber);
+ columnModel.addColumn(col);
+
+ // Poids d'échantillon
+ col = new TableColumn(11);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.sampleWeight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.sampleWeight);
+ columnModel.addColumn(col);
+
+ // Fraction d'élévation
+ col = new TableColumn(12);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.species.header.elevationRate"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier(SpeciesTableModel.ColumnIdentifier.elevationRatio);
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final SpeciesTableModel tableModel = new SpeciesTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(SpeciesTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<TraitSpeciesCatchBean>) evt.getNewValue());
+ }
+ });
+ }
+
+ @Override
+ public void afterInitUI() {
+ SpeciesTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ SpeciesTabUIModel model = ui.getModel();
+
+ List<TraitSpeciesCatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllTraitSpeciesCatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java (from rev 23, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,123 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
+
+ public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
+
+ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float totalVracWeight;
+
+ protected Float sampleVracWeight;
+
+ protected Float totalHorsVracWeight;
+
+ protected List<TraitSpeciesCatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getTotalVracWeight() {
+ return totalVracWeight;
+ }
+
+ public void setTotalVracWeight(Float totalVracWeight) {
+ Object oldValue = getTotalVracWeight();
+ this.totalVracWeight = totalVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ }
+
+ public Float getSampleVracWeight() {
+ return sampleVracWeight;
+ }
+
+ public void setSampleVracWeight(Float sampleVracWeight) {
+ Object oldValue = getSampleVracWeight();
+ this.sampleVracWeight = sampleVracWeight;
+ firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ }
+
+ public Float getTotalHorsVracWeight() {
+ return totalHorsVracWeight;
+ }
+
+ public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
+ Object oldValue = getTotalHorsVracWeight();
+ this.totalHorsVracWeight = totalHorsVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
+ }
+
+ public List<TraitSpeciesCatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<TraitSpeciesCatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ SpeciesTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(SpeciesTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java (from rev 23, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -0,0 +1,180 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTableModel extends AbstractTableModel {
+
+ public static enum ColumnIdentifier {
+ speciesToConfirm,
+ speciesByCode("species"),
+ speciesByGenusCode("species"),
+ vracHorsVrac,
+ weightCategory,
+ sex,
+ maturity,
+ age,
+ weight,
+ computedWeight(null),
+ computedNumber(null),
+ sampleWeight,
+ elevationRatio;
+
+ final String propertyName;
+
+ ColumnIdentifier() {
+ this("");
+ }
+
+ ColumnIdentifier(String propertyName) {
+ this.propertyName = "".equals(propertyName) ? name() : propertyName;
+ }
+
+ public void setValue(TraitSpeciesCatchBean entry, Object value) {
+ if (propertyName != null)
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+
+ public Object getValue(TraitSpeciesCatchBean entry) {
+ Object result = null;
+ if (propertyName != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<TraitSpeciesCatchBean> data;
+
+ protected final List<ColumnIdentifier> columnIdentifiers;
+
+ protected final TableColumn[] columns;
+
+ protected final TraitSpeciesCatchBean newRow = new TraitSpeciesCatchBean();
+
+ public SpeciesTableModel(TableColumnModel columnModel) {
+
+ int nbcols = columnModel.getColumnCount();
+ columns = new TableColumn[nbcols];
+ columnIdentifiers = Lists.newArrayList();
+ for (int i = 0; i < nbcols; i++) {
+ TableColumn column = columnModel.getColumn(i);
+ columns[i] = column;
+ columnIdentifiers.add((ColumnIdentifier) column.getIdentifier());
+ }
+ }
+
+ public void setData(List<TraitSpeciesCatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new TraitSpeciesCatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return (data == null ? 0 : data.size()) + 1;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columns.length;
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ TraitSpeciesCatchBean entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ Object result = propertyName.getValue(entry);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ TraitSpeciesCatchBean entry = getEntry(rowIndex);
+ ColumnIdentifier propertyName = getPropertyName(columnIndex);
+ propertyName.setValue(entry, aValue);
+
+ if (propertyName == ColumnIdentifier.speciesByCode) {
+
+ // update also speciesByGenusCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByGenusCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ } else if (propertyName == ColumnIdentifier.speciesByGenusCode) {
+
+ // update also speciesByCode column
+ int otherColumnIndex = getColumnIndex(ColumnIdentifier.speciesByCode);
+ fireTableCellUpdated(rowIndex, otherColumnIndex);
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+
+ protected TraitSpeciesCatchBean getEntry(int rowIndex) {
+ SwingUtil.ensureRowIndex(this, rowIndex);
+ TraitSpeciesCatchBean result;
+ if (data == null || rowIndex >= data.size()) {
+ result = newRow;
+ } else {
+ result = data.get(rowIndex);
+ }
+ return result;
+ }
+
+ protected TableColumn getColumn(int columnIndex) {
+ SwingUtil.ensureColumnIndex(this, columnIndex);
+ return columns[columnIndex];
+ }
+
+ protected ColumnIdentifier getPropertyName(int columnIndex) {
+ TableColumn column = getColumn(columnIndex);
+ return (ColumnIdentifier) column.getIdentifier();
+ }
+
+ protected int getColumnIndex(ColumnIdentifier property) {
+ int result = columnIdentifiers.indexOf(property);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/SpeciesTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,11 +25,11 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<TraitTabUIModel, TraitTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.BeaufortScaleBean
- fr.ifremer.tutti.persistence.entities.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.referential.SeaStateBean
fr.ifremer.tutti.persistence.entities.StrataBean
fr.ifremer.tutti.persistence.entities.TraitBean
- fr.ifremer.tutti.persistence.entities.UserBean
+ fr.ifremer.tutti.persistence.entities.referential.UserBean
fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import org.apache.commons.collections.CollectionUtils;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-11-28 18:17:32 UTC (rev 25)
@@ -24,12 +24,12 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.BinderFactory;
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-11-28 09:28:45 UTC (rev 24)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-11-28 18:17:32 UTC (rev 25)
@@ -1,7 +1,7 @@
tutti.about.bottomText=Copyright %s - %s - version %s
tutti.about.message=<h3>Tutti</h3><p><strong>Outil de saisie de données d'opérations et de captures au cours des campagnes halieutiques.</strong></p><br/><p>Ce logiciel permettra la saisie en mer des données d'opération de pêche (positions, environnement, engin, etc) et des captures associées (composition de la capture en espèces scientifiques avec poids, nombres, tailles etc) pour l'ensemble des campagnes halieutiques réalisées par l'Ifremer.</p><p>Ce projet a été initiée en 2012 par l'<a href\="http\://www.ifremer.fr">Ifremer</a> et réalisé par la société <a href\="http\://codelutin.com">Codelutin</a>.</p><hr/><br/><p>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.forge.codelutin.com/tutti">site du projet</a>.</p><p>Projet hébergé sur la forge <a href\="http\://forge.codelutin.com/projects/tutti">Forge.codelutin.com</a>.</p>
-tutti.action.about=A propos
-tutti.action.about.tip=A Propos
+tutti.action.about=À propos
+tutti.action.about.tip=À Propos
tutti.action.cancel=Annuler
tutti.action.casino-import=Import Casino
tutti.action.catches=Captures
@@ -26,8 +26,6 @@
tutti.action.site.tip=Accéder au site du projet Tutti
tutti.application.config=Configuration de l'application Tutti
tutti.application.name=Tutti
-tutti.config.application.site.url=Url du site internet de l'application
-tutti.config.application.version=Version de l'application
tutti.config.campaignId=Identifiant de la dernière campagne utilisée
tutti.config.category.applications=Application
tutti.config.category.applications.description=Application
@@ -35,48 +33,52 @@
tutti.config.category.other.description=Autres options
tutti.config.category.shortcuts=Raccourcis
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
-tutti.config.data.directory=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp).
-tutti.config.license.organizationName=Nom de l'organisation dans la licence
tutti.config.surveyId=Identifiant de la dernière série de campagne utilisée
-tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application)
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
-tutti.label.benthos.sampleTotalWeight=Poids échantilloné observé
-tutti.label.benthos.totalWeight=Poids total observé
+tutti.label.benthos.sampleTotalWeight=Poids échantilloné
+tutti.label.benthos.totalWeight=Poids total
tutti.label.campaign=Campagne
tutti.label.campaign.country=Pays
tutti.label.campaign.name=Nom
tutti.label.campaign.survey=Série
tutti.label.campaign.surveyPart=Série partielle
+tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
+tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
+tutti.label.fishes.sampleVracWeight=Poids total vrac échant.
+tutti.label.fishes.totalHorsVracWeight=Poids total hors vrac
+tutti.label.fishes.totalVracWeight=Poids total vrac
+tutti.label.fishes.totalWeight=Poids total
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
tutti.label.list.saisisseur=Nom des saisisseurs
tutti.label.list.vessel=Navire(s)
+tutti.label.macroDechet.sampleTotalWeight=Poids total échantillonné
+tutti.label.macroDechet.totalWeight=Poids total
tutti.label.no.trait.selected=< Aucun trait sélectionné >
-tutti.label.sampleVracWeightTotalHorsVracWeight=Poids total vrac échant. / total hors vrac
+tutti.label.plancton.sampleTotalWeight=Poids total échantillonné
+tutti.label.plancton.totalWeight=Poids total
tutti.label.survey=Série de campagne
tutti.label.survey.name=Nom
tutti.label.survey.zone=Zone
tutti.label.tab.benthos=Benthos
-tutti.label.tab.captureAccidentelles=Captures accidentelles
-tutti.label.tab.fishes=Poissons
-tutti.label.tab.macroDechets=Macro déchets
-tutti.label.tab.observationIndividuelles=Observations individuelles
+tutti.label.tab.captureAccidentel=Captures accidentelles
+tutti.label.tab.macroDechet=Macro déchets
+tutti.label.tab.observationIndividuel=Observations individuelles
tutti.label.tab.plancton=Plancton
+tutti.label.tab.species=Espèces
tutti.label.tab.trait=Trait
tutti.label.tab.trait.gearShooting=Données de traine
-tutti.label.tab.trait.general=Caractéristiques
+tutti.label.tab.trait.general=Caractéristiques générales
tutti.label.tab.trait.hydrology=Paramètres hydrologiques
-tutti.label.totalWeightTotalVracWeight=Poids total / total vrac
tutti.label.trait.averageBottomSalinity=Salinité de fond moyenne
tutti.label.trait.averageBottomTemperature=Température de fond moyenne
tutti.label.trait.beaufortScale=Force du vent
tutti.label.trait.date=Date
tutti.label.trait.distanceChaluteeDuree=Distance chalutée / Durée
-tutti.label.trait.duree=Durée
tutti.label.trait.gearShootingEndBottomSalinity=Salinité de fond fin de traine
tutti.label.trait.gearShootingEndBottomTemperature=Température de fond fin de traine
tutti.label.trait.gearShootingEndDepth=Profondeur fin de traine
@@ -95,15 +97,12 @@
tutti.label.trait.gearShootingStartTime=Début de traine
tutti.label.trait.geometrieMesuree=Géométrie mesurée
tutti.label.trait.localite=Localité
-tutti.label.trait.longueurFunes=Longueur des funes
tutti.label.trait.longueurFunesBras=Longueur des funes / bras
tutti.label.trait.ouvertureHorizontaleVerticale=Ouverture horizontale / verticale
-tutti.label.trait.ouvertureVerticale=Ouverture verticale
tutti.label.trait.seaState=Etat de la mer
tutti.label.trait.stationNumberTraitNumber=Numéro de la station / Trait
tutti.label.trait.strata=Strate d'association
tutti.label.trait.systemeFermetureCul=Système de fermeture de cul
-tutti.label.trait.traitNumber=Numéro du trait
tutti.label.trait.traitRectiligne=Trait rectiligne
tutti.label.trait.traitValid=Trait valide
tutti.label.trait.windDirection=Direction du vent
@@ -121,34 +120,32 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
-tutti.service.config=Configuration des services de Tutti
-tutti.table.benthos.header.number=Nb ob.
+tutti.table.benthos.header.number=Nombre observé
tutti.table.benthos.header.speciesByCode=Espèce
-tutti.table.benthos.header.weight=Poids ob.
-tutti.table.fishes.header.age=Age
-tutti.table.fishes.header.computedNumber=Nombre calculé
-tutti.table.fishes.header.computedNumber.tip=Nombre calculé
-tutti.table.fishes.header.computedWeight=Poids calculé
-tutti.table.fishes.header.computedWeight.tip=Poids calculé
-tutti.table.fishes.header.elevationRate=Fraction d'él
-tutti.table.fishes.header.elevationRate.tip=Fraction d'él
-tutti.table.fishes.header.maturity=Maturité
-tutti.table.fishes.header.maturity.tip=Maturié
-tutti.table.fishes.header.mensurationType=Type de mensuration
-tutti.table.fishes.header.mensurationType.tip=Type de mensuration
-tutti.table.fishes.header.sampleWeight=Poids échan
-tutti.table.fishes.header.sampleWeight.tip=Poids échan
-tutti.table.fishes.header.sex=Sexe
-tutti.table.fishes.header.sex.tip=Sexe
-tutti.table.fishes.header.speciesByCode=Espèce
-tutti.table.fishes.header.speciesByCode.tip=Espèce
-tutti.table.fishes.header.vracHorsVrac=Vrac / Hors Vrac
-tutti.table.fishes.header.vracHorsVrac.tip=Vrac / Hors Vrac
-tutti.table.fishes.header.weight=Poids
-tutti.table.fishes.header.weight.tip=Poids
-tutti.table.fishes.header.weightCategory=Catégorie Poids
-tutti.table.fishes.header.weightCategory.tip=Catégorie Poids
-tutti.title.about=A propos de Tutti
+tutti.table.benthos.header.weight=Poids observé
+tutti.table.captureAccidentel.header.number=Nombre observé
+tutti.table.captureAccidentel.header.speciesByCode=Espèce
+tutti.table.captureAccidentel.header.weight=Poids observé
+tutti.table.macroDechet.header.number=Nombre observé
+tutti.table.macroDechet.header.speciesByCode=Espèce
+tutti.table.macroDechet.header.weight=Poids observé
+tutti.table.plancton.header.number=Nombre observé
+tutti.table.plancton.header.speciesByCode=Espèce
+tutti.table.plancton.header.weight=Poids observé
+tutti.table.species.header.age=Age
+tutti.table.species.header.computedNumber=Nombre calculé
+tutti.table.species.header.computedWeight=Poids calculé
+tutti.table.species.header.elevationRate=Fraction d'él
+tutti.table.species.header.maturity=Maturité
+tutti.table.species.header.sampleWeight=Poids échan
+tutti.table.species.header.sex=Sexe
+tutti.table.species.header.speciesByCode=Espèce
+tutti.table.species.header.speciesByGenusCode=Espèce
+tutti.table.species.header.toConfirm=A Confirmer
+tutti.table.species.header.vracHorsVrac=Vrac / Hors Vrac
+tutti.table.species.header.weight=Poids
+tutti.table.species.header.weightCategory=Catégorie Poids
+tutti.title.about=À propos de Tutti
tutti.title.create.campaign=Créer une nouvelle campagne
tutti.title.create.survey=Créer une nouvelle série de campagne
tutti.title.edit.campaign=Editer une campagne existante
1
0
28 Nov '12
Author: tchemit
Date: 2012-11-28 10:28:45 +0100 (Wed, 28 Nov 2012)
New Revision: 24
Url: http://forge.codelutin.com/repositories/revision/tutti/24
Log:
- introduce a new pakcage for referential entities
- add trait catches like beans (name will be changed)
- add different species decoration
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java
Removed:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CatchBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SexBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,20 +24,25 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.SexBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import org.nuiton.util.ApplicationConfig;
import java.io.Closeable;
@@ -58,6 +63,8 @@
void close() throws IOException;
+ List<WeightCategoryBean> getAllWeightCategories();
+
List<SexBean> getAllSex();
List<SpeciesBean> getAllSpecies();
@@ -84,6 +91,17 @@
List<TraitBean> getAllTraits(String campaignId);
+ List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId);
+
+ List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId);
+
+ List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId);
+
+ List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId);
+
+ List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId);
+
+
SurveyBean getSurvey(String surveyId);
CampaignBean getCampaign(String campaignId);
@@ -102,5 +120,4 @@
TraitBean saveTrait(TraitBean bean);
- List<CatchBean> getAllCatches(String traitId);
}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a beaufort scale.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BeaufortScaleBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CampaignBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,6 +24,11 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+
import java.util.List;
/**
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CatchBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,46 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a catch.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CatchBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected TraitBean trait;
-
- public TraitBean getTrait() {
- return trait;
- }
-
- public void setTrait(TraitBean trait) {
- this.trait = trait;
- }
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a country.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CountryBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a gear.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class GearBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents the sea state.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SeaStateBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SexBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SexBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SexBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,46 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a sex.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SexBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,56 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a fishes species.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String codeMemo;
-
- protected String genusSpecies;
-
- public String getCodeMemo() {
- return codeMemo;
- }
-
- public void setCodeMemo(String codeMemo) {
- this.codeMemo = codeMemo;
- }
-
- public String getGenusSpecies() {
- return genusSpecies;
- }
-
- public void setGenusSpecies(String genusSpecies) {
- this.genusSpecies = genusSpecies;
- }
-}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SurveyBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,6 +24,8 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
+
/**
* To represent a survey.
*
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,6 +24,10 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+
import java.util.Date;
import java.util.List;
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,119 @@
+package fr.ifremer.tutti.persistence.entities;
+
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+
+/**
+ * Represents a benthos catch while a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TraitBenthosCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Is catch is vrac or horsVrac?.
+ *
+ * @since 0.2
+ */
+ protected VracHorsVracEnum vracHorsVrac;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ this.species = species;
+ }
+
+ public boolean isSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ this.speciesToConfirm = speciesToConfirm;
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ this.vracHorsVrac = vracHorsVrac;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ this.sampleWeight = sampleWeight;
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ this.elevationRatio = elevationRatio;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitBenthosCatchBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,60 @@
+package fr.ifremer.tutti.persistence.entities;
+
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+
+/**
+ * Represents a capture accidentel catch while a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TraitCaptureAccidentelCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ this.species = species;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCaptureAccidentelCatchBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,14 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface TraitCatchBeanAware {
+
+ TraitBean getTrait();
+
+ void setTrait(TraitBean trait);
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitCatchBeanAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,60 @@
+package fr.ifremer.tutti.persistence.entities;
+
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+
+/**
+ * Represents a macro dechet catch while a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TraitMacroDechetCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ this.species = species;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitMacroDechetCatchBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,60 @@
+package fr.ifremer.tutti.persistence.entities;
+
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+
+/**
+ * Represents a plancton catch while a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TraitPlanctonCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ this.species = species;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitPlanctonCatchBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CatchBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,213 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+
+/**
+ * Represents a catch of species while a trait.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class TraitSpeciesCatchBean extends AbstractTuttiBean implements TraitCatchBeanAware{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * When catch was observed.
+ *
+ * @since 0.2
+ */
+ protected TraitBean trait;
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBean species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Is catch is vrac or horsVrac?.
+ *
+ * @since 0.2
+ */
+ protected VracHorsVracEnum vracHorsVrac;
+
+ /**
+ * Weight category (can be null).
+ *
+ * @since 0.2
+ */
+ protected WeightCategoryBean weightCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected SexBean sex;
+
+ /**
+ * Maturity (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float maturity;
+
+ /**
+ * Age (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float age;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float elevationRatio;
+
+ public TraitBean getTrait() {
+ return trait;
+ }
+
+ public void setTrait(TraitBean trait) {
+ this.trait = trait;
+ }
+
+ public SpeciesBean getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(SpeciesBean species) {
+ this.species = species;
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ this.speciesToConfirm = speciesToConfirm;
+ }
+
+ public boolean isSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ this.speciesToConfirm = speciesToConfirm;
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ this.vracHorsVrac = vracHorsVrac;
+ }
+
+ public WeightCategoryBean getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategoryBean weightCategory) {
+ this.weightCategory = weightCategory;
+ }
+
+ public SexBean getSex() {
+ return sex;
+ }
+
+ public void setSex(SexBean sex) {
+ this.sex = sex;
+ }
+
+ public Float getMaturity() {
+ return maturity;
+ }
+
+ public void setMaturity(Float maturity) {
+ this.maturity = maturity;
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ this.age = age;
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ this.weight = weight;
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ this.sampleWeight = sampleWeight;
+ }
+
+ public Float getElevationRatio() {
+ return elevationRatio;
+ }
+
+ public void setElevationRatio(Float elevationRatio) {
+ this.elevationRatio = elevationRatio;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TraitSpeciesCatchBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a user.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class UserBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a vessel.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class VesselBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,10 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public enum VracHorsVracEnum {
+ VRAC,
+ HORS_VRAC
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VracHorsVracEnum.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,47 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * Represents a survey zone.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class ZoneBean extends AbstractTuttiBean {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/BeaufortScaleBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a beaufort scale.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BeaufortScaleBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/BeaufortScaleBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CountryBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a country.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class CountryBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CountryBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/GearBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a gear.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class GearBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/GearBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SeaStateBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents the sea state.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SeaStateBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SeaStateBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SexBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,48 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a sex.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SexBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SexBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,58 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a fishes species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String codeMemo;
+
+ protected String genusSpecies;
+
+ public String getCodeMemo() {
+ return codeMemo;
+ }
+
+ public void setCodeMemo(String codeMemo) {
+ this.codeMemo = codeMemo;
+ }
+
+ public String getGenusSpecies() {
+ return genusSpecies;
+ }
+
+ public void setGenusSpecies(String genusSpecies) {
+ this.genusSpecies = genusSpecies;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/SpeciesBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/UserBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class UserBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/UserBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/VesselBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a vessel.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class VesselBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/VesselBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,25 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a weight category.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class WeightCategoryBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/WeightCategoryBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java (from rev 23, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/ZoneBean.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
+
+/**
+ * Represents a survey zone.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class ZoneBean extends AbstractTuttiBean {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/ZoneBean.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,21 +24,19 @@
* #L%
*/
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
-import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.SexBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
+import com.google.common.collect.ArrayListMultimap;
+import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
-import fr.ifremer.tutti.persistence.entities.SurveyBean;
-import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import java.util.List;
import java.util.UUID;
@@ -51,169 +49,145 @@
*/
public class TuttiPersistenceDevFixtures {
- protected final List<CampaignBean> campaign = Lists.newArrayList();
+ protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache;
- protected final List<SurveyBean> survey = Lists.newArrayList();
-
- protected final List<ZoneBean> zone = Lists.newArrayList();
-
- protected final List<TraitBean> trait = Lists.newArrayList();
-
- protected final List<CountryBean> country = Lists.newArrayList();
-
- protected final List<VesselBean> vessel = Lists.newArrayList();
-
- protected final List<GearBean> gear = Lists.newArrayList();
-
- protected final List<UserBean> user = Lists.newArrayList();
-
- protected final List<StrataBean> strata = Lists.newArrayList();
-
- protected final List<SeaStateBean> seaState = Lists.newArrayList();
-
- protected final List<BeaufortScaleBean> beaufortScale = Lists.newArrayList();
-
- protected final List<SpeciesBean> species = Lists.newArrayList();
-
- protected final List<CatchBean> catches = Lists.newArrayList();
-
- protected final List<SexBean> sex = Lists.newArrayList();
-
public TuttiPersistenceDevFixtures() {
- // inject default datas
+ // inject default datas (only referential)
+ cache = ArrayListMultimap.create();
+
ZoneBean b;
b = new ZoneBean();
b.setId(UUID.randomUUID().toString());
b.setName("zone1");
- zone.add(b);
+ cache.put(ZoneBean.class, b);
b = new ZoneBean();
b.setId(UUID.randomUUID().toString());
b.setName("zone2");
- zone.add(b);
+ cache.put(ZoneBean.class, b);
CountryBean c;
c = new CountryBean();
c.setId(UUID.randomUUID().toString());
c.setName("France");
- country.add(c);
+ cache.put(CountryBean.class, c);
c = new CountryBean();
c.setId(UUID.randomUUID().toString());
c.setName("Espagne");
- country.add(c);
+ cache.put(CountryBean.class, c);
VesselBean v;
v = new VesselBean();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA");
- vessel.add(v);
+ cache.put(VesselBean.class, v);
v = new VesselBean();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA-II");
- vessel.add(v);
+ cache.put(VesselBean.class, v);
GearBean g;
g = new GearBean();
g.setId(UUID.randomUUID().toString());
g.setName("Gear-1");
- gear.add(g);
+ cache.put(GearBean.class, g);
g = new GearBean();
g.setId(UUID.randomUUID().toString());
g.setName("Gear-2");
- gear.add(g);
+ cache.put(GearBean.class, g);
UserBean u;
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Vincent Badts");
- user.add(u);
+ cache.put(UserBean.class, u);
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Jean claude Mahet");
- user.add(u);
+ cache.put(UserBean.class, u);
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Luisa Metral");
- user.add(u);
+ cache.put(UserBean.class, u);
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Jean Hervé Bourdeix");
- user.add(u);
+ cache.put(UserBean.class, u);
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Ysabelle Cheret");
- user.add(u);
+ cache.put(UserBean.class, u);
u = new UserBean();
u.setId(UUID.randomUUID().toString());
u.setName("Blandine Brisset");
- user.add(u);
+ cache.put(UserBean.class, u);
BeaufortScaleBean bs;
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Calme");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Très légère brise");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Petite brise");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Jolie brise");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Vent frais");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Grand frais");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Coup de vent");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
bs = new BeaufortScaleBean();
bs.setId(UUID.randomUUID().toString());
bs.setName("Fort coup de vent");
- beaufortScale.add(bs);
+ cache.put(BeaufortScaleBean.class, bs);
SeaStateBean st;
st = new SeaStateBean();
st.setId(UUID.randomUUID().toString());
st.setName("Mer calme");
- seaState.add(st);
+ cache.put(SeaStateBean.class, st);
st = new SeaStateBean();
st.setId(UUID.randomUUID().toString());
st.setName("Mer agitée");
- seaState.add(st);
+ cache.put(SeaStateBean.class, st);
SpeciesBean sp;
@@ -221,101 +195,108 @@
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("BAR");
sp.setGenusSpecies("Bar");
- species.add(sp);
+ cache.put(SpeciesBean.class, sp);
sp = new SpeciesBean();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("CHIN");
sp.setGenusSpecies("Chinchard");
- species.add(sp);
+ cache.put(SpeciesBean.class, sp);
sp = new SpeciesBean();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("FLE");
sp.setGenusSpecies("Flet");
- species.add(sp);
+ cache.put(SpeciesBean.class, sp);
sp = new SpeciesBean();
sp.setId(UUID.randomUUID().toString());
sp.setCodeMemo("LIM");
sp.setGenusSpecies("Limande");
- species.add(sp);
+ cache.put(SpeciesBean.class, sp);
SexBean se;
se = new SexBean();
se.setId(UUID.randomUUID().toString());
se.setName("Male");
- sex.add(se);
+ cache.put(SexBean.class, se);
se = new SexBean();
se.setId(UUID.randomUUID().toString());
se.setName("Male");
- sex.add(se);
+ cache.put(SexBean.class, se);
se = new SexBean();
se.setId(UUID.randomUUID().toString());
se.setName("Femelle");
- sex.add(se);
+ cache.put(SexBean.class, se);
se = new SexBean();
se.setId(UUID.randomUUID().toString());
se.setName("Indéterminé");
- sex.add(se);
- }
+ cache.put(SexBean.class, se);
- public List<CampaignBean> campaign() {
- return campaign;
- }
+ WeightCategoryBean wc;
- public List<SurveyBean> survey() {
- return survey;
+ wc = new WeightCategoryBean();
+ wc.setId(UUID.randomUUID().toString());
+ wc.setName("Petit");
+ cache.put(WeightCategoryBean.class, wc);
+
+ wc = new WeightCategoryBean();
+ wc.setId(UUID.randomUUID().toString());
+ wc.setName("Gros");
+ cache.put(WeightCategoryBean.class, wc);
+
}
public List<ZoneBean> zone() {
- return zone;
+ return getData(ZoneBean.class);
}
- public List<TraitBean> trait() {
- return trait;
- }
-
public List<CountryBean> country() {
- return country;
+ return getData(CountryBean.class);
}
+
public List<VesselBean> vessel() {
- return vessel;
+ return getData(VesselBean.class);
}
public List<GearBean> gear() {
- return gear;
+ return getData(GearBean.class);
}
public List<UserBean> user() {
- return user;
+ return getData(UserBean.class);
}
public List<StrataBean> strata() {
- return strata;
+ return getData(StrataBean.class);
}
public List<SeaStateBean> seaState() {
- return seaState;
+ return getData(SeaStateBean.class);
}
public List<BeaufortScaleBean> beaufortScale() {
- return beaufortScale;
+ return getData(BeaufortScaleBean.class);
}
public List<SpeciesBean> species() {
- return species;
+ return getData(SpeciesBean.class);
}
- public List<CatchBean> catches() {
- return catches;
+ public List<SexBean> sex() {
+ return getData(SexBean.class);
}
- public List<SexBean> sex() {
- return sex;
+ public List<WeightCategoryBean> weightCategory() {
+ return getData(WeightCategoryBean.class);
}
+
+ protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) {
+ List<B> result = (List<B>) cache.get(entityType);
+ return result;
+ }
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -26,25 +26,32 @@
import com.google.common.base.Predicate;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
import fr.ifremer.tutti.persistence.entities.AbstractTuttiBean;
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.SexBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitCatchBeanAware;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
import fr.ifremer.tutti.persistence.entities.TuttiBeans;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -73,33 +80,29 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceDevImpl.class);
- protected final List<CampaignBean> campaign = Lists.newArrayList();
+ protected final ArrayListMultimap<Class<? extends AbstractTuttiBean>, AbstractTuttiBean> cache = ArrayListMultimap.create();
- protected final List<SurveyBean> survey = Lists.newArrayList();
+ public static final List<Class<? extends AbstractTuttiBean>> TYPES = Lists.newArrayList(
+ BeaufortScaleBean.class,
+ CampaignBean.class,
+ CountryBean.class,
+ GearBean.class,
+ SeaStateBean.class,
+ SexBean.class,
+ SpeciesBean.class,
+ SurveyBean.class,
+ TraitBean.class,
+ TraitBenthosCatchBean.class,
+ TraitSpeciesCatchBean.class,
+ TraitPlanctonCatchBean.class,
+ TraitMacroDechetCatchBean.class,
+ TraitCaptureAccidentelCatchBean.class,
+ UserBean.class,
+ VesselBean.class,
+ WeightCategoryBean.class,
+ ZoneBean.class
+ );
- protected final List<ZoneBean> zone = Lists.newArrayList();
-
- protected final List<TraitBean> trait = Lists.newArrayList();
-
- protected final List<CountryBean> country = Lists.newArrayList();
-
- protected final List<VesselBean> vessel = Lists.newArrayList();
-
- protected final List<GearBean> gear = Lists.newArrayList();
-
- protected final List<UserBean> user = Lists.newArrayList();
-
- protected final List<StrataBean> strata = Lists.newArrayList();
-
- protected final List<SeaStateBean> seaState = Lists.newArrayList();
-
- protected final List<BeaufortScaleBean> beaufortScale = Lists.newArrayList();
-
- protected final List<SpeciesBean> species = Lists.newArrayList();
-
- protected final List<CatchBean> catches = Lists.newArrayList();
- protected final List<SexBean> sex= Lists.newArrayList();
-
@Override
public String getImplementationName() {
return "Persistence Dev implementation";
@@ -117,129 +120,100 @@
throw new RuntimeException("Could not create directory", e);
}
- user.clear();
- country.clear();
- vessel.clear();
- gear.clear();
- zone.clear();
- survey.clear();
- campaign.clear();
- trait.clear();
- strata.clear();
- seaState.clear();
- beaufortScale.clear();
- species.clear();
- catches.clear();
- sex.clear();
+ cache.clear();
TuttiPersistenceDevFixtures fixtures =
new TuttiPersistenceDevFixtures();
- user.addAll(loadEntities(UserBean.class, fixtures.user()));
- country.addAll(loadEntities(CountryBean.class, fixtures.country()));
- vessel.addAll(loadEntities(VesselBean.class, fixtures.vessel()));
- gear.addAll(loadEntities(GearBean.class, fixtures.gear()));
- zone.addAll(loadEntities(ZoneBean.class, fixtures.zone()));
- survey.addAll(loadEntities(SurveyBean.class, fixtures.survey()));
- campaign.addAll(loadEntities(CampaignBean.class, fixtures.campaign()));
- trait.addAll(loadEntities(TraitBean.class, fixtures.trait()));
- strata.addAll(loadEntities(StrataBean.class, fixtures.strata()));
- seaState.addAll(loadEntities(SeaStateBean.class, fixtures.seaState()));
- beaufortScale.addAll(loadEntities(BeaufortScaleBean.class, fixtures.beaufortScale()));
- species.addAll(loadEntities(SpeciesBean.class, fixtures.species()));
- catches.addAll(loadEntities(CatchBean.class, fixtures.catches()));
- sex.addAll(loadEntities(SexBean.class, fixtures.sex()));
+ for (Class<? extends AbstractTuttiBean> entityType : TYPES) {
+ loadEntities(entityType, fixtures);
+ }
}
@Override
public void close() throws IOException {
- persistToFile(UserBean.class, user);
- persistToFile(CountryBean.class, country);
- persistToFile(VesselBean.class, vessel);
- persistToFile(GearBean.class, gear);
- persistToFile(ZoneBean.class, zone);
- persistToFile(SurveyBean.class, survey);
- persistToFile(CampaignBean.class, campaign);
- persistToFile(TraitBean.class, trait);
- persistToFile(StrataBean.class, strata);
- persistToFile(SeaStateBean.class, seaState);
- persistToFile(BeaufortScaleBean.class, beaufortScale);
- persistToFile(SpeciesBean.class, species);
- persistToFile(CatchBean.class, catches);
- persistToFile(SexBean.class, sex);
+ for (Class<? extends AbstractTuttiBean> entityType : cache.keySet()) {
+ persistToFile(entityType);
+ }
}
@Override
+ public List<WeightCategoryBean> getAllWeightCategories() {
+ List<WeightCategoryBean> result = getDataInNewList(WeightCategoryBean.class);
+ return result;
+ }
+
+ @Override
public List<SexBean> getAllSex() {
- List<SexBean> result = Lists.newArrayList(sex);
+ List<SexBean> result = getDataInNewList(SexBean.class);
return result;
}
@Override
public List<SpeciesBean> getAllSpecies() {
- List<SpeciesBean> result = Lists.newArrayList(species);
+ List<SpeciesBean> result = getDataInNewList(SpeciesBean.class);
return result;
}
@Override
public List<SurveyBean> getAllSurveys() {
- List<SurveyBean> result = Lists.newArrayList(survey);
+ List<SurveyBean> result = getDataInNewList(SurveyBean.class);
return result;
}
@Override
public List<ZoneBean> getAllZones() {
- List<ZoneBean> result = Lists.newArrayList(zone);
+ List<ZoneBean> result = getDataInNewList(ZoneBean.class);
return result;
}
@Override
public List<CountryBean> getAllCountries() {
- List<CountryBean> result = Lists.newArrayList(country);
+ List<CountryBean> result = getDataInNewList(CountryBean.class);
return result;
}
@Override
public List<VesselBean> getAllVessels() {
- List<VesselBean> result = Lists.newArrayList(vessel);
+ List<VesselBean> result = getDataInNewList(VesselBean.class);
return result;
}
@Override
public List<GearBean> getAllGears() {
- List<GearBean> result = Lists.newArrayList(gear);
+ List<GearBean> result = getDataInNewList(GearBean.class);
return result;
}
@Override
public List<UserBean> getAllUsers() {
- List<UserBean> result = Lists.newArrayList(user);
+ List<UserBean> result = getDataInNewList(UserBean.class);
return result;
}
@Override
public List<SeaStateBean> getAllSeaStates() {
- List<SeaStateBean> result = Lists.newArrayList(seaState);
+ List<SeaStateBean> result = getDataInNewList(SeaStateBean.class);
return result;
}
@Override
public List<StrataBean> getAllStratas() {
- List<StrataBean> result = Lists.newArrayList(strata);
+ List<StrataBean> result = getDataInNewList(StrataBean.class);
return result;
}
@Override
public List<BeaufortScaleBean> getAllBeaufortScales() {
- List<BeaufortScaleBean> result = Lists.newArrayList(beaufortScale);
+ List<BeaufortScaleBean> result = getDataInNewList(BeaufortScaleBean.class);
return result;
}
@Override
public List<CampaignBean> getAllCampaigns(final String surveyId) {
- List<CampaignBean> result = Lists.newArrayList(Iterables.filter(campaign, new Predicate<CampaignBean>() {
+ List<CampaignBean> result = Lists.newArrayList(Iterables.filter(getData(CampaignBean.class), new Predicate<CampaignBean>() {
@Override
public boolean apply(CampaignBean input) {
return surveyId.equals(input.getSurvey().getId());
@@ -250,7 +224,7 @@
@Override
public List<TraitBean> getAllTraits(final String campaignId) {
- List<TraitBean> result = Lists.newArrayList(Iterables.filter(trait, new Predicate<TraitBean>() {
+ List<TraitBean> result = Lists.newArrayList(Iterables.filter(getData(TraitBean.class), new Predicate<TraitBean>() {
@Override
public boolean apply(TraitBean input) {
return campaignId.equals(input.getCampaign().getId());
@@ -260,93 +234,107 @@
}
@Override
- public List<CatchBean> getAllCatches(final String traitId) {
- List<CatchBean> result = Lists.newArrayList(Iterables.filter(catches, new Predicate<CatchBean>() {
- @Override
- public boolean apply(CatchBean input) {
- return traitId.equals(input.getTrait().getId());
- }
- }));
- return result;
+ public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(final String traitId) {
+ return getAllTraitFilterCatches(TraitSpeciesCatchBean.class, traitId);
}
@Override
+ public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) {
+ return getAllTraitFilterCatches(TraitBenthosCatchBean.class, traitId);
+ }
+
+ @Override
+ public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) {
+ return getAllTraitFilterCatches(TraitPlanctonCatchBean.class, traitId);
+ }
+
+ @Override
+ public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) {
+ return getAllTraitFilterCatches(TraitMacroDechetCatchBean.class, traitId);
+ }
+
+ @Override
+ public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) {
+ return getAllTraitFilterCatches(TraitCaptureAccidentelCatchBean.class, traitId);
+ }
+
+ @Override
public SurveyBean getSurvey(String surveyId) {
- SurveyBean result = TuttiBeans.findById(survey, surveyId);
+ SurveyBean result = TuttiBeans.findById(getData(SurveyBean.class), surveyId);
return result;
}
@Override
public CampaignBean getCampaign(String campaignId) {
- CampaignBean result = TuttiBeans.findById(campaign, campaignId);
+ CampaignBean result = TuttiBeans.findById(getData(CampaignBean.class), campaignId);
return result;
}
@Override
public TraitBean getTrait(String traitId) {
- TraitBean result = TuttiBeans.findById(trait, traitId);
+ TraitBean result = TuttiBeans.findById(getData(TraitBean.class), traitId);
return result;
}
@Override
public SurveyBean createSurvey(SurveyBean bean) {
SurveyBean result = new SurveyBean();
- persist(SurveyBean.class, bean, result, survey);
+ persist(SurveyBean.class, bean, result);
return result;
}
@Override
public SurveyBean saveSurvey(SurveyBean bean) {
SurveyBean result = getSurvey(bean.getId());
- persist(SurveyBean.class, bean, result, survey);
+ persist(SurveyBean.class, bean, result);
return result;
}
@Override
public CampaignBean createCampaign(CampaignBean bean) {
CampaignBean result = new CampaignBean();
- persist(CampaignBean.class, bean, result, campaign);
+ persist(CampaignBean.class, bean, result);
return result;
}
@Override
public CampaignBean saveCampaign(CampaignBean bean) {
CampaignBean result = getCampaign(bean.getId());
- persist(CampaignBean.class, bean, result, campaign);
+ persist(CampaignBean.class, bean, result);
return result;
}
@Override
public TraitBean createTrait(TraitBean bean) {
TraitBean result = new TraitBean();
- persist(TraitBean.class, bean, result, trait);
+ persist(TraitBean.class, bean, result);
return result;
}
@Override
public TraitBean saveTrait(TraitBean bean) {
TraitBean result = getTrait(bean.getId());
- persist(TraitBean.class, bean, result, trait);
+ persist(TraitBean.class, bean, result);
return result;
}
protected <B extends AbstractTuttiBean> void persist(Class<B> beanType,
- B source,
- B target,
- List<B> entities) {
+ B source, B target) {
+
BinderFactory.newBinder(beanType).copyExcluding(
source, target, "id");
if (source.getId() == null) {
target.setId(UUID.randomUUID().toString());
}
- if (!entities.contains(target)) {
- entities.add(target);
+ if (!cache.containsValue(target)) {
+ cache.put(beanType, target);
}
- persistToFile(beanType, entities);
+ persistToFile(beanType);
}
- protected <B> List<B> loadEntities(Class<B> entityType,
- List<B> defaultList) throws IOException {
+ protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType,
+ TuttiPersistenceDevFixtures fix
+ ) throws IOException {
File storageFile = getStorageFile(entityType);
List<B> result;
@@ -362,6 +350,43 @@
result = (List<B>) oos.readObject();
oos.close();
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Could not find a class ", e);
+ } finally {
+ IOUtils.closeQuietly(oos);
+ }
+
+ cache.putAll(entityType, result);
+ } else {
+
+ result = fix.getData(entityType);
+
+ cache.putAll(entityType, result);
+
+ // persist it right now
+ persistToFile(entityType);
+ }
+
+ return result;
+ }
+
+ protected <B extends AbstractTuttiBean> List<B> loadEntities(Class<B> entityType,
+ List<B> defaultList) throws IOException {
+ File storageFile = getStorageFile(entityType);
+
+ List<B> result;
+
+ if (storageFile.exists()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load data from file: " + storageFile);
+ }
+
+ ObjectInputStream oos =
+ new ObjectInputStream(new FileInputStream(storageFile));
+ try {
+
+ result = (List<B>) oos.readObject();
+ oos.close();
return result;
} catch (ClassNotFoundException e) {
throw new RuntimeException("Could not find a class ", e);
@@ -373,8 +398,10 @@
result = defaultList;
// persist it right now
- persistToFile(entityType, result);
+ persistToFile(entityType);
}
+
+ cache.putAll(entityType, result);
return result;
}
@@ -385,8 +412,9 @@
return result;
}
- protected <B> void persistToFile(Class<B> entityType, List<B> entities) {
+ protected <B extends AbstractTuttiBean> void persistToFile(Class<B> entityType) {
+ List<B> entities = getDataInNewList(entityType);
File storageFile = getStorageFile(entityType);
if (log.isDebugEnabled()) {
@@ -408,4 +436,24 @@
}
}
+ protected <B extends AbstractTuttiBean> List<B> getData(Class<B> entityType) {
+ List<B> result = (List<B>) cache.get(entityType);
+ return result;
+ }
+
+ protected <B extends AbstractTuttiBean> List<B> getDataInNewList(Class<B> entityType) {
+ List<B> result = getData(entityType);
+ return Lists.newArrayList(result);
+ }
+
+ protected <B extends AbstractTuttiBean & TraitCatchBeanAware> List<B> getAllTraitFilterCatches(Class<B> beanType,final String traitId) {
+ List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), new Predicate<B>() {
+ @Override
+ public boolean apply(B input) {
+ return traitId.equals(input.getTrait().getId());
+ }
+ }));
+ return result;
+ }
+
}
Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
===================================================================
--- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -84,7 +84,7 @@
Assert.assertTrue(storageDirectory.exists());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.survey().size(), persistence.getAllSurveys().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
}
@Test
@@ -97,11 +97,11 @@
persistence.open(config.getConfig());
TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.survey().size(), persistence.getAllSurveys().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
persistence.close();
Assert.assertTrue(storageDirectory.exists());
- Assert.assertEquals(fixtures.survey().size(), persistence.getAllSurveys().size());
+ Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaStates().size());
}
@Test
@@ -114,6 +114,8 @@
persistence.open(config.getConfig());
Assert.assertTrue(storageDirectory.exists());
+ int size = persistence.getAllSurveys().size();
+
SurveyBean s = new SurveyBean();
s.setId("46de4ba5-3be6-4ab6-9f39-586b8e491fda");
s.setName("Serie 3");
@@ -126,8 +128,7 @@
persistence.open(config.getConfig());
- TuttiPersistenceDevFixtures fixtures = new TuttiPersistenceDevFixtures();
- Assert.assertEquals(fixtures.survey().size() + 1, persistence.getAllSurveys().size());
+ Assert.assertEquals(size + 1, persistence.getAllSurveys().size());
}
public static File getTestSpecificDirectory(Class<?> testClassName,
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -24,19 +24,19 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.SexBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import org.nuiton.util.decorator.Decorator;
import org.nuiton.util.decorator.DecoratorProvider;
@@ -79,7 +79,7 @@
registerMultiJXPathDecorator(SurveyBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(CampaignBean.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${date}$td/%2$tm/%2$tY", "#", " - ");
+ registerMultiJXPathDecorator(TraitBean.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%2$tm/%2$tY", "#", " - ");
registerMultiJXPathDecorator(ZoneBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(VesselBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(CountryBean.class, "${name}$s", "#", " - ");
@@ -90,6 +90,8 @@
registerMultiJXPathDecorator(StrataBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(SexBean.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(SpeciesBean.class, "${codeMemo}#${genusSpecies}$s", "#", " - ");
+ registerMultiJXPathDecorator(SpeciesBean.class, "byCode", "${codeMemo}#${genusSpecies}$s", "#", " - ");
+ registerMultiJXPathDecorator(SpeciesBean.class, "byGenius", "${genusSpecies}$s#${codeMemo}$s", "#", " - ");
}
};
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-11-28 09:28:45 UTC (rev 24)
@@ -26,20 +26,25 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.BeaufortScaleBean;
import fr.ifremer.tutti.persistence.entities.CampaignBean;
-import fr.ifremer.tutti.persistence.entities.CatchBean;
-import fr.ifremer.tutti.persistence.entities.CountryBean;
-import fr.ifremer.tutti.persistence.entities.GearBean;
-import fr.ifremer.tutti.persistence.entities.SeaStateBean;
-import fr.ifremer.tutti.persistence.entities.SexBean;
-import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.StrataBean;
import fr.ifremer.tutti.persistence.entities.SurveyBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
-import fr.ifremer.tutti.persistence.entities.UserBean;
-import fr.ifremer.tutti.persistence.entities.VesselBean;
-import fr.ifremer.tutti.persistence.entities.ZoneBean;
+import fr.ifremer.tutti.persistence.entities.TraitBenthosCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitCaptureAccidentelCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitMacroDechetCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitPlanctonCatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitSpeciesCatchBean;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScaleBean;
+import fr.ifremer.tutti.persistence.entities.referential.CountryBean;
+import fr.ifremer.tutti.persistence.entities.referential.GearBean;
+import fr.ifremer.tutti.persistence.entities.referential.SeaStateBean;
+import fr.ifremer.tutti.persistence.entities.referential.SexBean;
+import fr.ifremer.tutti.persistence.entities.referential.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.referential.UserBean;
+import fr.ifremer.tutti.persistence.entities.referential.VesselBean;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategoryBean;
+import fr.ifremer.tutti.persistence.entities.referential.ZoneBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
@@ -113,6 +118,12 @@
}
@Override
+ public List<WeightCategoryBean> getAllWeightCategories() {
+ checkDriverExists();
+ return driver.getAllWeightCategories();
+ }
+
+ @Override
public List<SexBean> getAllSex() {
checkDriverExists();
return driver.getAllSex();
@@ -197,12 +208,36 @@
}
@Override
- public List<CatchBean> getAllCatches(String traitId) {
+ public List<TraitSpeciesCatchBean> getAllTraitSpeciesCatch(String traitId) {
checkDriverExists();
- return driver.getAllCatches(traitId);
+ return driver.getAllTraitSpeciesCatch(traitId);
}
@Override
+ public List<TraitBenthosCatchBean> getAllTraitBenthosCatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllTraitBenthosCatch(traitId);
+ }
+
+ @Override
+ public List<TraitPlanctonCatchBean> getAllTraitPlanctonCatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllTraitPlanctonCatch(traitId);
+ }
+
+ @Override
+ public List<TraitMacroDechetCatchBean> getAllTraitMacroDechetCatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllTraitMacroDechetCatch(traitId);
+ }
+
+ @Override
+ public List<TraitCaptureAccidentelCatchBean> getAllTraitCaptureAccidentelCatch(String traitId) {
+ checkDriverExists();
+ return driver.getAllTraitCaptureAccidentelCatch(traitId);
+ }
+
+ @Override
public SurveyBean getSurvey(String surveyId) {
checkDriverExists();
return driver.getSurvey(surveyId);
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-11-26 10:32:29 UTC (rev 23)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-11-28 09:28:45 UTC (rev 24)
@@ -1,11 +1,8 @@
tutti.config.application.site.url=Url du site internet de l'application
tutti.config.application.version=Version de l'application
-tutti.config.campaignId=Identifiant de la dernière campagne utilisée
tutti.config.data.directory=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp).
tutti.config.license.organizationName=Nom de l'organisation dans la licence
-tutti.config.surveyId=Identifiant de la dernière série de campagne utilisée
tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application)
-tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.property.beaufortScaleBean=Vent beaufort
tutti.property.campaignBean=Campagne
tutti.property.codeMemo=Code Memo
1
0
r23 - in trunk: . tutti-persistence tutti-persistence-dev tutti-service tutti-ui-swing
by tchemit@users.forge.codelutin.com 26 Nov '12
by tchemit@users.forge.codelutin.com 26 Nov '12
26 Nov '12
Author: tchemit
Date: 2012-11-26 11:32:29 +0100 (Mon, 26 Nov 2012)
New Revision: 23
Url: http://forge.codelutin.com/repositories/revision/tutti/23
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/tutti-persistence-dev/pom.xml
trunk/tutti-persistence/pom.xml
trunk/tutti-service/pom.xml
trunk/tutti-ui-swing/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-11-26 10:32:21 UTC (rev 22)
+++ trunk/pom.xml 2012-11-26 10:32:29 UTC (rev 23)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
<modules>
<module>tutti-persistence</module>
@@ -57,12 +57,12 @@
</developers>
<scm>
- <url>http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1</url>
+ <url>http://svn.forge.codelutin.com/svn/tutti/trunk</url>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
</developerConnection>
</scm>
Modified: trunk/tutti-persistence/pom.xml
===================================================================
--- trunk/tutti-persistence/pom.xml 2012-11-26 10:32:21 UTC (rev 22)
+++ trunk/tutti-persistence/pom.xml 2012-11-26 10:32:29 UTC (rev 23)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-persistence-dev/pom.xml
===================================================================
--- trunk/tutti-persistence-dev/pom.xml 2012-11-26 10:32:21 UTC (rev 22)
+++ trunk/tutti-persistence-dev/pom.xml 2012-11-26 10:32:29 UTC (rev 23)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-service/pom.xml
===================================================================
--- trunk/tutti-service/pom.xml 2012-11-26 10:32:21 UTC (rev 22)
+++ trunk/tutti-service/pom.xml 2012-11-26 10:32:29 UTC (rev 23)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-11-26 10:32:21 UTC (rev 22)
+++ trunk/tutti-ui-swing/pom.xml 2012-11-26 10:32:29 UTC (rev 23)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
1
0
Author: tchemit
Date: 2012-11-26 11:32:21 +0100 (Mon, 26 Nov 2012)
New Revision: 22
Url: http://forge.codelutin.com/repositories/revision/tutti/22
Log:
[maven-release-plugin] copy for tag tutti-0.1
Added:
tags/tutti-0.1/
1
0
r21 - in trunk: . tutti-persistence tutti-persistence-dev tutti-service tutti-ui-swing
by tchemit@users.forge.codelutin.com 26 Nov '12
by tchemit@users.forge.codelutin.com 26 Nov '12
26 Nov '12
Author: tchemit
Date: 2012-11-26 11:32:13 +0100 (Mon, 26 Nov 2012)
New Revision: 21
Url: http://forge.codelutin.com/repositories/revision/tutti/21
Log:
[maven-release-plugin] prepare release tutti-0.1
Modified:
trunk/pom.xml
trunk/tutti-persistence-dev/pom.xml
trunk/tutti-persistence/pom.xml
trunk/tutti-service/pom.xml
trunk/tutti-ui-swing/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-11-26 10:27:11 UTC (rev 20)
+++ trunk/pom.xml 2012-11-26 10:32:13 UTC (rev 21)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.1</version>
<modules>
<module>tutti-persistence</module>
@@ -57,12 +57,12 @@
</developers>
<scm>
- <url>http://svn.forge.codelutin.com/svn/tutti/trunk</url>
+ <url>http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1</url>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/tutti/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/tutti/tags/tutti-0.1
</developerConnection>
</scm>
Modified: trunk/tutti-persistence/pom.xml
===================================================================
--- trunk/tutti-persistence/pom.xml 2012-11-26 10:27:11 UTC (rev 20)
+++ trunk/tutti-persistence/pom.xml 2012-11-26 10:32:13 UTC (rev 21)
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.1</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-persistence-dev/pom.xml
===================================================================
--- trunk/tutti-persistence-dev/pom.xml 2012-11-26 10:27:11 UTC (rev 20)
+++ trunk/tutti-persistence-dev/pom.xml 2012-11-26 10:32:13 UTC (rev 21)
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.1</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-service/pom.xml
===================================================================
--- trunk/tutti-service/pom.xml 2012-11-26 10:27:11 UTC (rev 20)
+++ trunk/tutti-service/pom.xml 2012-11-26 10:32:13 UTC (rev 21)
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.1</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-11-26 10:27:11 UTC (rev 20)
+++ trunk/tutti-ui-swing/pom.xml 2012-11-26 10:32:13 UTC (rev 21)
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>tutti</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.1</version>
</parent>
<groupId>fr.ifremer.tutti</groupId>
1
0
r20 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/campaign java/fr/ifremer/tutti/ui/swing/content/catches resources/i18n resources/icons
by tchemit@users.forge.codelutin.com 26 Nov '12
by tchemit@users.forge.codelutin.com 26 Nov '12
26 Nov '12
Author: tchemit
Date: 2012-11-26 11:27:11 +0100 (Mon, 26 Nov 2012)
New Revision: 20
Url: http://forge.codelutin.com/repositories/revision/tutti/20
Log:
add benthos tab
continue catches tab
fix casino import icon
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/resources/icons/action-pupitri-import.png
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-11-26 10:27:11 UTC (rev 20)
@@ -152,7 +152,7 @@
}
#importCasinoButton {
- actionIcon:"casion-import";
+ actionIcon:"casino-import";
text:"tutti.action.casino-import";
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css 2012-11-26 10:27:11 UTC (rev 20)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.benthos.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.benthos.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx 2012-11-26 10:27:11 UTC (rev 20)
@@ -0,0 +1,99 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<JPanel id='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.BeaufortScaleBean
+ fr.ifremer.tutti.persistence.entities.SeaStateBean
+ fr.ifremer.tutti.persistence.entities.StrataBean
+ fr.ifremer.tutti.persistence.entities.TraitBean
+ fr.ifremer.tutti.persistence.entities.UserBean
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public BenthosTabUI(CatchesUI parentUI) {
+ BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectTrait(TraitBean trait) { handler.selectTrait(trait); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosTabUIHandler id='handler'
+ initializer='getContextValue(BenthosTabUIHandler.class)'/>
+
+ <BenthosTabUIModel id='model'
+ initializer='getContextValue(BenthosTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <!--field name='comment' component='commentField'/-->
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -0,0 +1,180 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.CatchBean;
+import fr.ifremer.tutti.persistence.entities.SpeciesBean;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
+
+ private final BenthosTabUI ui;
+
+ private final CatchesUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ BenthosTabUIModel model = new BenthosTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<CatchBean>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ BenthosTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected BenthosTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectTrait(TraitBean bean) {
+
+ boolean empty = bean == null;
+
+ BenthosTabUIModel model = ui.getModel();
+
+ List<CatchBean> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new TraitBean();
+ } else {
+ catches = persistenceService.getAllCatches(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import fr.ifremer.tutti.persistence.entities.CatchBean;
+import fr.ifremer.tutti.persistence.entities.TraitBean;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<CatchBean> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<CatchBean> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<CatchBean> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(TraitBean bean) {
+ BinderFactory.newBinder(TraitBean.class,
+ BenthosTabUIModel.class).copy(bean, this);
+ }
+
+ public TraitBean toBean() {
+ TraitBean result = new TraitBean();
+ BinderFactory.newBinder(BenthosTabUIModel.class,
+ TraitBean.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CatchBean;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<CatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public BenthosTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<CatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new CatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/BenthosTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-11-26 10:27:11 UTC (rev 20)
@@ -74,7 +74,7 @@
<FishesTabUI id='fishesTabContent' constructorParams='this'/>
</tab>
<tab id='benthosTab' title='tutti.label.tab.benthos'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
</tab>
<tab id='planctonTab' title='tutti.label.tab.plancton'>
<JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -152,12 +152,12 @@
// propagate trait to his tabs
ui.getTraitTabContent().selectTrait(selectedTrait);
+ ui.getFishesTabContent().selectTrait(selectedTrait);
+ ui.getBenthosTabContent().selectTrait(selectedTrait);
// repaint tabs
ui.getTabPane().repaint();
-// ui.getFishesTabContent().selectTrait(selectedTrait);
-// ui.getBenthosTabContent().selectTrait(selectedTrait);
// ui.getPlanctonTabContent().selectTrait(selectedTrait);
// ui.getMacroDechetsTabContent().selectTrait(selectedTrait);
// ui.getCaptureAccidentellesTabContent().selectTrait(selectedTrait);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.css 2012-11-26 10:27:11 UTC (rev 20)
@@ -65,6 +65,7 @@
numberPattern:{INT_6_DIGITS_PATTERN};
}
-#fishesTable {
- model:{new FishesTableModel()};
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUI.jaxx 2012-11-26 10:27:11 UTC (rev 20)
@@ -37,6 +37,9 @@
jaxx.runtime.validator.swing.SwingValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
static org.nuiton.i18n.I18n._
</import>
@@ -96,7 +99,7 @@
</Table>
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='fishesTable'/>
+ <JTable id='table'/>
</JScrollPane>
</JPanel>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTabUIHandler.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -25,14 +25,29 @@
*/
import fr.ifremer.tutti.persistence.entities.CatchBean;
+import fr.ifremer.tutti.persistence.entities.SpeciesBean;
import fr.ifremer.tutti.persistence.entities.TraitBean;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.List;
+import static org.nuiton.i18n.I18n._;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
@@ -57,9 +72,146 @@
@Override
public void beforeInitUI() {
+
FishesTabUIModel model = new FishesTabUIModel();
+ ui.setContextValue(model);
- ui.setContextValue(model);
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ DefaultTableCellRenderer dRender = new DefaultTableCellRenderer();
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<SpeciesBean> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+ col.setCellRenderer(newTableCellRender(SpeciesBean.class));
+ col.setHeaderValue(_("tutti.table.fishes.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Vrac / Hors vrac
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.vracHorsVrac"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("vracHorsVrac");
+ columnModel.addColumn(col);
+
+ // Catégorie de poids
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.weightCategory"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weightCategory");
+ columnModel.addColumn(col);
+
+ // Sex
+ col = new TableColumn(3);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.sex"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("sex");
+ columnModel.addColumn(col);
+
+ // Maturity
+ col = new TableColumn(4);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.maturity"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("maturity");
+ columnModel.addColumn(col);
+
+ // Age
+ col = new TableColumn(5);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.age"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("age");
+ columnModel.addColumn(col);
+
+ // Type de mensuration
+ col = new TableColumn(6);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.mensurationType"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("mensurationType");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(7);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Poids calculé
+ col = new TableColumn(8);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.computedWeight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedWeight");
+ columnModel.addColumn(col);
+
+ // Nombre calculé
+ col = new TableColumn(9);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.computedNumber"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ // Poids d'échantillon
+ col = new TableColumn(10);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.sampleWeight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("sampleWeight");
+ columnModel.addColumn(col);
+
+ // Fraction d'élévation
+ col = new TableColumn(11);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.fishes.header.elevationRate"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("elevationRate");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final FishesTableModel tableModel = new FishesTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(FishesTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<CatchBean>) evt.getNewValue());
+ }
+ });
+
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishesTableModel.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -24,11 +24,14 @@
* #L%
*/
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CatchBean;
+
import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
/**
- * TODO
- *
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
@@ -36,18 +39,40 @@
private static final long serialVersionUID = 1L;
+ protected List<CatchBean> data;
+
+ protected final TableColumnModel columnModel;
+
+ public FishesTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<CatchBean> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new CatchBean());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
@Override
public int getRowCount() {
- return 0;
+ return data == null ? 0 : data.size();
}
@Override
public int getColumnCount() {
- return 0;
+ return columnModel.getColumnCount();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return null;
}
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-11-26 10:27:11 UTC (rev 20)
@@ -477,6 +477,11 @@
enabled:{model.isModify()};
}
+#importPupitriButton {
+ actionIcon:"pupitri-import";
+ text:"tutti.action.pupitri-import";
+}
+
#messagePanel {
border:{BorderFactory.createTitledBorder("Messages")};
height:200;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-11-26 10:27:11 UTC (rev 20)
@@ -527,10 +527,16 @@
</JTabbedPane>
<!-- Actions -->
- <JPanel layout='{new GridLayout(1,2,0,0)}' constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.NORTH'>
+ <JButton id='importPupitriButton' onActionPerformed='handler.importPupitri()'/>
+ </JPanel>
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
</JPanel>
+
</JPanel>
<JLabel id='noTraitPane'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-11-26 10:27:11 UTC (rev 20)
@@ -24,7 +24,6 @@
* #L%
*/
-import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.TraitBean;
import fr.ifremer.tutti.persistence.entities.UserBean;
import fr.ifremer.tutti.service.PersistenceService;
@@ -33,11 +32,9 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.validator.bean.simple.SimpleBeanValidator;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import javax.swing.ListSelectionModel;
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -121,7 +118,7 @@
model.setEmpty(true);
- listenValidatorValid(ui.getValidator(),getModel() );
+ listenValidatorValid(ui.getValidator(), getModel());
}
@Override
@@ -207,6 +204,10 @@
ui.getTraitTabPane().setSelectedIndex(selectedIndex);
}
+ public void importPupitri() {
+ //TODO
+ }
+
public void setGearShootingStartLatitude(String text) {
ui.getModel().setGearShootingStartLatitude(Float.valueOf(text));
}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-11-26 10:26:20 UTC (rev 19)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-11-26 10:27:11 UTC (rev 20)
@@ -15,6 +15,7 @@
tutti.action.manageProtocol=Protocole
tutti.action.manageProtocol.tip=Gérer les protocoles
tutti.action.new=Nouveau
+tutti.action.pupitri-import=Import PUPITRI
tutti.action.reload.actions=Recharger les actions
tutti.action.reload.home=Reload home screen
tutti.action.reload.ui=Recharger l'interface graphique
@@ -41,6 +42,8 @@
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
+tutti.label.benthos.sampleTotalWeight=Poids échantilloné observé
+tutti.label.benthos.totalWeight=Poids total observé
tutti.label.campaign=Campagne
tutti.label.campaign.country=Pays
tutti.label.campaign.name=Nom
@@ -119,6 +122,32 @@
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
tutti.service.config=Configuration des services de Tutti
+tutti.table.benthos.header.number=Nb ob.
+tutti.table.benthos.header.speciesByCode=Espèce
+tutti.table.benthos.header.weight=Poids ob.
+tutti.table.fishes.header.age=Age
+tutti.table.fishes.header.computedNumber=Nombre calculé
+tutti.table.fishes.header.computedNumber.tip=Nombre calculé
+tutti.table.fishes.header.computedWeight=Poids calculé
+tutti.table.fishes.header.computedWeight.tip=Poids calculé
+tutti.table.fishes.header.elevationRate=Fraction d'él
+tutti.table.fishes.header.elevationRate.tip=Fraction d'él
+tutti.table.fishes.header.maturity=Maturité
+tutti.table.fishes.header.maturity.tip=Maturié
+tutti.table.fishes.header.mensurationType=Type de mensuration
+tutti.table.fishes.header.mensurationType.tip=Type de mensuration
+tutti.table.fishes.header.sampleWeight=Poids échan
+tutti.table.fishes.header.sampleWeight.tip=Poids échan
+tutti.table.fishes.header.sex=Sexe
+tutti.table.fishes.header.sex.tip=Sexe
+tutti.table.fishes.header.speciesByCode=Espèce
+tutti.table.fishes.header.speciesByCode.tip=Espèce
+tutti.table.fishes.header.vracHorsVrac=Vrac / Hors Vrac
+tutti.table.fishes.header.vracHorsVrac.tip=Vrac / Hors Vrac
+tutti.table.fishes.header.weight=Poids
+tutti.table.fishes.header.weight.tip=Poids
+tutti.table.fishes.header.weightCategory=Catégorie Poids
+tutti.table.fishes.header.weightCategory.tip=Catégorie Poids
tutti.title.about=A propos de Tutti
tutti.title.create.campaign=Créer une nouvelle campagne
tutti.title.create.survey=Créer une nouvelle série de campagne
Copied: trunk/tutti-ui-swing/src/main/resources/icons/action-pupitri-import.png (from rev 18, trunk/tutti-ui-swing/src/main/resources/icons/action-casino-import.png)
===================================================================
(Binary files differ)
1
0