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
r49 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities
by tchemit@users.forge.codelutin.com 12 Dec '12
by tchemit@users.forge.codelutin.com 12 Dec '12
12 Dec '12
Author: tchemit
Date: 2012-12-12 23:25:46 +0100 (Wed, 12 Dec 2012)
New Revision: 49
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/49
Log:
make identiy of entity on his id
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-12 17:28:37 UTC (rev 48)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-12 22:25:46 UTC (rev 49)
@@ -59,4 +59,20 @@
protected <B> B getChild(List<B> child, int index) {
return CollectionUtil.getOrNull(child, index);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AbstractTuttiEntity)) return false;
+
+ AbstractTuttiEntity that = (AbstractTuttiEntity) o;
+
+ return !(id != null ? !id.equals(that.id) : that.id != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
}
\ No newline at end of file
1
0
12 Dec '12
Author: tchemit
Date: 2012-12-12 18:28:37 +0100 (Wed, 12 Dec 2012)
New Revision: 48
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/48
Log:
make tests works on jenkins
Added:
trunk/tutti-ui-swing/src/test/resources/
trunk/tutti-ui-swing/src/test/resources/log4j.properties
Copied: trunk/tutti-ui-swing/src/test/resources/log4j.properties (from rev 46, trunk/tutti-ui-swing/src/main/resources/log4j.properties)
===================================================================
--- trunk/tutti-ui-swing/src/test/resources/log4j.properties (rev 0)
+++ trunk/tutti-ui-swing/src/test/resources/log4j.properties 2012-12-12 17:28:37 UTC (rev 48)
@@ -0,0 +1,33 @@
+###
+# #%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%
+###
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+
+# Console output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+# tutti levels
+log4j.logger.fr.ifremer=INFO
1
0
r47 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content: . operation operation/accidental operation/benthos operation/macrowaste operation/plankton operation/species
by tchemit@users.forge.codelutin.com 12 Dec '12
by tchemit@users.forge.codelutin.com 12 Dec '12
12 Dec '12
Author: tchemit
Date: 2012-12-12 18:22:58 +0100 (Wed, 12 Dec 2012)
New Revision: 47
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/47
Log:
move last ui from catches package to operation package
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -28,10 +28,10 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
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.operation.accidental.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanctonTabUI
fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css (from rev 46, 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/operation/accidental/AccidentelTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -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/operation/accidental/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/operation/accidental/AccidentelTabUI.jaxx (from rev 46, 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/operation/accidental/AccidentelTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -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.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ 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(FishingOperationsUI parentUI) {
+ AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+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/operation/accidental/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/operation/accidental/AccidentelTabUIHandler.java (from rev 46, 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/operation/accidental/AccidentelTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%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.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+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 FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public AccidentelTabUIHandler(FishingOperationsUI 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<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.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<SpeciesBatch>) 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 selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ AccidentelTabUIModel model = ui.getModel();
+
+ List<AccidentelBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllAccidentelBatch(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/operation/accidental/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/operation/accidental/AccidentelTabUIModel.java (from rev 46, 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/operation/accidental/AccidentelTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%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.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+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<AccidentelBatch> 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<AccidentelBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<AccidentelBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ AccidentelTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(AccidentelTabUIModel.class,
+ FishingOperation.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/operation/accidental/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/operation/accidental/AccidentelTableModel.java (from rev 46, 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/operation/accidental/AccidentelTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%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.data.SpeciesBatch;
+
+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<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public AccidentelTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ 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/operation/accidental/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/operation/benthos/BenthosTabUI.css (from rev 46, 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/operation/benthos/BenthosTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -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/operation/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/operation/benthos/BenthosTabUI.jaxx (from rev 46, 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/operation/benthos/BenthosTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -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.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ 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(FishingOperationsUI parentUI) {
+ BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+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/operation/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/operation/benthos/BenthosTabUIHandler.java (from rev 46, 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/operation/benthos/BenthosTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+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 FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public BenthosTabUIHandler(FishingOperationsUI 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<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.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<SpeciesBatch>) 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 selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ BenthosTabUIModel model = ui.getModel();
+
+ List<BenthosBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllBenthosBatch(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/operation/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/operation/benthos/BenthosTabUIModel.java (from rev 46, 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/operation/benthos/BenthosTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+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<BenthosBatch> 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<BenthosBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<BenthosBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ BenthosTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(BenthosTabUIModel.class,
+ FishingOperation.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/operation/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/operation/benthos/BenthosTableModel.java (from rev 46, 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/operation/benthos/BenthosTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.SpeciesBatch;
+
+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<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public BenthosTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ 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/operation/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/operation/macrowaste/MacroDechetTabUI.css (from rev 46, 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/operation/macrowaste/MacroDechetTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -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/operation/macrowaste/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/operation/macrowaste/MacroDechetTabUI.jaxx (from rev 46, 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/operation/macrowaste/MacroDechetTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -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.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ 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(FishingOperationsUI parentUI) {
+ MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+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/operation/macrowaste/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/operation/macrowaste/MacroDechetTabUIHandler.java (from rev 46, 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/operation/macrowaste/MacroDechetTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%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.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+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 FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public MacroDechetTabUIHandler(FishingOperationsUI 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<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.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<SpeciesBatch>) 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 selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ MacroDechetTabUIModel model = ui.getModel();
+
+ List<MacroDechetBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllMacroDechetBatch(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/operation/macrowaste/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/operation/macrowaste/MacroDechetTabUIModel.java (from rev 46, 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/operation/macrowaste/MacroDechetTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%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.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+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<MacroDechetBatch> 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<MacroDechetBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<MacroDechetBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ MacroDechetTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(MacroDechetTabUIModel.class,
+ FishingOperation.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/operation/macrowaste/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/operation/macrowaste/MacroDechetTableModel.java (from rev 46, 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/operation/macrowaste/MacroDechetTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%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.data.SpeciesBatch;
+
+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<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public MacroDechetTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ 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/operation/macrowaste/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/operation/plankton/PlanctonTabUI.css (from rev 46, 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/operation/plankton/PlanctonTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -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/operation/plankton/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/operation/plankton/PlanctonTabUI.jaxx (from rev 46, 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/operation/plankton/PlanctonTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -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.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ 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(FishingOperationsUI parentUI) {
+ PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+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/operation/plankton/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/operation/plankton/PlanctonTabUIHandler.java (from rev 46, 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/operation/plankton/PlanctonTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%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.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+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 FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public PlanctonTabUIHandler(FishingOperationsUI 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<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.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<SpeciesBatch>) 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 selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ PlanctonTabUIModel model = ui.getModel();
+
+ List<PlanctonBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllPlanctonBatch(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/operation/plankton/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/operation/plankton/PlanctonTabUIModel.java (from rev 46, 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/operation/plankton/PlanctonTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%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.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+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<PlanctonBatch> 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<PlanctonBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<PlanctonBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ PlanctonTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(PlanctonTabUIModel.class,
+ FishingOperation.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/operation/plankton/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/operation/plankton/PlanctonTableModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%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.data.SpeciesBatch;
+
+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<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public PlanctonTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ 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/operation/plankton/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/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -318,8 +318,9 @@
SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
- if (SAMPLING_PROPERTIES.contains(propertyName)) {
+ if (SAMPLING_PROPERTIES.contains(propertyName) && row.isValid()) {
+
// Need to rebuilt this row sampling tree path (and then recompute
// old super - samplingRatio and new super - samplingRatio)
@@ -333,7 +334,8 @@
moveSamplingNode(samplingTreeModel, row, oldNode, newNode);
}
- if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName) &&
+ row.isValid()) {
// Need to recompute the super - samplingRatio
1
0
12 Dec '12
Author: tchemit
Date: 2012-12-12 18:06:45 +0100 (Wed, 12 Dec 2012)
New Revision: 46
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/46
Log:
- move frequency to their correct pakcage
- being to implement the sampling logic for species batch
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -33,7 +33,7 @@
actionIcon: "add";
}
-#traitComboBox {
+#fishingOperationComboBox {
property: "selectedFishingOperation";
selectedItem: {model.getSelectedFishingOperation()};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -62,7 +62,7 @@
<!-- FishingOperations fishingOperation -->
<row>
<cell anchor='west' weightx='1.0'>
- <BeanComboBox id='traitComboBox' constructorParams='this'
+ <BeanComboBox id='fishingOperationComboBox' constructorParams='this'
genericType='FishingOperation'/>
</cell>
<cell anchor='east'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -25,8 +25,8 @@
*/
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
@@ -48,13 +48,15 @@
public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
/** Logger. */
- private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
+ private static final Log log =
+ LogFactory.getLog(FishingOperationsUIHandler.class);
private final FishingOperationsUI ui;
private final PersistenceService persistenceService;
- public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
+ public FishingOperationsUIHandler(TuttiUIContext context,
+ FishingOperationsUI ui) {
super(context);
this.ui = ui;
persistenceService = context.getService(PersistenceService.class);
@@ -63,6 +65,9 @@
@Override
public void beforeInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("for " + ui);
+ }
FishingOperationsUIModel model = new FishingOperationsUIModel();
String cruiseId = context.getCruiseId();
@@ -71,11 +76,13 @@
Cruise cruise = persistenceService.getCruise(cruiseId);
model.setCruise(cruise);
- List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(cruiseId);
+ List<FishingOperation> fishingOperations =
+ persistenceService.getAllFishingOperation(cruiseId);
model.setFishingOperation(fishingOperations);
if (log.isInfoEnabled()) {
- log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
+ log.info("Loaded " + fishingOperations.size() +
+ " fishingOperation(s).");
}
ui.setContextValue(model);
@@ -90,7 +97,7 @@
List<FishingOperation> fishingOperations = model.getFishingOperation();
- initBeanComboBox(ui.getTraitComboBox(),
+ initBeanComboBox(ui.getFishingOperationComboBox(),
fishingOperations,
model.getSelectedFishingOperation());
@@ -104,8 +111,8 @@
model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
+ ui.getFishingOperationComboBox().setData(null);
+ ui.getFishingOperationComboBox().setData((List<FishingOperation>) evt.getNewValue());
}
});
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -25,7 +25,6 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -32,7 +32,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -101,7 +101,7 @@
n_("tutti.table.species.batch.header.sampleWeight"),
n_("tutti.table.species.batch.header.sampleWeight"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
n_("tutti.table.species.batch.header.elevationRate"),
n_("tutti.table.species.batch.header.elevationRate"));
@@ -122,12 +122,9 @@
public SpeciesBatchTableModel(TableColumnModel columnModel) {
super(columnModel);
- // TODO This will be dynamic by the protocol...
setNoneEditableCols(
- AGE,
- MATURITY,
SAMPLE_WEIGHT,
- ELEVATION_RATIO,
+ SAMPLING_RATIO,
FILE
);
noneEditableColIfNoSpecies = Sets.newHashSet();
@@ -177,6 +174,17 @@
}
}
+ public void updateSamplingRatio(Set<SpeciesBatchRowModel> rows) {
+ for (SpeciesBatchRowModel row : rows) {
+ int rowIndex = getRows().indexOf(row);
+ fireTableCellUpdated(rowIndex,
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO);
+ }
+
+
+ }
+
@Override
protected boolean isCellEditable(int rowIndex,
int columnIndex,
@@ -196,5 +204,4 @@
}
return result;
}
-
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,12 +24,14 @@
* #L%
*/
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -51,52 +53,180 @@
*
* @since 0.2
*/
- protected final String[] samplingOrder;
+ protected String[] samplingOrder;
/**
- * Samplings view as a linear list (to display in the table).
+ * Mapping from row to node.
*
* @since 0.2
*/
- protected final List<SpeciesBatchTreeNode> lines;
+ protected final Map<SpeciesBatchRowModel, SpeciesBatchTreeNode> rowToNode;
+ /**
+ * Mapping from node to row.
+ *
+ * @since 0.2
+ */
+ protected final Map<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
+
+
public SpeciesBatchTreeModel(String... samplingOrder) {
this.samplingOrder = samplingOrder;
root = new SpeciesBatchTreeNode();
- lines = Lists.newArrayList();
+ rowToNode = Maps.newHashMap();
+ nodeToRow = Maps.newHashMap();
}
- public SpeciesBatchTreeNode getNode(int rowIndex) {
- return lines.get(rowIndex);
+ public void populate(List<SpeciesBatchRowModel> rows) {
+
+ clear();
+
+ for (SpeciesBatchRowModel row : rows) {
+
+ SpeciesBatchTreeNode node = getSamplingNode(row);
+
+ nodeToRow.put(node, row);
+ }
}
- public int getSize() {
- return lines.size();
+ public String[] getSamplingOrder() {
+ return samplingOrder;
}
- public void populate(List<SpeciesBatch> data) {
+ public void setSamplingOrder(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ clear();
+ }
+ protected void clear() {
// clear tree representation
root.removeAllChildren();
- // clear linear representation
- lines.clear();
+ // clear mappings
+ rowToNode.clear();
+ nodeToRow.clear();
}
- public Object[] getSamplingKey(SpeciesBatch bean) {
- List<Object> result = Lists.newArrayList();
- for (String s : samplingOrder) {
- Object property = TuttiUIUtil.getProperty(bean, s);
- if (property == null) {
- // stop findind sample key
- break;
+
+ public SpeciesBatchTreeNode removeNodeFromCache(SpeciesBatchRowModel row) {
+ SpeciesBatchTreeNode result = rowToNode.remove(row);
+ if (result != null) {
+
+ nodeToRow.remove(result);
+ }
+ return result;
+ }
+
+ public SpeciesBatchTreeNode getSamplingNode(SpeciesBatchRowModel row) {
+
+ // search frist in cache
+ SpeciesBatchTreeNode result = rowToNode.get(row);
+
+ if (result == null) {
+
+ // not in cache must build the path
+ result = getSamplingNode(root, 0, row);
+
+ // and add it in cache
+ rowToNode.put(row, result);
+ }
+ return result;
+ }
+
+ protected SpeciesBatchTreeNode getSamplingNode(SpeciesBatchTreeNode node,
+ int samplingIndex,
+ SpeciesBatchRowModel row) {
+
+ String samplingKey = samplingOrder[samplingIndex];
+
+ Serializable samplingValue = (Serializable)
+ TuttiUIUtil.getProperty(row, samplingKey);
+
+ SpeciesBatchTreeNode result;
+
+ if (samplingValue == null) {
+
+ // was already on last sampling node
+ result = node;
+ } else {
+
+ result = node.getChild(samplingValue);
+
+ if (result == null) {
+
+ // new node, creates it and add it as child of current node
+ result = new SpeciesBatchTreeNode(samplingKey, samplingValue);
+ node.add(result);
}
- result.add(property);
+
+ if (samplingIndex < samplingOrder.length) {
+
+ // can try to find yet another sampling level
+ result = getSamplingNode(result, samplingIndex + 1, row);
+ }
}
- return result.toArray();
+
+ return result;
}
- public String[] getSamplingDefinition(SpeciesBatch bean) {
- return null;
+ public SamplingContext createSamplingContext(SpeciesBatchTreeNode rootNode) {
+
+ Set<SpeciesBatchRowModel> childRows = Sets.newHashSet();
+
+ SpeciesBatchRowModel superSamplingRow = nodeToRow.get(rootNode);
+ float totalWeight = 0f;
+ for (int i = 0, nbChildren = rootNode.getChildCount(); i < nbChildren; i++) {
+ SpeciesBatchTreeNode node = rootNode.getChildAt(i);
+ SpeciesBatchRowModel row = nodeToRow.get(node);
+ if (row != null) {
+ childRows.add(row);
+ Float weight = row.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
+ }
+ }
+ SamplingContext result = new SamplingContext(rootNode,
+ superSamplingRow,
+ childRows,
+ totalWeight);
+ return result;
}
+
+ public static class SamplingContext {
+
+ private final SpeciesBatchTreeNode rootNode;
+
+ private final SpeciesBatchRowModel superSamplingRow;
+
+ private final Set<SpeciesBatchRowModel> samplingRows;
+
+ private final float totalWeight;
+
+ public SamplingContext(SpeciesBatchTreeNode rootNode,
+ SpeciesBatchRowModel superSamplingRow,
+ Set<SpeciesBatchRowModel> samplingRows,
+ float totalWeight) {
+ this.rootNode = rootNode;
+ this.superSamplingRow = superSamplingRow;
+ this.samplingRows = samplingRows;
+ this.totalWeight = totalWeight;
+ }
+
+ public SpeciesBatchTreeNode getRootNode() {
+ return rootNode;
+ }
+
+ public SpeciesBatchRowModel getSuperSamplingRow() {
+ return superSamplingRow;
+ }
+
+ public Set<SpeciesBatchRowModel> getSamplingRows() {
+ return samplingRows;
+ }
+
+ public float getTotalWeight() {
+ return totalWeight;
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,20 +24,18 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import org.apache.commons.lang3.ObjectUtils;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import java.io.Serializable;
/**
- * Defines a node of a species catches.
+ * Defines a node of a species catches sampling.
* <p/>
- * UserObject is the {@link SpeciesBatch}. 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>
+ * A path in the tree gives a sampling path.
+ * <p/>
+ * UserObject is the {@code samplingValue}. It can be null only on root node.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
@@ -53,43 +51,55 @@
*
* @since 0.2
*/
- protected final String samplingPropertyKey;
+ protected final String samplingKey;
- /**
- * Property value defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final Serializable samplingPropertyValue;
-
public SpeciesBatchTreeNode() {
- this(null, null, null);
+ this(null, null);
}
- public SpeciesBatchTreeNode(SpeciesBatch userObject,
- String samplingPropertyKey,
- Serializable samplingPropertyValue) {
- this.samplingPropertyKey = samplingPropertyKey;
- this.samplingPropertyValue = samplingPropertyValue;
- setUserObject(userObject);
+ public SpeciesBatchTreeNode(String samplingKey,
+ Serializable samplingValue) {
+ this.samplingKey = samplingKey;
+ setUserObject(samplingValue);
}
public String getSamplingPropertyKey() {
- return samplingPropertyKey;
+ return samplingKey;
}
- public Serializable getSamplingPropertyValue() {
- return samplingPropertyValue;
+ public boolean matchSamplingValue(Serializable value) {
+ Serializable samplingValue = getUserObject();
+
+ boolean result = ObjectUtils.equals(value, samplingValue);
+ return result;
}
+ public SpeciesBatchTreeNode getChild(Serializable samplingValue) {
+ SpeciesBatchTreeNode result = null;
+
+ for (int i = 0, max = getChildCount(); i < max; i++) {
+ SpeciesBatchTreeNode child = getChildAt(i);
+ if (child.matchSamplingValue(samplingValue)) {
+
+ // found matching child
+ result = child;
+ break;
+ }
+ }
+ return result;
+ }
+
@Override
- public SpeciesBatch getUserObject() {
- return (SpeciesBatch) super.getUserObject();
+ public Serializable getUserObject() {
+ return (Serializable) super.getUserObject();
}
@Override
+ public SpeciesBatchTreeNode getChildAt(int index) {
+ return (SpeciesBatchTreeNode) super.getChildAt(index);
+ }
+
+ @Override
public SpeciesBatchTreeNode getParent() {
return (SpeciesBatchTreeNode) super.getParent();
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,169 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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 com.google.common.collect.Ordering;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Represents a batch frequency row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_LENGTH_STEP = "lengthStep";
+
+ public static final String PROPERTY_NUMBER = "number";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ /**
+ * Length step.
+ *
+ * @since 0.2
+ */
+ protected Float lengthStep;
+
+ /**
+ * Count of fishes for this lengthStep.
+ *
+ * @since 0.2
+ */
+ protected Integer number;
+
+ /**
+ * Weight of fishes observed.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Computed weight from number + relation taille-poids.
+ *
+ * @since 0.2
+ */
+ protected Float computedWeight;
+
+ protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchFrequency.class,
+ SpeciesFrequencyRowModel.class);
+
+ protected static final Binder<SpeciesFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder =
+ BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
+ SpeciesBatchFrequency.class);
+
+ private static final Ordering<Float> ordering = Ordering.natural().nullsFirst();
+
+ public static List<SpeciesFrequencyRowModel> fromBeans(List<SpeciesBatchFrequency> frequency) {
+ List<SpeciesFrequencyRowModel> result = Lists.newArrayList();
+ for (SpeciesBatchFrequency b : frequency) {
+ SpeciesFrequencyRowModel model = new SpeciesFrequencyRowModel();
+ fromBeanBinder.copy(b, model);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public static List<SpeciesBatchFrequency> toBeans(List<SpeciesFrequencyRowModel> frequency, SpeciesBatch batch) {
+ List<SpeciesBatchFrequency> result = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel b : frequency) {
+ SpeciesBatchFrequency model = new SpeciesBatchFrequency();
+ toBeanBinder.copy(b, model);
+ model.setBatch(batch);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public SpeciesFrequencyRowModel() {
+ super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Float getLengthStep() {
+ return lengthStep;
+ }
+
+ public void setLengthStep(Float lengthStep) {
+ Object oldValue = getLengthStep();
+ this.lengthStep = lengthStep;
+ firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ Object oldValue = getNumber();
+ this.number = number;
+ firePropertyChange(PROPERTY_NUMBER, oldValue, number);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getComputedWeight() {
+ return computedWeight;
+ }
+
+ public void setComputedWeight(Float computedWeight) {
+ Object oldValue = getComputedWeight();
+ this.computedWeight = computedWeight;
+ firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
+ }
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return lengthStep != null && number != null;
+ }
+
+ @Override
+ public int compareTo(SpeciesFrequencyRowModel o) {
+ int result = ordering.compare(lengthStep, o.lengthStep);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.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/operation/species/SpeciesFrequencyTableModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,145 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.Maps;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Model of the species frequency table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> LENGTH_STEP = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ n_("tutti.table.species.frequency.header.lengthStep"),
+ n_("tutti.table.species.frequency.header.lengthStep"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> NUMBER = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ n_("tutti.table.species.frequency.header.number"),
+ n_("tutti.table.species.frequency.header.number"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.frequency.header.weight"),
+ n_("tutti.table.species.frequency.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.frequency.header.computedWeight"),
+ n_("tutti.table.species.frequency.header.computedWeight"));
+
+ private final SpeciesFrequencyUIModel uiModel;
+
+ private final Map<Float, SpeciesFrequencyRowModel> rowCache;
+
+ public SpeciesFrequencyTableModel(TableColumnModel columnModel,
+ SpeciesFrequencyUIModel uiModel) {
+ super(columnModel);
+ this.uiModel = uiModel;
+ this.rowCache = Maps.newTreeMap();
+ setNoneEditableCols(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesFrequencyRowModel createNewRow() {
+ Float defaultStep = null;
+
+ int rowCount = getRowCount();
+ if (rowCount > 0) {
+
+ SpeciesFrequencyRowModel rowModel = getEntry(rowCount - 1);
+ Float lengthStep = rowModel.getLengthStep();
+ if (lengthStep != null) {
+ defaultStep = uiModel.getLengthStep(
+ lengthStep + uiModel.getStep());
+ }
+ }
+ SpeciesFrequencyRowModel result = new SpeciesFrequencyRowModel();
+ result.setLengthStep(defaultStep);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesFrequencyRowModel> propertyName,
+ SpeciesFrequencyRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ // TODO Rebuild the computedWeight if possible...
+ }
+
+ public Map<Float, SpeciesFrequencyRowModel> getRowCache() {
+ return rowCache;
+ }
+
+ @Override
+ protected void onRowsChanged(List<SpeciesFrequencyRowModel> data) {
+
+ // rebuild row cache
+ rowCache.clear();
+
+ for (SpeciesFrequencyRowModel row : data) {
+ Float lengthStep = row.getLengthStep();
+ if (lengthStep != null) {
+ rowCache.put(lengthStep, row);
+ }
+ }
+ }
+
+ @Override
+ protected void onRowAdded(int rowIndex, SpeciesFrequencyRowModel newValue) {
+
+ Preconditions.checkNotNull(newValue, "can't add a null row");
+
+ // add new row to cache
+ Float lengthStep = newValue.getLengthStep();
+
+ Preconditions.checkNotNull(lengthStep,
+ "can't add a null lengthStep row");
+
+ float roundLenghtValue = uiModel.getLengthStep(lengthStep);
+
+ if (!rowCache.containsKey(roundLenghtValue)) {
+
+ rowCache.put(roundLenghtValue, newValue);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.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/operation/species/SpeciesFrequencyUI.css (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,141 @@
+/*
+ * #%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()};
+}
+
+#stepLabel {
+ text: "tutti.label.frequencyConfiguration.step";
+ labelFor: {stepField};
+}
+
+#stepField {
+ property: "step";
+ model: {model.getStep()};
+ useFloat: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#minStepLabel {
+ text: "tutti.label.frequencyConfiguration.minStep";
+ labelFor: {minStepField};
+}
+
+#minStepField {
+ property: "minStep";
+ model: {model.getMinStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#maxStepLabel {
+ text: "tutti.label.frequencyConfiguration.maxStep";
+ labelFor: {maxStepField};
+}
+
+#maxStepField {
+ property: "maxStep";
+ model: {model.getMaxStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#rafaleStepLabel {
+ text: "tutti.label.frequencyConfiguration.rafaleStep";
+ labelFor: {rafaleStepField};
+}
+
+#rafaleStepField {
+ modelType: {Float.class};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+}
+
+#generateButton {
+ actionIcon: "generate";
+ text: "tutti.action.generate";
+ enabled: {model.isCanGenerate()};
+}
+
+#configurationPanel {
+ border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
+}
+
+#modeConfigurationLayout {
+ selected: {String.valueOf(mode.getSelectedValue())};
+}
+
+#modeConfigurationPanel {
+ layout: {modeConfigurationLayout};
+}
+
+#simpleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.simple";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.simple.tip";
+ value: "simpleMode";
+ selected: {model.isSimpleMode()};
+ buttonGroup: "mode";
+}
+
+#simpleModeLabel {
+ text: "tutti.label.frequencyConfiguration.no.configuration";
+ horizontalAlignment: {JLabel.CENTER};
+ enabled: false;
+}
+
+#autoGenModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.autoGen";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.autoGen.tip";
+ value: "autoGenMode";
+ selected: {model.isAutoGenMode()};
+ buttonGroup: "mode";
+}
+
+#rafaleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.rafale";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.rafale.tip";
+ value: "rafaleMode";
+ selected: {model.isRafaleMode()};
+ buttonGroup: "mode";
+}
+
+#closeButton {
+ actionIcon: "close";
+ text: "tutti.action.close";
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.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/operation/species/SpeciesFrequencyUI.jaxx (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,167 @@
+<!--
+ #%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<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel
+
+ jaxx.runtime.swing.CardLayout2Ext
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.NumberEditor
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+ javax.swing.SwingConstants
+
+ java.awt.Color
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+ public SpeciesFrequencyUI(TuttiUIContext context) {
+ SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+ handler.editBatch(row);
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SpeciesFrequencyUIHandler id='handler'
+ initializer='getContextValue(SpeciesFrequencyUIHandler.class)'/>
+
+ <SpeciesFrequencyUIModel id='model'
+ initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
+
+ <CardLayout2Ext id='modeConfigurationLayout'
+ constructorParams='this, "modeConfigurationPanel"'/>
+
+ <JPanel id='configurationPanel' layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
+
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
+ <VBox id='modePanel' constraints='BorderLayout.WEST'
+ verticalAlignment='{SwingConstants.CENTER}'>
+ <JRadioButton id='simpleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE)'/>
+ <JRadioButton id='autoGenModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.AUTO_GEN)'/>
+ <JRadioButton id='rafaleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.RAFALE)'/>
+ </VBox>
+
+ <JPanel id='modeConfigurationPanel' constraints='BorderLayout.CENTER'>
+ <JPanel id='simpleModePanel' constraints='"simpleMode"'
+ layout='{new BorderLayout()}'>
+ <JLabel id='simpleModeLabel' constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ <JPanel id='autoGenModePanel' constraints='"autoGenMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Min step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='minStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='minStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Max step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='maxStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='maxStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Actions -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='generateButton'
+ onActionPerformed='handler.generateLengthSteps()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ <JPanel id='rafaleModePanel' constraints='"rafaleMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Rafale step-->
+ <row>
+ <cell weightx='1.0'>
+ <JLabel id='rafaleStepLabel'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1.0'>
+ <NumberEditor id='rafaleStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </JPanel>
+ </JPanel>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <row>
+ <cell columns='2'>
+ <JSeparator/>
+ </cell>
+ </row>
+ <!-- Step -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='stepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'/>
+ </JScrollPane>
+
+ <!-- actions -->
+ <JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
+ constraints='BorderLayout.SOUTH'>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.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/operation/species/SpeciesFrequencyUIHandler.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,350 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+import javax.swing.JDialog;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesFrequencyUIHandler.class);
+
+ private final SpeciesFrequencyUI ui;
+
+ public SpeciesFrequencyUIHandler(TuttiUIContext context,
+ SpeciesFrequencyUI ui) {
+ super(context,
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected SpeciesFrequencyUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected SpeciesFrequencyTableModel getTableModel() {
+ return (SpeciesFrequencyTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // LengthStep
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.LENGTH_STEP,
+ TuttiUI.DECIMAL1_PATTERN);
+ }
+
+ { // Number
+
+ addIntegerColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.NUMBER,
+ TuttiUI.INT_6_DIGITS_PATTERN);
+ }
+
+ { // Weight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // ComputedWeight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.COMPUTED_WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesFrequencyRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+ if (SpeciesFrequencyRowModel.PROPERTY_NUMBER.equals(propertyName)) {
+
+ // Need to recompute the computedWeight
+ computeComputedWeight(row);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel();
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ // create table model
+ SpeciesFrequencyTableModel tableModel =
+ new SpeciesFrequencyTableModel(columnModel, model);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ //TODO Should it come from PROTOCOL or config ?
+ model.setStep(.5f);
+
+ model.setMinStep(10f);
+ model.setMaxStep(20f);
+
+ //TODO Configure this ?
+ model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+
+ ui.getRafaleStepField().getTextField().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ e.consume();
+ Float step = (Float) ui.getRafaleStepField().getModel();
+
+ applyRafaleStep(step);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void generateLengthSteps() {
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep =
+ getTableModel().getRowCache();
+
+ Float minStep = model.getLengthStep(model.getMinStep());
+ Float maxStep = model.getLengthStep(model.getMaxStep());
+
+ for (float i = minStep, step = model.getStep(); i <= maxStep; i += step) {
+ if (!rowsByStep.containsKey(i)) {
+
+ // add it
+ SpeciesFrequencyRowModel newRow = new SpeciesFrequencyRowModel();
+ newRow.setLengthStep(i);
+ rowsByStep.put(i, newRow);
+ }
+ }
+
+ List<SpeciesFrequencyRowModel> rows =
+ Lists.newArrayList(rowsByStep.values());
+
+ model.setRows(rows);
+ }
+
+ public void applyRafaleStep(Float step) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will apply rafale step: " + step);
+ }
+ SpeciesFrequencyUIModel model = getModel();
+ SpeciesFrequencyTableModel tableModel = getTableModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = tableModel.getRowCache();
+
+ float aroundLengthStep = model.getLengthStep(step);
+
+ SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+
+ int rowIndex;
+
+ if (row != null) {
+
+ // increments current row
+ Integer number = row.getNumber();
+ row.setNumber((number == null ? 0 : number) + 1);
+ rowIndex = tableModel.updateRow(row);
+
+ } else {
+
+ // create a new row
+ row = new SpeciesFrequencyRowModel();
+ row.setLengthStep(aroundLengthStep);
+ row.setNumber(1);
+
+ // get new index
+ List<Float> steps = Lists.newArrayList(rowsByStep.keySet());
+ steps.add(aroundLengthStep);
+
+ Collections.sort(steps);
+
+ rowIndex = steps.indexOf(aroundLengthStep);
+
+ tableModel.addNewRow(rowIndex, row);
+ }
+
+ getTable().scrollRowToVisible(rowIndex);
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+
+ List<SpeciesFrequencyRowModel> frequency = null;
+ if (row != null) {
+ frequency = row.getFrequency();
+ }
+
+ List<SpeciesFrequencyRowModel> editFrequency;
+ if (CollectionUtils.isEmpty(frequency)) {
+
+ // new list
+ editFrequency = Lists.newArrayList();
+ } else {
+
+ editFrequency = Lists.newArrayList(frequency);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit batch row: " + row + " with " +
+ editFrequency.size() + " frequency");
+ }
+ getModel().setRows(editFrequency);
+
+ // keep batch (will be used to push back editing entry)
+ getModel().setBatch(row);
+ }
+
+ public void close() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will close UI " + ui);
+ }
+
+ // transfer rows to editor
+
+ List<SpeciesFrequencyRowModel> frequency = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel row : getModel().getRows()) {
+ if (row.isValid()) {
+
+ // can keep this row
+ frequency.add(row);
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Push back " + frequency.size() +
+ " frequency to batch " + getModel().getBatch());
+ }
+
+ // push back to batch
+ getModel().getBatch().setFrequency(frequency);
+
+ ui.editBatch(null);
+
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected void computeComputedWeight(SpeciesFrequencyRowModel row) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will recompute computed weight for frequency: " + row);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.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/operation/species/SpeciesFrequencyUIModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,174 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.util.table.AbstractTuttiTableUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+
+ public static final String PROPERTY_STEP = "step";
+
+ private static final String PROPERTY_MIN_STEP = "minStep";
+
+ private static final String PROPERTY_MAX_STEP = "maxStep";
+
+ public static final String PROPERTY_CAN_GENERATE = "canGenerate";
+
+ public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
+
+ public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
+
+ public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
+
+ public static enum ConfigurationMode {
+ SIMPLE,
+ AUTO_GEN,
+ RAFALE
+ }
+
+ /**
+ * Fill mode.
+ *
+ * @since 0.2
+ */
+ protected ConfigurationMode configurationMode;
+
+ /**
+ * Batch that contains frequencies.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBatchRowModel batch;
+
+ /**
+ * Default step to increment length step.
+ *
+ * @since 0.2
+ */
+ protected float step;
+
+ /**
+ * Min step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float minStep;
+
+ /**
+ * Max step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float maxStep;
+
+ public SpeciesFrequencyUIModel() {
+ super(SpeciesBatchRowModel.class, null, null);
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return configurationMode;
+ }
+
+ public void setConfigurationMode(ConfigurationMode configurationMode) {
+ Object oldValue = getConfigurationMode();
+ this.configurationMode = configurationMode;
+ firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode);
+ firePropertyChange(PROPERTY_SIMPLE_MODE, null, isSimpleMode());
+ firePropertyChange(PROPERTY_AUTO_GEN_MODE, null, isAutoGenMode());
+ firePropertyChange(PROPERTY_RAFALE_MODE, null, isRafaleMode());
+ }
+
+ public float getStep() {
+ return step;
+ }
+
+ public void setStep(float step) {
+ Object oldValue = getStep();
+ this.step = step;
+ firePropertyChange(PROPERTY_STEP, oldValue, step);
+ }
+
+ public Float getMinStep() {
+ return minStep;
+ }
+
+ public void setMinStep(Float minStep) {
+ Object oldValue = getMinStep();
+ this.minStep = minStep;
+ firePropertyChange(PROPERTY_MIN_STEP, oldValue, minStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public Float getMaxStep() {
+ return maxStep;
+ }
+
+ public void setMaxStep(Float maxStep) {
+ Object oldValue = getMaxStep();
+ this.maxStep = maxStep;
+ firePropertyChange(PROPERTY_MAX_STEP, oldValue, maxStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public boolean isSimpleMode() {
+ return ConfigurationMode.SIMPLE == configurationMode;
+ }
+
+ public boolean isAutoGenMode() {
+ return ConfigurationMode.AUTO_GEN == configurationMode;
+ }
+
+ public boolean isRafaleMode() {
+ return ConfigurationMode.RAFALE == configurationMode;
+ }
+
+ public boolean isCanGenerate() {
+ return minStep != null && maxStep != null && maxStep > minStep;
+ }
+
+ public SpeciesBatchRowModel getBatch() {
+ return batch;
+ }
+
+ public void setBatch(SpeciesBatchRowModel batch) {
+ this.batch = batch;
+ }
+
+ public float getLengthStep(float lengthStep) {
+ int intValue = (int) (lengthStep * 10);
+ int intStep = (int) (step * 10);
+ int correctIntStep = intValue - (intValue % intStep);
+ float result = correctIntStep / 10f;
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.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/operation/species/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -71,10 +71,8 @@
}
#totalHorsVracWeightField {
- property: "totalHorsVracWeight";
- model: {model.getTotalHorsVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
+ text: {getStringValue(model.getTotalHorsVracWeight())};
+ editable: false;
}
#table {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -29,7 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
@@ -43,6 +43,7 @@
java.awt.Color
static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
</import>
<script><![CDATA[
@@ -106,7 +107,7 @@
<JLabel id='totalHorsVracWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ <JTextField id='totalHorsVracWeightField'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,7 +24,9 @@
* #L%
*/
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
@@ -37,9 +39,10 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,9 +52,13 @@
import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
+import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
import java.util.List;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -62,18 +69,45 @@
/** Logger. */
private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+ public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT
+ );
+
+ public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE
+ );
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
private final SpeciesTabUI ui;
- private final FishingOperationsUI parentUi;
-
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
private final PersistenceService persistenceService;
- private final BeanMonitor traitMonitor;
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final BeanMonitor fishingOperationMonitor;
public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
super(parentUi.getHandler().getContext(),
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
SpeciesBatchRowModel.PROPERTY_SEX,
@@ -85,9 +119,8 @@
SpeciesBatchRowModel.PROPERTY_COMMENT,
SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
- this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
- traitMonitor = new BeanMonitor(
+ this.fishingOperationMonitor = new BeanMonitor(
SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
@@ -95,9 +128,13 @@
);
}
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
@Override
- protected JXTable getTable() {
- return ui.getTable();
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
}
@Override
@@ -106,24 +143,242 @@
}
@Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
+ protected JXTable getTable() {
+ return ui.getTable();
}
@Override
+ protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // build the new sampling tree from the new rows to edit
+ getModel().getSamplingTreeModel().populate(rows);
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ List<String> samplingOrder = getModel().getSamplingOrder();
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC)) {
+
+ // Vrac / Hors vrac column
+
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
+ VracHorsVracEnum.values());
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY)) {
+
+ // WeightCategory column
+
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
+
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_SEX)) {
+
+ // Sex column
+
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
+
+ List<Sex> data = persistenceService.getAllSex();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_MATURITY)) {
+
+ // Maturity column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_AGE)) {
+
+ // Age column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Computed weight column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Computed number column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
+
+ // Need to recompute totalHorsVracWeight
+ recomputeTotalHorsVrac();
+ }
+
+ SpeciesTabUIModel model = getModel();
+
+ SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
+
+ if (SAMPLING_PROPERTIES.contains(propertyName)) {
+
+ // Need to rebuilt this row sampling tree path (and then recompute
+ // old super - samplingRatio and new super - samplingRatio)
+
+ // old node of the previous sampling def for this row
+ // and remove it from any cache
+ SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
+
+ // get new sampling node
+ SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
+
+ moveSamplingNode(samplingTreeModel, row, oldNode, newNode);
+ }
+
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+
+ // Need to recompute the super - samplingRatio
+
+ SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
+
+ recomputeSuperSamplingRatio(samplingTreeModel, row, node);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
public void beforeInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
SpeciesTabUIModel model = new SpeciesTabUIModel();
ui.setContextValue(model);
- traitMonitor.setBean(model);
+ fishingOperationMonitor.setBean(model);
}
@Override
public void afterInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
initUI(ui);
+ //TODO Will come from protocol
+ List<String> samplingOrder = Lists.newArrayList(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX
+ );
+
+ getModel().setSamplingOrder(samplingOrder);
+
JXTable table = getTable();
// create table column model
@@ -146,7 +401,14 @@
listenRowsFromModel();
// save when row chaged and was modified
- listenRowModification(table);
+ ListSelectionListener listener = new TableRowModificationListener<SpeciesBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
// always scroll to selected row
SwingUtil.scrollToTableSelection(getTable());
@@ -154,41 +416,33 @@
@Override
public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
}
- @Override
- protected void saveRow(SpeciesBatchRowModel row) {
- SpeciesBatch catchBean = row.toBean();
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
- FishingOperation fishingOperation = getModel().getTrait();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
+ public void saveSelectedRowIfRequired(FocusEvent event) {
- if (TuttiEntities.isNew(catchBean)) {
+ Component oppositeComponent = event.getOppositeComponent();
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
+ JXTable parentContainer = null;
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+ if (oppositeComponent != null) {
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
}
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
+ if (parentContainer == null) {
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
+ // out of the table can save
+ saveSelectedRowIfRequired();
+ }
}
public void selectFishingOperation(FishingOperation bean) {
@@ -201,11 +455,11 @@
table.editingCanceled(null);
}
- if (traitMonitor.wasModified()) {
+ if (fishingOperationMonitor.wasModified()) {
// previous fishingOperation was modified, let's save it
SpeciesTabUIModel traitMonitorBean =
- (SpeciesTabUIModel) traitMonitor.getBean();
+ (SpeciesTabUIModel) fishingOperationMonitor.getBean();
FishingOperation fishingOperation = traitMonitorBean.toBean();
@@ -229,7 +483,7 @@
if (empty) {
rows = null;
bean = new FishingOperation();
- model.setTrait(null);
+ model.setFishingOperation(null);
} else {
if (log.isInfoEnabled()) {
@@ -248,146 +502,165 @@
rows.add(entry);
}
}
- model.setTrait(bean);
+ model.setFishingOperation(bean);
}
model.fromBean(bean);
model.setRows(rows);
- listenModifcationOnFirstRow();
-
- traitMonitor.clearModified();
+ fishingOperationMonitor.clearModified();
}
- @Override
- protected TableColumnModel createTableColumnModel() {
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
+ protected void moveSamplingNode(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchRowModel row,
+ SpeciesBatchTreeNode oldNode,
+ SpeciesBatchTreeNode newNode) {
- { // Species to confirm
+ if (oldNode != null) {
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
+ recomputeSuperSamplingRatio(samplingTreeModel, row, oldNode);
+
}
- List<Species> allSpecies = persistenceService.getAllSpecies();
+ recomputeSuperSamplingRatio(samplingTreeModel, row, newNode);
- { // Species (by code)
+ }
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
+ protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchRowModel row,
+ SpeciesBatchTreeNode node) {
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
+ SpeciesBatchTreeNode superSamplingNode = node.getParent();
- { // Species (by genusCode)
+ Preconditions.checkNotNull(superSamplingNode,
+ "Super sampling node can't be null");
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
+ SpeciesBatchTreeModel.SamplingContext samplingContext =
+ samplingTreeModel.createSamplingContext(superSamplingNode);
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
+ float samplingTotalWeight = samplingContext.getTotalWeight();
+ Float superSamplingTotalWeight;
+ SpeciesBatchRowModel superSamplingRow =
+ samplingContext.getSuperSamplingRow();
+ if (superSamplingRow == null) {
+ // Use directly the batch total weight (means no super-sampling)
+
+ superSamplingTotalWeight = getModel().getTotalWeight();
+ } else {
+ superSamplingTotalWeight = superSamplingRow.getWeight();
}
- { // Vrac / Hors vrac
+ if (log.isInfoEnabled()) {
+ log.info("Super sampling total weight: " +
+ superSamplingTotalWeight);
+ }
- addComboEnumColumnToModel(columnModel,
- SpeciesBatchTableModel.VRAC_HORS_VRAC,
- VracHorsVracEnum.values());
+ Float samplingRatio = null;
+ if (superSamplingTotalWeight != null) {
+ samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
}
- { // Catégorie de poids
+ if (log.isInfoEnabled()) {
+ log.info("Sampling ratio: " + samplingRatio);
+ }
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
+ getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
+ }
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
- }
- { // Sex
+ protected void recomputeTotalHorsVrac() {
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
+ // recompute total hors vrac
+ Float totalHorsVrac = 0f;
+ Float totalVrac = 0f;
- List<Sex> data = persistenceService.getAllSex();
+ for (SpeciesBatchRowModel batch : getModel().getRows()) {
+ VracHorsVracEnum vracHorsVrac = batch.getVracHorsVrac();
+ if (vracHorsVrac == null) {
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
+ // can't sum anything
+ } else if (vracHorsVrac == VracHorsVracEnum.HORS_VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalHorsVrac += weight;
+ }
+ } else if (vracHorsVrac == VracHorsVracEnum.VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalVrac += weight;
+ }
+ }
}
+ if (log.isInfoEnabled()) {
+ log.info("New total vrac / hors vrac: " +
+ totalVrac + " / " + totalHorsVrac);
+ }
+ getModel().setTotalHorsVracWeight(totalHorsVrac);
+ //TODO Should we also set the total vrac weight ?
+// getModel().setTotalVracWeight(totalVrac);
+ }
- { // Maturity
+ protected void saveSelectedRowIfRequired() {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
- { // Age
+ SpeciesBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null && bean.isValid()) {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ // there is a valid bean attached to the monitor
- { // Poids observé
+ if (rowMonitor.wasModified()) {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
- { // Poids calculé
+ saveRow(bean);
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
}
+ }
- { // Nombre calculé
+ protected void saveRow(SpeciesBatchRowModel row) {
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
}
- { // Poids d'échantillon
+ if (TuttiEntities.isNew(catchBean)) {
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
}
- { // Fraction d'élévation
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.ELEVATION_RATIO);
- }
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
- { // Commentaire
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.COMMENT);
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
}
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
- { // Pièces-jointes
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.FILE);
- }
- return columnModel;
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -29,6 +29,8 @@
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
+import java.util.List;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
@@ -45,16 +47,55 @@
public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
- protected FishingOperation trait;
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float totalWeight;
+ /**
+ * Total vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float totalVracWeight;
+ /**
+ * Total sample vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float sampleVracWeight;
+ /**
+ * Total hors vrac Weight computed by hros vrac rows.
+ *
+ * @since 0.2
+ */
protected Float totalHorsVracWeight;
+ /**
+ * Sampling order (sets by protocol).
+ *
+ * @since 0.2
+ */
+ protected List<String> samplingOrder;
+
+ /**
+ * Tree of sampling for batch rows.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeModel samplingTreeModel;
+
protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
.addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
.addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
@@ -72,16 +113,21 @@
public SpeciesTabUIModel() {
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ this.samplingTreeModel = new SpeciesBatchTreeModel();
}
- public FishingOperation getTrait() {
- return trait;
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
}
- public void setTrait(FishingOperation trait) {
- this.trait = trait;
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
}
+ public SpeciesBatchTreeModel getSamplingTreeModel() {
+ return samplingTreeModel;
+ }
+
public Float getTotalWeight() {
return totalWeight;
}
@@ -122,9 +168,17 @@
firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
}
+ public List<String> getSamplingOrder() {
+ return samplingOrder;
+ }
+
+ public void setSamplingOrder(List<String> samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
+ }
+
@Override
protected FishingOperation newEntity() {
- return trait;
+ return fishingOperation;
}
-
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,82 @@
+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.beans.AbstractBean;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.beans.PropertyDiff;
+
+import java.util.Map;
+
+/**
+ * To monitor a bean and know when it changes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TuttiBeanMonitor<B> extends AbstractBean {
+
+ public static final String PROPERTY_BEAN = "bean";
+
+ BeanMonitor monitor;
+
+ public TuttiBeanMonitor(String... properties) {
+ this.monitor = new BeanMonitor(properties);
+ }
+
+ public B getBean() {
+ return (B) monitor.getBean();
+ }
+
+ public void setBean(B bean) {
+ Object oldValue = getBean();
+ monitor.setBean(bean);
+ firePropertyChange(PROPERTY_BEAN, oldValue, bean);
+ }
+
+ public BeanMonitor getMonitor() {
+ return monitor;
+ }
+
+ public boolean wasModified() {
+ return monitor.wasModified();
+ }
+
+ public String[] getModifiedProperties() {
+ return monitor.getModifiedProperties();
+ }
+
+ public Map<String, Object> getOriginalValues() {
+ return monitor.getOriginalValues();
+ }
+
+ public PropertyDiff[] getPropertyDiffs() {
+ return monitor.getPropertyDiffs();
+ }
+
+ public void clearModified() {
+ monitor.clearModified();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.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/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -28,33 +28,28 @@
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
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 jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
-import org.apache.commons.collections.CollectionUtils;
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.table.TableColumnExt;
-import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.border.LineBorder;
-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;
@@ -82,12 +77,53 @@
*
* @since 0.2
*/
- private final BeanMonitor rowMonitor;
+ private final TuttiBeanMonitor<R> rowMonitor;
+ protected abstract JTable getTable();
+
+ protected abstract AbstractTuttiTableModel<R> getTableModel();
+
+ protected abstract TableColumnModel createTableColumnModel();
+
+ protected abstract void onRowModified(R row,
+ String propertyName,
+ Object oldValue,
+ Object newValue);
+
protected AbstractTuttiTableUIHandler(TuttiUIContext context,
String... properties) {
super(context);
- rowMonitor = new BeanMonitor(properties);
+ rowMonitor = new TuttiBeanMonitor<R>(properties);
+
+ // listen when bean is changed
+ rowMonitor.addPropertyChangeListener(TuttiBeanMonitor.PROPERTY_BEAN, new PropertyChangeListener() {
+ final PropertyChangeListener l = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ R row = (R) evt.getSource();
+ onRowModified(row,
+ evt.getPropertyName(),
+ evt.getOldValue(),
+ evt.getNewValue());
+ }
+ };
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ R oldValue = (R) evt.getOldValue();
+ R newValue = (R) evt.getNewValue();
+ if (log.isInfoEnabled()) {
+ log.info("Monitor row changed from " +
+ oldValue + " to " + newValue);
+ }
+ if (oldValue != null) {
+ oldValue.removePropertyChangeListener(l);
+ }
+ if (newValue != null) {
+ newValue.addPropertyChangeListener(l);
+ }
+ }
+ });
}
protected KeyListener installTableKeyListener(TableColumnModel columnModel,
@@ -221,8 +257,7 @@
protected <B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
ColumnIdentifier<R> identifier,
B[] data) {
- EnumEditor<B> comboBox =
- EnumEditor.newEditor(data);
+ EnumEditor<B> comboBox = EnumEditor.newEditor(data);
BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
TableCellEditor editor = new ComboBoxCellEditor(comboBox);
@@ -236,11 +271,15 @@
getModel().addPropertyChangeListener(AbstractTuttiTableUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- getTableModel().setRows((List<R>) evt.getNewValue());
+ onModelRowsChanged((List<R>) evt.getNewValue());
}
});
}
+ protected void onModelRowsChanged(List<R> rows) {
+ getTableModel().setRows(rows);
+ }
+
protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
return newTableCellRender(type, null);
@@ -262,71 +301,8 @@
return result;
}
- protected void listenRowModification(JTable table) {
- ListSelectionListener listener = new TableRowModificationListener(
- getTableModel(), rowMonitor) {
- @Override
- protected void saveSelectedRow() {
- saveSelectedRowIfRequired();
- }
- };
- table.getSelectionModel().addListSelectionListener(listener);
+ protected TuttiBeanMonitor<R> getRowMonitor() {
+ return rowMonitor;
}
- public void saveSelectedRowIfRequired(FocusEvent event) {
-
- Component oppositeComponent = event.getOppositeComponent();
-
- 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
- saveSelectedRowIfRequired();
- }
- }
-
- public void saveSelectedRowIfRequired() {
-
- R bean = (R) rowMonitor.getBean();
- if (bean != null && bean.isValid()) {
-
- // there is a valid bean attached to the monitor
-
- if (rowMonitor.wasModified()) {
-
- // monitored bean was modified, save it
- if (log.isInfoEnabled()) {
- log.info("Row " + bean + " was modified, will save it");
- }
-
- saveRow(bean);
-
- // clear modified flag on the monitor
- rowMonitor.clearModified();
- }
- }
- }
-
- protected abstract void saveRow(R row);
-
- protected abstract TableColumnModel createTableColumnModel();
-
- protected abstract JTable getTable();
-
- protected abstract AbstractTuttiTableModel<R> getTableModel();
-
- protected void listenModifcationOnFirstRow() {
- List<R> rows = getTableModel().getRows();
- if (CollectionUtils.isNotEmpty(rows)) {
- rowMonitor.setBean(rows.get(0));
- }
- }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,32 +24,33 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.beans.BeanMonitor;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import java.io.Serializable;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class TableRowModificationListener implements ListSelectionListener {
+public abstract class TableRowModificationListener<R extends Serializable> implements ListSelectionListener {
/** Logger. */
private static final Log log =
LogFactory.getLog(TableRowModificationListener.class);
- private final AbstractTuttiTableModel tableModel;
+ private final AbstractTuttiTableModel<R> tableModel;
- private final BeanMonitor beanMonitor;
+ private final TuttiBeanMonitor<R> beanMonitor;
protected abstract void saveSelectedRow();
- public TableRowModificationListener(AbstractTuttiTableModel tableModel,
- BeanMonitor beanMonitor) {
+ public TableRowModificationListener(AbstractTuttiTableModel<R> tableModel,
+ TuttiBeanMonitor<R> beanMonitor) {
this.tableModel = tableModel;
this.beanMonitor = beanMonitor;
}
@@ -67,7 +68,7 @@
log.info("New selected row: " + selectedRow);
}
- Object entry;
+ R entry;
if (selectedRow == -1) {
// no selection
Copied: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java (from rev 41, trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java)
===================================================================
--- trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java (rev 0)
+++ trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModelTest {
+
+ @Test
+ public void compareTo() throws Exception {
+
+ SpeciesFrequencyRowModel s0 = new SpeciesFrequencyRowModel();
+ SpeciesFrequencyRowModel s1 = new SpeciesFrequencyRowModel();
+
+ // s0=null, s1=null
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=1, s1=null
+ s0.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=null, s1=1
+ s0.setLengthStep(null);
+ s1.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+
+ // s0=2, s1=1
+ s0.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=2, s1=2
+ s1.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=2, s1=3
+ s1.setLengthStep(3f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r45 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation
by kmorin@users.forge.codelutin.com 12 Dec '12
by kmorin@users.forge.codelutin.com 12 Dec '12
12 Dec '12
Author: kmorin
Date: 2012-12-12 17:52:40 +0100 (Wed, 12 Dec 2012)
New Revision: 45
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/45
Log:
d?\195?\169commente du code comment?\195?\169 par erreur
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 16:25:25 UTC (rev 44)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
@@ -134,35 +134,30 @@
public void selectFishingOperation(FishingOperation bean) {
-// boolean empty = bean == null;
-//
-// FishingOperationTabUIModel model = getModel();
-//
-// // clean previous selection
-// ui.getSaisisseurList().getList().clearSelection();
-//
-// if (empty) {
-//
-// model.fromBean(new FishingOperation());
-// } else {
-//
-// model.fromBean(bean);
-// }
-//
-// // update saisissuer selection
-// List<Person> saisisseur = model.getSaisisseur();
-// if (CollectionUtils.isNotEmpty(saisisseur)) {
-// updateIndices(ui.getSaisisseurList(), saisisseur);
-// }
-//
-// // update model empty property
-// model.setEmpty(empty);
-//
-// // reload bean in validator (? really mandatory?)
-//// ui.getValidator().reloadBean();
-//
-// // if new fishingOperation can already cancel his creation
-// model.setModify(!empty && model.isCreate());
+ boolean empty = bean == null;
+
+ FishingOperationTabUIModel model = getModel();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ ui.getSaisisseurList().getModel().setSelected(saisisseur);
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // reload bean in validator (? really mandatory?)
+// ui.getValidator().reloadBean();
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
}
public void cancel() {
1
0
r44 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise
by kmorin@users.forge.codelutin.com 12 Dec '12
by kmorin@users.forge.codelutin.com 12 Dec '12
12 Dec '12
Author: kmorin
Date: 2012-12-12 17:25:25 +0100 (Wed, 12 Dec 2012)
New Revision: 44
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/44
Log:
refs #1790 - style
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 15:15:39 UTC (rev 43)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 16:25:25 UTC (rev 44)
@@ -36,11 +36,6 @@
bean: {model};
}
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
NumberEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
@@ -140,21 +135,25 @@
#vesselList {
beanType: {Vessel.class};
property: "vessel";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.vessel"))};
}
#gearList {
beanType: {Gear.class};
property: "gear";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.gear"))};
}
#headOfMissionList {
beanType: {Person.class};
property: "headOfMission";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.headOfMission"))};
}
#headOfSortRoomList {
beanType: {Person.class};
property: "headOfSortRoom";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.headOfSortRoom"))};
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 15:15:39 UTC (rev 43)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 16:25:25 UTC (rev 44)
@@ -166,19 +166,7 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
-<!-- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
- onFocusGained='vesselList.requestFocus()'>
- <JList id='vesselList'
- onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>-->
<BeanDoubleList id='vesselList' genericType='Vessel'/>
-<!-- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
- onFocusGained='gearList.requestFocus()'>
- <JList id='gearList'
- onValueChanged='handler.selectListData(event, "gear")'/>
- <BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>-->
<BeanDoubleList id='gearList' genericType='Gear'/>
</JPanel>
</cell>
@@ -188,24 +176,7 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
-
-<!-- <JScrollPane id='headOfMissionPane'
- columnHeaderView="{headOfMissionHeader}"
- onFocusGained='headOfMissionList.requestFocus()'>
- <JList id='headOfMissionList'
- onValueChanged='handler.selectListData(event, "headOfMission")'/>
- <BeanListHeader id='headOfMissionHeader'
- genericType='Person'/>
- </JScrollPane>-->
<BeanDoubleList id='headOfMissionList' genericType='Person'/>
-<!-- <JScrollPane id='headOfSortRoomPane'
- columnHeaderView="{headOfSortRoomHeader}"
- onFocusGained='headOfSortRoomList.requestFocus()'>
- <JList id='headOfSortRoomList'
- onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
- <BeanListHeader id='headOfSortRoomHeader'
- genericType='Person'/>
- </JScrollPane>-->
<BeanDoubleList id='headOfSortRoomList' genericType='Person'/>
</JPanel>
</cell>
1
0
Author: kmorin
Date: 2012-12-12 16:15:39 +0100 (Wed, 12 Dec 2012)
New Revision: 43
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/43
Log:
refs #1790 - utilisation de jaxx 2.5.8-SNAPSHOT pour avoir le widget de double liste
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-12 15:14:19 UTC (rev 42)
+++ trunk/pom.xml 2012-12-12 15:15:39 UTC (rev 43)
@@ -90,7 +90,7 @@
<h2Version>1.3.168</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
- <jaxxVersion>2.5.7</jaxxVersion>
+ <jaxxVersion>2.5.8-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<xworkVersion>2.3.4.1</xworkVersion>
1
0
r42 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: . content/cruise content/operation
by kmorin@users.forge.codelutin.com 12 Dec '12
by kmorin@users.forge.codelutin.com 12 Dec '12
12 Dec '12
Author: kmorin
Date: 2012-12-12 16:14:19 +0100 (Wed, 12 Dec 2012)
New Revision: 42
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/42
Log:
refs #1790
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/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
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-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -62,6 +62,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import jaxx.runtime.swing.editor.bean.BeanDoubleList;
/**
* Contract of any UI handler.
@@ -188,11 +189,11 @@
* @param listHeader le component graphique à initialiser
*/
protected <E extends IdAware> void initBeanList(
- BeanListHeader<E> listHeader,
+ BeanDoubleList<E> list,
List<E> data,
List<E> selectedData) {
- Class<E> beanType = listHeader.getBeanType();
+ Class<E> beanType = list.getBeanType();
DecoratorService decoratorService =
context.getService(DecoratorService.class);
@@ -204,15 +205,15 @@
}
// add data list to combo box
- listHeader.init((JXPathDecorator<E>) decorator, data);
+ list.init((JXPathDecorator<E>) decorator, data, selectedData);
+
+// OneClicListSelectionModel.installModel(listHeader.getList());
- OneClicListSelectionModel.installModel(listHeader.getList());
+// updateIndices(listHeader.getList(), selectedData);
- updateIndices(listHeader.getList(), selectedData);
-
if (log.isDebugEnabled()) {
log.debug("Jlist [" + beanType.getName() + "] : " +
- listHeader.getData().size());
+ list.getUniverseList().getModel().getSize());
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 15:14:19 UTC (rev 42)
@@ -32,9 +32,8 @@
bean: {model};
}
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
+BeanDoubleList {
+ bean: {model};
}
JList {
@@ -138,48 +137,24 @@
numberPattern: {INT_1_DIGITS_PATTERN};
}
-#vesselPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#vesselHeader {
- labelText: {_("tutti.label.list.vessel")};
- list: {vesselList};
+#vesselList {
beanType: {Vessel.class};
+ property: "vessel";
}
-#gearPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#gearHeader {
- labelText: {_("tutti.label.list.gear")};
- list: {gearList};
+#gearList {
beanType: {Gear.class};
+ property: "gear";
}
-#headOfMissionPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfMissionHeader {
- labelText: {_("tutti.label.list.headOfMission")};
- list: {headOfMissionList};
+#headOfMissionList {
beanType: {Person.class};
+ property: "headOfMission";
}
-#headOfSortRoomPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfSortRoomHeader {
- labelText: {_("tutti.label.list.headOfSortRoom")};
- list: {headOfSortRoomList};
+#headOfSortRoomList {
beanType: {Person.class};
+ property: "headOfSortRoom";
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 15:14:19 UTC (rev 42)
@@ -35,6 +35,7 @@
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.bean.BeanDoubleList
jaxx.runtime.validator.swing.SwingValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
@@ -81,10 +82,10 @@
<field name='country' component='countryComboBox'/>
<field name='beginDate' component='beginDateField'/>
<field name='endDate' component='endDateField'/>
- <field name='vessel' component='vesselPane'/>
- <field name='gear' component='gearPane'/>
- <field name='headOfMission' component='headOfMissionPane'/>
- <field name='headOfSortRoom' component='headOfSortRoomPane'/>
+ <field name='vessel' component='vesselList'/>
+ <field name='gear' component='gearList'/>
+ <field name='headOfMission' component='headOfMissionList'/>
+ <field name='headOfSortRoom' component='headOfSortRoomList'/>
<field name='comment' component='commentField'/>
</BeanValidator>
@@ -165,18 +166,20 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
+<!-- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
onFocusGained='vesselList.requestFocus()'>
<JList id='vesselList'
onValueChanged='handler.selectListData(event, "vessel")'/>
<BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>
- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
+ </JScrollPane>-->
+ <BeanDoubleList id='vesselList' genericType='Vessel'/>
+<!-- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
onFocusGained='gearList.requestFocus()'>
<JList id='gearList'
onValueChanged='handler.selectListData(event, "gear")'/>
<BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='gearList' genericType='Gear'/>
</JPanel>
</cell>
</row>
@@ -186,22 +189,24 @@
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='headOfMissionPane'
+<!-- <JScrollPane id='headOfMissionPane'
columnHeaderView="{headOfMissionHeader}"
onFocusGained='headOfMissionList.requestFocus()'>
<JList id='headOfMissionList'
onValueChanged='handler.selectListData(event, "headOfMission")'/>
<BeanListHeader id='headOfMissionHeader'
genericType='Person'/>
- </JScrollPane>
- <JScrollPane id='headOfSortRoomPane'
+ </JScrollPane>-->
+ <BeanDoubleList id='headOfMissionList' genericType='Person'/>
+<!-- <JScrollPane id='headOfSortRoomPane'
columnHeaderView="{headOfSortRoomHeader}"
onFocusGained='headOfSortRoomList.requestFocus()'>
<JList id='headOfSortRoomList'
onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
<BeanListHeader id='headOfSortRoomHeader'
genericType='Person'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='headOfSortRoomList' genericType='Person'/>
</JPanel>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -98,19 +98,19 @@
persistenceService.getAllCountry(),
model.getCountry());
- initBeanList(ui.getVesselHeader(),
+ initBeanList(ui.getVesselList(),
persistenceService.getAllVessel(),
model.getVessel());
- initBeanList(ui.getGearHeader(),
+ initBeanList(ui.getGearList(),
persistenceService.getAllGear(),
model.getGear());
- initBeanList(ui.getHeadOfMissionHeader(),
+ initBeanList(ui.getHeadOfMissionList(),
users,
model.getHeadOfMission());
- initBeanList(ui.getHeadOfSortRoomHeader(),
+ initBeanList(ui.getHeadOfSortRoomList(),
users,
model.getHeadOfSortRoom());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-12 15:14:19 UTC (rev 42)
@@ -32,9 +32,8 @@
bean: {model};
}
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
+BeanDoubleList {
+ bean: {model};
}
JList {
@@ -331,15 +330,9 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#saisisseurPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#saisisseurHeader {
- labelText: {_("tutti.label.list.saisisseur")};
- list: {saisisseurList};
+#saisisseurList {
beanType: {Person.class};
+ property: "saisisseur";
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-12 15:14:19 UTC (rev 42)
@@ -35,6 +35,7 @@
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.bean.BeanDoubleList
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.TimeEditor
@@ -80,7 +81,7 @@
component='fishingOperationNumberField'/>
<field name='date' component='dateField'/>
<field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
+ <field name='saisisseur' component='saisisseurList'/>
</BeanValidator>
<JPanel id='traitPane' constraints='BorderLayout.CENTER'
@@ -272,13 +273,14 @@
<!-- Saisisseur -->
<row weighty='0.3'>
<cell columns='6'>
- <JScrollPane id='saisisseurPane'
+<!-- <JScrollPane id='saisisseurPane'
columnHeaderView="{saisisseurHeader}"
onFocusGained='saisisseurList.requestFocus()'>
<JList id='saisisseurList'
onValueChanged='handler.selectListData(event, "saisisseur")'/>
<BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='saisisseurList' genericType='Person'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -102,7 +102,7 @@
initUI(ui);
- initBeanList(ui.getSaisisseurHeader(),
+ initBeanList(ui.getSaisisseurList(),
persistenceService.getAllPerson(),
model.getSaisisseur());
@@ -134,35 +134,35 @@
public void selectFishingOperation(FishingOperation bean) {
- boolean empty = bean == null;
-
- FishingOperationTabUIModel model = getModel();
-
- // clean previous selection
- ui.getSaisisseurHeader().getList().clearSelection();
-
- if (empty) {
-
- model.fromBean(new FishingOperation());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<Person> saisisseur = model.getSaisisseur();
- if (CollectionUtils.isNotEmpty(saisisseur)) {
- updateIndices(ui.getSaisisseurList(), saisisseur);
- }
-
- // update model empty property
- model.setEmpty(empty);
-
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
+// boolean empty = bean == null;
+//
+// FishingOperationTabUIModel model = getModel();
+//
+// // clean previous selection
+// ui.getSaisisseurList().getList().clearSelection();
+//
+// if (empty) {
+//
+// model.fromBean(new FishingOperation());
+// } else {
+//
+// model.fromBean(bean);
+// }
+//
+// // update saisissuer selection
+// List<Person> saisisseur = model.getSaisisseur();
+// if (CollectionUtils.isNotEmpty(saisisseur)) {
+// updateIndices(ui.getSaisisseurList(), saisisseur);
+// }
+//
+// // update model empty property
+// model.setEmpty(empty);
+//
+// // reload bean in validator (? really mandatory?)
+//// ui.getValidator().reloadBean();
+//
+// // if new fishingOperation can already cancel his creation
+// model.setModify(!empty && model.isCreate());
}
public void cancel() {
1
0
r41 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content java/fr/ifremer/tutti/ui/swing/content/catches/species java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/species resources/fr/ifremer/tutti/ui/swing/content
by tchemit@users.forge.codelutin.com 11 Dec '12
by tchemit@users.forge.codelutin.com 11 Dec '12
11 Dec '12
Author: tchemit
Date: 2012-12-11 15:29:06 +0100 (Tue, 11 Dec 2012)
New Revision: 41
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/41
Log:
move species to his correct package + remove obsolete packages
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.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/resources/fr/ifremer/tutti/ui/swing/content/campaign/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,256 +0,0 @@
-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 fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JTable;
-import javax.swing.border.LineBorder;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Component to render and edit frequency stuff from batch table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class FrequencyCellComponent extends JButton {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ROW_INDEX = "rowIndex";
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FrequencyCellComponent.class);
-
- public FrequencyCellComponent() {
- setContentAreaFilled(false);
- setOpaque(false);
- setIcon(SwingUtil.createActionIcon("show-frequency"));
- }
-
- public static TableCellRenderer newRender() {
- return new FrequencyCellRenderer();
- }
-
- public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
- return new FrequencyCellEditor(ui);
- }
-
- public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
-
- private static final long serialVersionUID = 1L;
-
- protected final FrequencyCellComponent component;
-
- protected final SpeciesFrequencyUI ui;
-
- protected Frame frame;
-
- protected JTable table;
-
- protected SpeciesBatchTableModel tableModel;
-
- protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
-
- protected SpeciesBatchRowModel editRow;
-
- protected Integer rowIndex;
-
- protected Integer columnIndex;
-
- public FrequencyCellEditor(SpeciesFrequencyUI ui) {
- this.ui = ui;
- component = new FrequencyCellComponent();
- component.setBorder(new LineBorder(Color.BLACK));
- component.addKeyListener(new KeyAdapter() {
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER ||
- e.getKeyCode() == KeyEvent.VK_SPACE) {
- e.consume();
- startEdit();
- }
- }
- });
-
- component.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- e.consume();
- startEdit();
- }
- });
- }
-
- protected void startEdit() {
-
- Preconditions.checkNotNull(tableModel, "No table model assigned.");
-
- // open frequency dialog
-
- Preconditions.checkNotNull(editRow, "No editRow found.");
-
- if (log.isInfoEnabled()) {
- log.info("Will edit frequencies for row: " + rowIndex);
- }
-
- if (frame == null) {
- frame = SwingUtil.getParentContainer(ui, Frame.class);
- }
-
- ui.editBatch(editRow);
-
- // open frequency dialog
- TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
-
- // at close, synch back frequencies
-
- editRow.updateTotalFromFrequencies();
-
- int r = rowIndex;
- int c = columnIndex;
-
- // stop edition
- stopCellEditing();
-
- // reselect this cell
- AbstractSelectTableAction.doSelectCell(table, r, c);
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table,
- Object value,
- boolean isSelected,
- int row,
- int column) {
- if (tableModel == null) {
- tableModel = (SpeciesBatchTableModel) table.getModel();
- this.table = table;
- columnIdentifier = tableModel.getPropertyName(column);
- }
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- component.setText(text);
-
- rowIndex = row;
- columnIndex = column;
-
- editRow = tableModel.getEntry(row);
-
- return component;
- }
-
- @Override
- public Object getCellEditorValue() {
-
- Preconditions.checkNotNull(editRow, "No editRow found in editor.");
-
- Object result;
- if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
- result = editRow.getComputedNumber();
- } else {
- result = editRow.getComputedWeight();
- }
- if (log.isInfoEnabled()) {
- log.info("editor value (" + columnIdentifier + "): " + result);
- }
-
- return result;
- }
-
- @Override
- public boolean stopCellEditing() {
- boolean b = super.stopCellEditing();
- if (b) {
- rowIndex = null;
- editRow = null;
- columnIndex = null;
- }
- return b;
- }
-
- @Override
- public void cancelCellEditing() {
- super.cancelCellEditing();
- rowIndex = null;
- columnIndex = null;
- editRow = null;
- }
- }
-
- public static class FrequencyCellRenderer implements TableCellRenderer {
-
- protected final FrequencyCellComponent component;
-
- public FrequencyCellRenderer() {
- component = new FrequencyCellComponent();
- }
-
- @Override
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
-
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- boolean editable = table.isCellEditable(row, column);
- component.setEnabled(editable);
- component.setText(text);
- return component;
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,379 +0,0 @@
-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.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
-import org.apache.commons.collections.CollectionUtils;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Represents a species batch (i.e a row in the batch table).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
-
- 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_SAMPLING_RATIO = "samplingRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_FREQUENCY = "frequency";
-
- public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
-
- public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected Species 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 WeightCategory weightCategory;
-
- /**
- * Sex (can be null).
- *
- * @since 0.2
- */
- protected Sex 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;
-
- /**
- * Total computed weight (from frequencies).
- *
- * @since 0.2
- */
- protected Float computedWeight;
-
- /**
- * Total computed number (from frequencies).
- *
- * @since 0.2
- */
- protected Float computedNumber;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Elevation ratio.
- *
- * @since 0.2
- */
- protected Float samplingRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * List of frequencies observed for this batch.
- *
- * @since 0.2
- */
- protected List<SpeciesFrequencyRowModel> frequency;
-
- protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(SpeciesBatch.class,
- SpeciesBatchRowModel.class);
-
- protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
- BinderFactory.newBinder(SpeciesBatchRowModel.class,
- SpeciesBatch.class);
-
- public SpeciesBatchRowModel() {
- super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
- frequency = Lists.newArrayList();
- }
-
- public SpeciesBatchRowModel(SpeciesBatch aBatch,
- List<SpeciesBatchFrequency> frequencies) {
- this();
- fromBean(aBatch);
- List<SpeciesFrequencyRowModel> frequencyRows =
- SpeciesFrequencyRowModel.fromBeans(frequencies);
- frequency.addAll(frequencyRows);
- Collections.sort(frequency);
- updateTotalFromFrequencies();
- }
-
- public void updateTotalFromFrequencies() {
- Float totalNumber = null;
- Float totalWeight = null;
- if (CollectionUtils.isNotEmpty(frequency)) {
- totalNumber = 0f;
- totalWeight = 0f;
- for (SpeciesFrequencyRowModel frequencyModel : frequency) {
- totalNumber += frequencyModel.getNumber();
- Float w = frequencyModel.getWeight();
- if (w == null) {
-
- // can't sum when a null value appears
- totalWeight = null;
- } else if (totalWeight != null) {
-
- // still can sum weights
- totalWeight += w;
- }
- }
- }
-
- setComputedNumber(totalNumber);
- setComputedWeight(totalWeight);
- }
-
- public Species getSpecies() {
- return species;
- }
-
- public void setSpecies(Species 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 WeightCategory getWeightCategory() {
- return weightCategory;
- }
-
- public void setWeightCategory(WeightCategory weightCategory) {
- Object oldValue = getWeightCategory();
- this.weightCategory = weightCategory;
- firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
- }
-
- public Sex getSex() {
- return sex;
- }
-
- public void setSex(Sex 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 getSamplingRatio() {
- return samplingRatio;
- }
-
- public void setSamplingRatio(Float samplingRatio) {
- Object oldValue = getSamplingRatio();
- this.samplingRatio = samplingRatio;
- firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<SpeciesFrequencyRowModel> getFrequency() {
- return frequency;
- }
-
- public void setFrequency(List<SpeciesFrequencyRowModel> frequency) {
- Object oldValue = getFrequency();
- this.frequency = frequency;
- firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency);
- }
-
- public Float getComputedWeight() {
- return computedWeight;
- }
-
- public void setComputedWeight(Float computedWeight) {
- Object oldValue = getComputedWeight();
- this.computedWeight = computedWeight;
- firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue,
- computedWeight);
- }
-
- public Float getComputedNumber() {
- return computedNumber;
- }
-
- public void setComputedNumber(Float computedNumber) {
- Object oldValue = getComputedNumber();
- this.computedNumber = computedNumber;
- firePropertyChange(PROPERTY_COMPUTED_NUMBER, oldValue,
- computedNumber);
- }
-
- //TODO Use validator
- @Override
- public boolean isValid() {
- return species != null && weight != null;
- }
-
- public int getRowCount() {
- return frequency == null ? 0 : frequency.size();
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,200 +0,0 @@
-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.Sets;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.species.batch.header.toConfirm"),
- n_("tutti.table.species.batch.header.toConfirm"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByCode"),
- n_("tutti.table.species.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByGenusCode"),
- n_("tutti.table.species.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> VRAC_HORS_VRAC = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- n_("tutti.table.species.batch.header.vracHorsVrac"),
- n_("tutti.table.species.batch.header.vracHorsVrac"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- n_("tutti.table.species.batch.header.weightCategory"),
- n_("tutti.table.species.batch.header.weightCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SEX,
- n_("tutti.table.species.batch.header.sex"),
- n_("tutti.table.species.batch.header.sex"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- n_("tutti.table.species.batch.header.maturity"),
- n_("tutti.table.species.batch.header.maturity"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_AGE,
- n_("tutti.table.species.batch.header.age"),
- n_("tutti.table.species.batch.header.age"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.species.batch.header.weight"),
- n_("tutti.table.species.batch.header.weight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
- n_("tutti.table.species.batch.header.computedWeight"),
- n_("tutti.table.species.batch.header.computedWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
- n_("tutti.table.species.batch.header.computedNumber"),
- n_("tutti.table.species.batch.header.computedNumber"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- n_("tutti.table.species.batch.header.sampleWeight"),
- n_("tutti.table.species.batch.header.sampleWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.species.batch.header.elevationRate"),
- n_("tutti.table.species.batch.header.elevationRate"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.species.batch.header.comment"),
- n_("tutti.table.species.batch.header.comment"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> FILE = ColumnIdentifier.newId(
- null,
- n_("tutti.table.species.batch.header.file"),
- n_("tutti.table.species.batch.header.file"));
-
-
- protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
-
- public SpeciesBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- // TODO This will be dynamic by the protocol...
- setNoneEditableCols(
- AGE,
- MATURITY,
- SAMPLE_WEIGHT,
- ELEVATION_RATIO,
- FILE
- );
- noneEditableColIfNoSpecies = Sets.newHashSet();
- noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
- noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
- }
-
- @Override
- protected SpeciesBatchRowModel createNewRow() {
- return new SpeciesBatchRowModel();
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName,
- SpeciesBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_GENUS_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
- } else if (propertyName == COMPUTED_NUMBER) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- COMPUTED_WEIGHT);
-
- } else if (propertyName == COMPUTED_WEIGHT) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- COMPUTED_NUMBER);
- }
- }
-
- @Override
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
-
- boolean result = super.isCellEditable(rowIndex,
- columnIndex,
- propertyName);
- if (result) {
-
- if (noneEditableColIfNoSpecies.contains(propertyName)) {
-
- // must have filled a species to edit this column
- SpeciesBatchRowModel entry = getEntry(rowIndex);
- result = entry.getSpecies() != null;
- }
- }
- return result;
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,102 +0,0 @@
-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.data.SpeciesBatch;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchTreeModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Root node (with no sampling on it.
- *
- * @since 0.2
- */
- protected final SpeciesBatchTreeNode 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<SpeciesBatchTreeNode> lines;
-
- public SpeciesBatchTreeModel(String... samplingOrder) {
- this.samplingOrder = samplingOrder;
- root = new SpeciesBatchTreeNode();
- lines = Lists.newArrayList();
- }
-
- public SpeciesBatchTreeNode getNode(int rowIndex) {
- return lines.get(rowIndex);
- }
-
- public int getSize() {
- return lines.size();
- }
-
- public void populate(List<SpeciesBatch> data) {
-
- // clear tree representation
- root.removeAllChildren();
-
- // clear linear representation
- lines.clear();
- }
-
- public Object[] getSamplingKey(SpeciesBatch 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(SpeciesBatch bean) {
- return null;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,152 +0,0 @@
-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.data.SpeciesBatch;
-
-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 SpeciesBatch}. 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 SpeciesBatchTreeNode 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 SpeciesBatchTreeNode() {
- this(null, null, null);
- }
-
- public SpeciesBatchTreeNode(SpeciesBatch 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 SpeciesBatch getUserObject() {
- return (SpeciesBatch) super.getUserObject();
- }
-
- @Override
- public SpeciesBatchTreeNode getParent() {
- return (SpeciesBatchTreeNode) super.getParent();
- }
-
- @Override
- public SpeciesBatchTreeNode getRoot() {
- return (SpeciesBatchTreeNode) super.getRoot();
- }
-
- @Override
- public SpeciesBatchTreeNode getFirstChild() {
- return (SpeciesBatchTreeNode) super.getFirstChild();
- }
-
- @Override
- public SpeciesBatchTreeNode getLastChild() {
- return (SpeciesBatchTreeNode) super.getLastChild();
- }
-
- @Override
- public SpeciesBatchTreeNode getChildAfter(TreeNode aChild) {
- return (SpeciesBatchTreeNode) super.getChildAfter(aChild);
- }
-
- @Override
- public SpeciesBatchTreeNode getChildBefore(TreeNode aChild) {
- return (SpeciesBatchTreeNode) super.getChildBefore(aChild);
- }
-
- @Override
- public SpeciesBatchTreeNode getNextSibling() {
- return (SpeciesBatchTreeNode) super.getNextSibling();
- }
-
- @Override
- public SpeciesBatchTreeNode getPreviousSibling() {
- return (SpeciesBatchTreeNode) super.getPreviousSibling();
- }
-
- @Override
- public SpeciesBatchTreeNode getFirstLeaf() {
- return (SpeciesBatchTreeNode) super.getFirstLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getLastLeaf() {
- return (SpeciesBatchTreeNode) super.getLastLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getNextLeaf() {
- return (SpeciesBatchTreeNode) super.getNextLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getPreviousLeaf() {
- return (SpeciesBatchTreeNode) super.getPreviousLeaf();
- }
-
-}
Deleted: 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.css 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,85 +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.species.totalWeight";
- labelFor: {totalWeightField};
-}
-
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightLabel {
- text: "tutti.label.species.totalVracWeight";
- labelFor: {totalVracWeightField};
-}
-
-#totalVracWeightField {
- property: "totalVracWeight";
- model: {model.getTotalVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightLabel {
- text: "tutti.label.species.sampleVracWeight";
- labelFor: {sampleVracWeightField};
-}
-
-#sampleVracWeightField {
- property: "sampleVracWeight";
- model: {model.getSampleVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightLabel {
- text: "tutti.label.species.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};
- sortable: false;
-}
Deleted: 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-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,118 +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.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
-
- org.jdesktop.swingx.JXTable
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public SpeciesTabUI(FishingOperationsUI parentUI) {
- SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-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>
-
- <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
-
- <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>
Deleted: 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-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,393 +0,0 @@
-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.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.beans.BeanMonitor;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.awt.Color;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
-
- private final SpeciesTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- private final BeanMonitor traitMonitor;
-
- public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext(),
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- SpeciesBatchRowModel.PROPERTY_AGE,
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY);
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- traitMonitor = new BeanMonitor(
- SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
- );
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected SpeciesBatchTableModel getTableModel() {
- return (SpeciesBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- public void beforeInitUI() {
-
- SpeciesTabUIModel model = new SpeciesTabUIModel();
- ui.setContextValue(model);
-
- traitMonitor.setBean(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- SpeciesBatchTableModel tableModel =
- new SpeciesBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
- installTableKeyListener(columnModel, table);
-
- table.getTableHeader().setReorderingAllowed(false);
-
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
- HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
-
- // when model datas change let's propagate it table model
- listenRowsFromModel();
-
- // save when row chaged and was modified
- listenRowModification(table);
-
- // always scroll to selected row
- SwingUtil.scrollToTableSelection(getTable());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected void saveRow(SpeciesBatchRowModel row) {
- SpeciesBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getTrait();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
-
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
-
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
- }
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
-
-
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = ui.getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- if (traitMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- SpeciesTabUIModel traitMonitorBean =
- (SpeciesTabUIModel) traitMonitor.getBean();
-
- FishingOperation fishingOperation = traitMonitorBean.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- SpeciesTabUIModel model = getModel();
-
- List<SpeciesBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- bean = new FishingOperation();
- model.setTrait(null);
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " + bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<SpeciesBatch> catches =
- persistenceService.getAllSpeciesBatch(bean.getId());
- for (SpeciesBatch aBatch : catches) {
- List<SpeciesBatchFrequency> frequencies =
- persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
- SpeciesBatchRowModel entry =
- new SpeciesBatchRowModel(aBatch, frequencies);
- rows.add(entry);
- }
- }
- model.setTrait(bean);
- }
-
- model.fromBean(bean);
- model.setRows(rows);
-
- listenModifcationOnFirstRow();
-
- traitMonitor.clearModified();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- { // Species to confirm
-
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- { // Species (by code)
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- { // Species (by genusCode)
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- { // Vrac / Hors vrac
-
- addComboEnumColumnToModel(columnModel,
- SpeciesBatchTableModel.VRAC_HORS_VRAC,
- VracHorsVracEnum.values());
- }
-
- { // Catégorie de poids
-
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
-
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
- }
-
- { // Sex
-
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
-
- List<Sex> data = persistenceService.getAllSex();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
- }
-
- { // Maturity
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Age
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Poids observé
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Poids calculé
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
- }
-
- { // Nombre calculé
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
- }
-
- { // Poids d'échantillon
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // Fraction d'élévation
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.ELEVATION_RATIO);
- }
-
- { // Commentaire
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.COMMENT);
- }
-
- { // Pièces-jointes
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.FILE);
- }
- return columnModel;
- }
-}
Deleted: 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-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,130 +0,0 @@
-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.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- 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";
-
- protected FishingOperation trait;
-
- protected Float totalWeight;
-
- protected Float totalVracWeight;
-
- protected Float sampleVracWeight;
-
- protected Float totalHorsVracWeight;
-
- protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.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)
- .addProperty("id", PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.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 SpeciesTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public FishingOperation getTrait() {
- return trait;
- }
-
- public void setTrait(FishingOperation trait) {
- this.trait = trait;
- }
-
- 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);
- }
-
- @Override
- protected FishingOperation newEntity() {
- return trait;
- }
-
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -26,7 +26,7 @@
<import>
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel
jaxx.runtime.swing.CardLayout2Ext
jaxx.runtime.swing.editor.bean.BeanComboBox
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -27,7 +27,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
/**
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -32,7 +32,7 @@
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
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,256 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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 fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JButton;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Component to render and edit frequency stuff from batch table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class FrequencyCellComponent extends JButton {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ROW_INDEX = "rowIndex";
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FrequencyCellComponent.class);
+
+ public FrequencyCellComponent() {
+ setContentAreaFilled(false);
+ setOpaque(false);
+ setIcon(SwingUtil.createActionIcon("show-frequency"));
+ }
+
+ public static TableCellRenderer newRender() {
+ return new FrequencyCellRenderer();
+ }
+
+ public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
+ return new FrequencyCellEditor(ui);
+ }
+
+ public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final FrequencyCellComponent component;
+
+ protected final SpeciesFrequencyUI ui;
+
+ protected Frame frame;
+
+ protected JTable table;
+
+ protected SpeciesBatchTableModel tableModel;
+
+ protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
+
+ protected SpeciesBatchRowModel editRow;
+
+ protected Integer rowIndex;
+
+ protected Integer columnIndex;
+
+ public FrequencyCellEditor(SpeciesFrequencyUI ui) {
+ this.ui = ui;
+ component = new FrequencyCellComponent();
+ component.setBorder(new LineBorder(Color.BLACK));
+ component.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_SPACE) {
+ e.consume();
+ startEdit();
+ }
+ }
+ });
+
+ component.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ e.consume();
+ startEdit();
+ }
+ });
+ }
+
+ protected void startEdit() {
+
+ Preconditions.checkNotNull(tableModel, "No table model assigned.");
+
+ // open frequency dialog
+
+ Preconditions.checkNotNull(editRow, "No editRow found.");
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit frequencies for row: " + rowIndex);
+ }
+
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.editBatch(editRow);
+
+ // open frequency dialog
+ TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
+
+ // at close, synch back frequencies
+
+ editRow.updateTotalFromFrequencies();
+
+ int r = rowIndex;
+ int c = columnIndex;
+
+ // stop edition
+ stopCellEditing();
+
+ // reselect this cell
+ AbstractSelectTableAction.doSelectCell(table, r, c);
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+ if (tableModel == null) {
+ tableModel = (SpeciesBatchTableModel) table.getModel();
+ this.table = table;
+ columnIdentifier = tableModel.getPropertyName(column);
+ }
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ component.setText(text);
+
+ rowIndex = row;
+ columnIndex = column;
+
+ editRow = tableModel.getEntry(row);
+
+ return component;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ Preconditions.checkNotNull(editRow, "No editRow found in editor.");
+
+ Object result;
+ if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
+ result = editRow.getComputedNumber();
+ } else {
+ result = editRow.getComputedWeight();
+ }
+ if (log.isInfoEnabled()) {
+ log.info("editor value (" + columnIdentifier + "): " + result);
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ boolean b = super.stopCellEditing();
+ if (b) {
+ rowIndex = null;
+ editRow = null;
+ columnIndex = null;
+ }
+ return b;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ super.cancelCellEditing();
+ rowIndex = null;
+ columnIndex = null;
+ editRow = null;
+ }
+ }
+
+ public static class FrequencyCellRenderer implements TableCellRenderer {
+
+ protected final FrequencyCellComponent component;
+
+ public FrequencyCellRenderer() {
+ component = new FrequencyCellComponent();
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ boolean editable = table.isCellEditable(row, column);
+ component.setEnabled(editable);
+ component.setText(text);
+ return component;
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.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/operation/species/SpeciesBatchRowModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,379 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import org.apache.commons.collections.CollectionUtils;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Represents a species batch (i.e a row in the batch table).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
+
+ 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_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_FREQUENCY = "frequency";
+
+ public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species 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 WeightCategory weightCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected Sex 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;
+
+ /**
+ * Total computed weight (from frequencies).
+ *
+ * @since 0.2
+ */
+ protected Float computedWeight;
+
+ /**
+ * Total computed number (from frequencies).
+ *
+ * @since 0.2
+ */
+ protected Float computedNumber;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * List of frequencies observed for this batch.
+ *
+ * @since 0.2
+ */
+ protected List<SpeciesFrequencyRowModel> frequency;
+
+ protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatch.class,
+ SpeciesBatchRowModel.class);
+
+ protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchRowModel.class,
+ SpeciesBatch.class);
+
+ public SpeciesBatchRowModel() {
+ super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
+ frequency = Lists.newArrayList();
+ }
+
+ public SpeciesBatchRowModel(SpeciesBatch aBatch,
+ List<SpeciesBatchFrequency> frequencies) {
+ this();
+ fromBean(aBatch);
+ List<SpeciesFrequencyRowModel> frequencyRows =
+ SpeciesFrequencyRowModel.fromBeans(frequencies);
+ frequency.addAll(frequencyRows);
+ Collections.sort(frequency);
+ updateTotalFromFrequencies();
+ }
+
+ public void updateTotalFromFrequencies() {
+ Float totalNumber = null;
+ Float totalWeight = null;
+ if (CollectionUtils.isNotEmpty(frequency)) {
+ totalNumber = 0f;
+ totalWeight = 0f;
+ for (SpeciesFrequencyRowModel frequencyModel : frequency) {
+ totalNumber += frequencyModel.getNumber();
+ Float w = frequencyModel.getWeight();
+ if (w == null) {
+
+ // can't sum when a null value appears
+ totalWeight = null;
+ } else if (totalWeight != null) {
+
+ // still can sum weights
+ totalWeight += w;
+ }
+ }
+ }
+
+ setComputedNumber(totalNumber);
+ setComputedWeight(totalWeight);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species 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 WeightCategory getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategory weightCategory) {
+ Object oldValue = getWeightCategory();
+ this.weightCategory = weightCategory;
+ firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
+ }
+
+ public Sex getSex() {
+ return sex;
+ }
+
+ public void setSex(Sex 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 getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<SpeciesFrequencyRowModel> getFrequency() {
+ return frequency;
+ }
+
+ public void setFrequency(List<SpeciesFrequencyRowModel> frequency) {
+ Object oldValue = getFrequency();
+ this.frequency = frequency;
+ firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency);
+ }
+
+ public Float getComputedWeight() {
+ return computedWeight;
+ }
+
+ public void setComputedWeight(Float computedWeight) {
+ Object oldValue = getComputedWeight();
+ this.computedWeight = computedWeight;
+ firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue,
+ computedWeight);
+ }
+
+ public Float getComputedNumber() {
+ return computedNumber;
+ }
+
+ public void setComputedNumber(Float computedNumber) {
+ Object oldValue = getComputedNumber();
+ this.computedNumber = computedNumber;
+ firePropertyChange(PROPERTY_COMPUTED_NUMBER, oldValue,
+ computedNumber);
+ }
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return species != null && weight != null;
+ }
+
+ public int getRowCount() {
+ return frequency == null ? 0 : frequency.size();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.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/operation/species/SpeciesBatchTableModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,200 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.Sets;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByCode"),
+ n_("tutti.table.species.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByGenusCode"),
+ n_("tutti.table.species.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> VRAC_HORS_VRAC = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ n_("tutti.table.species.batch.header.vracHorsVrac"),
+ n_("tutti.table.species.batch.header.vracHorsVrac"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ n_("tutti.table.species.batch.header.weightCategory"),
+ n_("tutti.table.species.batch.header.weightCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ n_("tutti.table.species.batch.header.sex"),
+ n_("tutti.table.species.batch.header.sex"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ n_("tutti.table.species.batch.header.maturity"),
+ n_("tutti.table.species.batch.header.maturity"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ n_("tutti.table.species.batch.header.age"),
+ n_("tutti.table.species.batch.header.age"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.batch.header.weight"),
+ n_("tutti.table.species.batch.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.batch.header.computedWeight"),
+ n_("tutti.table.species.batch.header.computedWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
+ n_("tutti.table.species.batch.header.computedNumber"),
+ n_("tutti.table.species.batch.header.computedNumber"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.species.batch.header.sampleWeight"),
+ n_("tutti.table.species.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.species.batch.header.elevationRate"),
+ n_("tutti.table.species.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.species.batch.header.comment"),
+ n_("tutti.table.species.batch.header.comment"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.species.batch.header.file"),
+ n_("tutti.table.species.batch.header.file"));
+
+
+ protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
+
+ public SpeciesBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ // TODO This will be dynamic by the protocol...
+ setNoneEditableCols(
+ AGE,
+ MATURITY,
+ SAMPLE_WEIGHT,
+ ELEVATION_RATIO,
+ FILE
+ );
+ noneEditableColIfNoSpecies = Sets.newHashSet();
+ noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
+ noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesBatchRowModel createNewRow() {
+ return new SpeciesBatchRowModel();
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName,
+ SpeciesBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+ } else if (propertyName == COMPUTED_NUMBER) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ COMPUTED_WEIGHT);
+
+ } else if (propertyName == COMPUTED_WEIGHT) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ COMPUTED_NUMBER);
+ }
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+ if (result) {
+
+ if (noneEditableColIfNoSpecies.contains(propertyName)) {
+
+ // must have filled a species to edit this column
+ SpeciesBatchRowModel entry = getEntry(rowIndex);
+ result = entry.getSpecies() != null;
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.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/operation/species/SpeciesBatchTreeModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.SpeciesBatch;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchTreeModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Root node (with no sampling on it.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeNode 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<SpeciesBatchTreeNode> lines;
+
+ public SpeciesBatchTreeModel(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ root = new SpeciesBatchTreeNode();
+ lines = Lists.newArrayList();
+ }
+
+ public SpeciesBatchTreeNode getNode(int rowIndex) {
+ return lines.get(rowIndex);
+ }
+
+ public int getSize() {
+ return lines.size();
+ }
+
+ public void populate(List<SpeciesBatch> data) {
+
+ // clear tree representation
+ root.removeAllChildren();
+
+ // clear linear representation
+ lines.clear();
+ }
+
+ public Object[] getSamplingKey(SpeciesBatch 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(SpeciesBatch bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.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/operation/species/SpeciesBatchTreeNode.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.SpeciesBatch;
+
+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 SpeciesBatch}. 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 SpeciesBatchTreeNode 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 SpeciesBatchTreeNode() {
+ this(null, null, null);
+ }
+
+ public SpeciesBatchTreeNode(SpeciesBatch 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 SpeciesBatch getUserObject() {
+ return (SpeciesBatch) super.getUserObject();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getParent() {
+ return (SpeciesBatchTreeNode) super.getParent();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getRoot() {
+ return (SpeciesBatchTreeNode) super.getRoot();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getFirstChild() {
+ return (SpeciesBatchTreeNode) super.getFirstChild();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getLastChild() {
+ return (SpeciesBatchTreeNode) super.getLastChild();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getChildAfter(TreeNode aChild) {
+ return (SpeciesBatchTreeNode) super.getChildAfter(aChild);
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getChildBefore(TreeNode aChild) {
+ return (SpeciesBatchTreeNode) super.getChildBefore(aChild);
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getNextSibling() {
+ return (SpeciesBatchTreeNode) super.getNextSibling();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getPreviousSibling() {
+ return (SpeciesBatchTreeNode) super.getPreviousSibling();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getFirstLeaf() {
+ return (SpeciesBatchTreeNode) super.getFirstLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getLastLeaf() {
+ return (SpeciesBatchTreeNode) super.getLastLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getNextLeaf() {
+ return (SpeciesBatchTreeNode) super.getNextLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getPreviousLeaf() {
+ return (SpeciesBatchTreeNode) super.getPreviousLeaf();
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.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/operation/species/SpeciesTabUI.css (from rev 39, 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/operation/species/SpeciesTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,85 @@
+/*
+ * #%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.species.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text: "tutti.label.species.totalVracWeight";
+ labelFor: {totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property: "totalVracWeight";
+ model: {model.getTotalVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text: "tutti.label.species.sampleVracWeight";
+ labelFor: {sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property: "sampleVracWeight";
+ model: {model.getSampleVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text: "tutti.label.species.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};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/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/operation/species/SpeciesTabUI.jaxx (from rev 40, 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/operation/species/SpeciesTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,118 @@
+<!--
+ #%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.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesTabUI(FishingOperationsUI parentUI) {
+ SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+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>
+
+ <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
+
+ <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/operation/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/operation/species/SpeciesTabUIHandler.java (from rev 40, 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/operation/species/SpeciesTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,393 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+
+ private final SpeciesTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ private final BeanMonitor traitMonitor;
+
+ public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
+ super(parentUi.getHandler().getContext(),
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ traitMonitor = new BeanMonitor(
+ SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
+ );
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected SpeciesBatchTableModel getTableModel() {
+ return (SpeciesBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesTabUIModel model = new SpeciesTabUIModel();
+ ui.setContextValue(model);
+
+ traitMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ SpeciesBatchTableModel tableModel =
+ new SpeciesBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ listenRowModification(table);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected void saveRow(SpeciesBatchRowModel row) {
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getTrait();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
+ }
+
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
+ }
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
+
+
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = ui.getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (traitMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ SpeciesTabUIModel traitMonitorBean =
+ (SpeciesTabUIModel) traitMonitor.getBean();
+
+ FishingOperation fishingOperation = traitMonitorBean.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesTabUIModel model = getModel();
+
+ List<SpeciesBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setTrait(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<SpeciesBatch> catches =
+ persistenceService.getAllSpeciesBatch(bean.getId());
+ for (SpeciesBatch aBatch : catches) {
+ List<SpeciesBatchFrequency> frequencies =
+ persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
+ SpeciesBatchRowModel entry =
+ new SpeciesBatchRowModel(aBatch, frequencies);
+ rows.add(entry);
+ }
+ }
+ model.setTrait(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ listenModifcationOnFirstRow();
+
+ traitMonitor.clearModified();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ { // Species to confirm
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ { // Species (by code)
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ { // Species (by genusCode)
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Vrac / Hors vrac
+
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
+ VracHorsVracEnum.values());
+ }
+
+ { // Catégorie de poids
+
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
+
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
+ decorator, data);
+ }
+
+ { // Sex
+
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
+
+ List<Sex> data = persistenceService.getAllSex();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX,
+ decorator, data);
+ }
+
+ { // Maturity
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Age
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Poids observé
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Poids calculé
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Nombre calculé
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Poids d'échantillon
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // Fraction d'élévation
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.ELEVATION_RATIO);
+ }
+
+ { // Commentaire
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // Pièces-jointes
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/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/operation/species/SpeciesTabUIModel.java (from rev 39, 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/operation/species/SpeciesTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,130 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
+
+ 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";
+
+ protected FishingOperation trait;
+
+ protected Float totalWeight;
+
+ protected Float totalVracWeight;
+
+ protected Float sampleVracWeight;
+
+ protected Float totalHorsVracWeight;
+
+ protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.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)
+ .addProperty("id", PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.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 SpeciesTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getTrait() {
+ return trait;
+ }
+
+ public void setTrait(FishingOperation trait) {
+ this.trait = trait;
+ }
+
+ 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);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return trait;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
11 Dec '12
Author: tchemit
Date: 2012-12-11 15:19:11 +0100 (Tue, 11 Dec 2012)
New Revision: 40
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/40
Log:
rename ScientificCruise to Cruise
move ui to correct packages
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
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/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
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
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
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/config/TuttiConfig.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
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/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/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/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/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/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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.Strata;
@@ -107,22 +107,22 @@
Program saveProgram(Program bean);
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
- List<ScientificCruise> getAllScientificCruise(String programId);
+ List<Cruise> getAllCruise(String programId);
- ScientificCruise getScientificCruise(String id);
+ Cruise getCruise(String id);
- ScientificCruise createScientificCruise(ScientificCruise bean);
+ Cruise createCruise(Cruise bean);
- ScientificCruise saveScientificCruise(ScientificCruise bean);
+ Cruise saveCruise(Cruise bean);
//------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
- List<FishingOperation> getAllFishingOperation(String scientificCruiseId);
+ List<FishingOperation> getAllFishingOperation(String cruiseId);
FishingOperation getFishingOperation(String id);
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-11 14:19:11 UTC (rev 40)
@@ -4,7 +4,7 @@
fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
fr.ifremer.tutti.persistence.entities.data.Program
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise
+fr.ifremer.tutti.persistence.entities.data.Cruise
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,8 +28,8 @@
model.tagvalue.noPCS=true
model.tagvalue.beanSuperClass=fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.gear.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfMission.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfSortRoom.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.vessel.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.gear.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfMission.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfSortRoom.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.vessel.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -42,7 +42,7 @@
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
@@ -267,14 +267,14 @@
}
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<ScientificCruise> getAllScientificCruise(final String programId) {
- List<ScientificCruise> result = Lists.newArrayList(Iterables.filter(getData(ScientificCruise.class), new Predicate<ScientificCruise>() {
+ public List<Cruise> getAllCruise(final String programId) {
+ List<Cruise> result = Lists.newArrayList(Iterables.filter(getData(Cruise.class), new Predicate<Cruise>() {
@Override
- public boolean apply(ScientificCruise input) {
+ public boolean apply(Cruise input) {
return programId.equals(input.getProgram().getId());
}
}));
@@ -282,20 +282,20 @@
}
@Override
- public ScientificCruise getScientificCruise(String id) {
- ScientificCruise result = getBean(ScientificCruise.class, id);
+ public Cruise getCruise(String id) {
+ Cruise result = getBean(Cruise.class, id);
return result;
}
@Override
- public ScientificCruise createScientificCruise(ScientificCruise bean) {
- ScientificCruise result = create(ScientificCruise.class, bean);
+ public Cruise createCruise(Cruise bean) {
+ Cruise result = create(Cruise.class, bean);
return result;
}
@Override
- public ScientificCruise saveScientificCruise(ScientificCruise bean) {
- ScientificCruise result = save(ScientificCruise.class, bean);
+ public Cruise saveCruise(Cruise bean) {
+ Cruise result = save(Cruise.class, bean);
return result;
}
@@ -304,11 +304,11 @@
//------------------------------------------------------------------------//
@Override
- public List<FishingOperation> getAllFishingOperation(final String scientificCruiseId) {
+ public List<FishingOperation> getAllFishingOperation(final String cruiseId) {
List<FishingOperation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperation.class), new Predicate<FishingOperation>() {
@Override
public boolean apply(FishingOperation input) {
- return scientificCruiseId.equals(input.getScientificCruise().getId());
+ return cruiseId.equals(input.getCruise().getId());
}
}));
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-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Strata;
@@ -85,7 +85,7 @@
protected void loadDecorators() {
registerMultiJXPathDecorator(Program.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(ScientificCruise.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Cruise.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(Vessel.class, "${name}$s#", "#", " - ");
@@ -112,7 +112,7 @@
n_("tutti.property.stationNumber");
n_("tutti.property.date");
n_("tutti.property.program");
- n_("tutti.property.scientificCruise");
+ n_("tutti.property.cruise");
n_("tutti.property.fishingOperation");
n_("tutti.property.zone");
n_("tutti.property.vessel");
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -29,7 +29,7 @@
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
@@ -227,31 +227,31 @@
}
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<ScientificCruise> getAllScientificCruise(String programId) {
+ public List<Cruise> getAllCruise(String programId) {
checkDriverExists();
- return driver.getAllScientificCruise(programId);
+ return driver.getAllCruise(programId);
}
@Override
- public ScientificCruise getScientificCruise(String id) {
+ public Cruise getCruise(String id) {
checkDriverExists();
- return driver.getScientificCruise(id);
+ return driver.getCruise(id);
}
@Override
- public ScientificCruise createScientificCruise(ScientificCruise bean) {
+ public Cruise createCruise(Cruise bean) {
checkDriverExists();
- return driver.createScientificCruise(bean);
+ return driver.createCruise(bean);
}
@Override
- public ScientificCruise saveScientificCruise(ScientificCruise bean) {
+ public Cruise saveCruise(Cruise bean) {
checkDriverExists();
- return driver.saveScientificCruise(bean);
+ return driver.saveCruise(bean);
}
//------------------------------------------------------------------------//
@@ -259,9 +259,9 @@
//------------------------------------------------------------------------//
@Override
- public List<FishingOperation> getAllFishingOperation(String scientificCruiseId) {
+ public List<FishingOperation> getAllFishingOperation(String cruiseId) {
checkDriverExists();
- return driver.getAllFishingOperation(scientificCruiseId);
+ return driver.getAllFishingOperation(cruiseId);
}
@Override
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-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -6,6 +6,7 @@
tutti.property.beaufortScale=Vent beaufort
tutti.property.codeMemo=Code Memo
tutti.property.country=Pays
+tutti.property.cruise=Campagne
tutti.property.date=Date
tutti.property.firstName=Prénom
tutti.property.fishingOperation=Trait
@@ -14,7 +15,6 @@
tutti.property.lastName=Nom de Famille
tutti.property.name=Nom
tutti.property.program=Série de campagne
-tutti.property.scientificCruise=Campagne
tutti.property.seaState=État de la mer
tutti.property.stationNumber=Numéro de station
tutti.property.strata=Strate d'association
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -65,15 +65,15 @@
text: "tutti.action.selectCampaign";
toolTipText: "tutti.action.selectCampaign.tip";
mnemonic: S;
- enabled: {model.getScreen() != TuttiScreen.SELECT_SCIENTIFIC_CRUISE};
- /*actionIcon: "scientificCruise";*/
+ enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE};
+ /*actionIcon: "cruise";*/
}
#menuActionFillCatches {
text: "tutti.action.fillCatches";
toolTipText: "tutti.action.fillCatches.tip";
mnemonic: C;
- enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isScientificCruiseContextFilled()};
+ enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isCruiseContextFilled()};
/*actionIcon: "catches";*/
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -25,15 +25,15 @@
*/
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.config.TuttiConfigOption;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditScientificCruiseUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditProgramUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.SelectScientificCruiseUI;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -82,7 +82,7 @@
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (propertyName.equals(TuttiUIContext.PROPERTY_PROGRAM_ID) ||
- propertyName.equals(TuttiUIContext.PROPERTY_SCIENTIFIC_CRUISE_ID)) {
+ propertyName.equals(TuttiUIContext.PROPERTY_CRUISE_ID)) {
// change the ui title
changeTitle();
@@ -111,14 +111,14 @@
TuttiScreen screen;
- if (context.isScientificCruiseContextFilled()) {
+ if (context.isCruiseContextFilled()) {
// direct fill catches screen
screen = TuttiScreen.FILL_FISHING_OPERATION;
} else {
- // go to select scientificCruise screen
- screen = TuttiScreen.SELECT_SCIENTIFIC_CRUISE;
+ // go to select cruise screen
+ screen = TuttiScreen.SELECT_CRUISE;
}
context.setScreen(screen);
@@ -159,8 +159,8 @@
@Override
public void run() {
- if (TuttiScreen.SELECT_SCIENTIFIC_CRUISE == context.getScreen()) {
- // Reselect home scientificCruise
+ if (TuttiScreen.SELECT_CRUISE == context.getScreen()) {
+ // Reselect home cruise
// SelectCampaignUI homeUI = (SelectCampaignUI) currentBody;
// homeUI.getHandler().selectCampaign();
}
@@ -230,7 +230,7 @@
}
public void showSelectCampaign() {
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
}
public void showFillCatches() {
@@ -320,16 +320,16 @@
closeCurrentBody();
String surveyId = context.getProgramId();
- String campaignId = context.getScientificCruiseId();
+ String campaignId = context.getCruiseId();
JComponent screenUI;
String screenTitle;
switch (screen) {
default:
- case SELECT_SCIENTIFIC_CRUISE:
+ case SELECT_CRUISE:
- screenUI = new SelectScientificCruiseUI(context);
+ screenUI = new SelectCruiseUI(context);
screenTitle = _("tutti.title.home");
break;
@@ -344,15 +344,15 @@
screenUI = new EditProgramUI(context);
break;
- case EDIT_SCIENTIFIC_CRUISE:
+ case EDIT_CRUISE:
if (campaignId == null) {
- screenTitle = _("tutti.title.create.scientificCruise");
+ screenTitle = _("tutti.title.create.cruise");
} else {
- screenTitle = _("tutti.title.edit.scientificCruise");
+ screenTitle = _("tutti.title.edit.cruise");
}
- screenUI = new EditScientificCruiseUI(context);
+ screenUI = new EditCruiseUI(context);
break;
case FILL_FISHING_OPERATION:
@@ -371,7 +371,7 @@
ErrorDialogUI.showError(e);
// go back to home
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
} finally {
// free ui
@@ -435,7 +435,7 @@
if (surveyId == null) {
- // no program selected (so neither scientificCruise)
+ // no program selected (so neither cruise)
title = _("tutti.title.noSelectedProgram");
@@ -447,22 +447,22 @@
title = _("tutti.title.selectedProgram", program.getName()) + " / ";
- String campaignId = context.getScientificCruiseId();
+ String campaignId = context.getCruiseId();
if (campaignId == null) {
- // no selected scientificCruise
+ // no selected cruise
- title += _("tutti.title.noSelectedScientificCruise");
+ title += _("tutti.title.noSelectedCruise");
} else {
- // selected scientificCruise
- ScientificCruise scientificCruise;
- scientificCruise = persistenceService.getScientificCruise(campaignId);
+ // selected cruise
+ Cruise cruise;
+ cruise = persistenceService.getCruise(campaignId);
- title += _("tutti.title.selectedScientificCruise", scientificCruise.getName());
+ title += _("tutti.title.selectedCruise", cruise.getName());
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -33,11 +33,11 @@
public enum TuttiScreen {
/**
- * To select program and scientificCruise.
+ * To select program and cruise.
*
* @since 0.1
*/
- SELECT_SCIENTIFIC_CRUISE,
+ SELECT_CRUISE,
/**
* To edit a program.
@@ -47,11 +47,11 @@
EDIT_PROGRAM,
/**
- * To edit a scientificCruise.
+ * To edit a cruise.
*
* @since 0.1
*/
- EDIT_SCIENTIFIC_CRUISE,
+ EDIT_CRUISE,
/**
* To edit a protocol.
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiService;
@@ -57,11 +57,11 @@
public static final String PROPERTY_PROGRAM_ID = "programId";
- public static final String PROPERTY_SCIENTIFIC_CRUISE_ID = "scientificCruiseId";
+ public static final String PROPERTY_CRUISE_ID = "cruiseId";
public static final String PROPERTY_SCREEN = "screen";
- public static final String PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED = "scientificCruiseContextFilled";
+ public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled";
/**
* Application context (only one for all the application).
@@ -99,11 +99,11 @@
protected String programId;
/**
- * Id of last selected scientificCruise (can be null if none ever selected).
+ * Id of last selected cruise (can be null if none ever selected).
*
* @since 0.1
*/
- protected String scientificCruiseId;
+ protected String cruiseId;
/**
* Current screen displayed in ui.
@@ -142,13 +142,13 @@
return programId;
}
- public String getScientificCruiseId() {
- return scientificCruiseId;
+ public String getCruiseId() {
+ return cruiseId;
}
- public boolean isScientificCruiseContextFilled() {
+ public boolean isCruiseContextFilled() {
return StringUtils.isNotBlank(programId) &&
- StringUtils.isNotBlank(scientificCruiseId);
+ StringUtils.isNotBlank(cruiseId);
}
public TuttiScreen getScreen() {
@@ -156,25 +156,25 @@
}
public void setProgramId(String programId) {
- boolean oldValue = isScientificCruiseContextFilled();
+ boolean oldValue = isCruiseContextFilled();
this.programId = programId;
// always propagate the change
firePropertyChange(PROPERTY_PROGRAM_ID, null, programId);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
- oldValue, isScientificCruiseContextFilled());
+ firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED,
+ oldValue, isCruiseContextFilled());
}
- public void setScientificCruiseId(String scientificCruiseId) {
- boolean oldValue = isScientificCruiseContextFilled();
+ public void setCruiseId(String cruiseId) {
+ boolean oldValue = isCruiseContextFilled();
- this.scientificCruiseId = scientificCruiseId;
+ this.cruiseId = cruiseId;
// always propagate the change
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_ID, null, scientificCruiseId);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
- oldValue, isScientificCruiseContextFilled());
+ firePropertyChange(PROPERTY_CRUISE_ID, null, cruiseId);
+ firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED,
+ oldValue, isCruiseContextFilled());
}
public void setScreen(TuttiScreen screen) {
@@ -191,10 +191,10 @@
setProgramId(getConfig().getProgramId());
}
- if (scientificCruiseId == null) {
+ if (cruiseId == null) {
// load it from config
- setScientificCruiseId(getConfig().getScientificCruiseId());
+ setCruiseId(getConfig().getCruiseId());
}
//check if programId is sane
@@ -208,7 +208,7 @@
// not found in this db
setProgramId(null);
- setScientificCruiseId(null);
+ setCruiseId(null);
if (log.isWarnEnabled()) {
log.warn("Remove invalid programId: " + programId);
@@ -221,31 +221,31 @@
setProgramId(programId);
- // test scientificCruiseId
- if (scientificCruiseId != null) {
+ // test cruiseId
+ if (cruiseId != null) {
- ScientificCruise campaign =
- persistenceService.getScientificCruise(scientificCruiseId);
+ Cruise campaign =
+ persistenceService.getCruise(cruiseId);
if (campaign != null &&
!campaign.getProgram().getId().equals(programId)) {
- // not matchin program, reset scientificCruise id
+ // not matchin program, reset cruise id
campaign = null;
}
if (campaign == null) {
// not found in this db
- setScientificCruiseId(null);
+ setCruiseId(null);
if (log.isWarnEnabled()) {
- log.warn("Remove invalid scientificCruiseId: " + scientificCruiseId);
+ log.warn("Remove invalid cruiseId: " + cruiseId);
}
} else {
if (log.isInfoEnabled()) {
- log.info("ScientificCruiseId valid: " + scientificCruiseId);
+ log.info("CruiseId valid: " + cruiseId);
}
}
}
@@ -259,7 +259,7 @@
addPropertyChangeListener(new PropertyChangeListener() {
Set<String> acceptedProperties = Sets.newHashSet(
- PROPERTY_PROGRAM_ID, PROPERTY_SCIENTIFIC_CRUISE_ID);
+ PROPERTY_PROGRAM_ID, PROPERTY_CRUISE_ID);
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -276,7 +276,7 @@
// Clear data references
programId = null;
- scientificCruiseId = null;
+ cruiseId = null;
IOUtils.closeQuietly(serviceContext);
@@ -292,11 +292,11 @@
protected void saveContextToConfig() {
if (log.isInfoEnabled()) {
- log.info("Save config (programId: " + programId + ", scientificCruiseId: " +
- scientificCruiseId + ")");
+ log.info("Save config (programId: " + programId + ", cruiseId: " +
+ cruiseId + ")");
}
config.setProgramId(programId);
- config.setScientificCruiseId(scientificCruiseId);
+ config.setCruiseId(cruiseId);
config.save();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -126,8 +126,8 @@
return applicationConfig.getOption(TuttiConfigOption.PROGRAM_ID.getKey());
}
- public String getScientificCruiseId() {
- return applicationConfig.getOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
+ public String getCruiseId() {
+ return applicationConfig.getOption(TuttiConfigOption.CRUISE_ID.getKey());
}
public KeyStroke getShortCut(String actionName) {
@@ -173,13 +173,13 @@
}
- public void setScientificCruiseId(String scientificCruiseId) {
- if (scientificCruiseId == null) {
+ public void setCruiseId(String cruiseId) {
+ if (cruiseId == null) {
Properties options = applicationConfig.getOptions();
- options.remove(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
+ options.remove(TuttiConfigOption.CRUISE_ID.getKey());
applicationConfig.setOptions(options);
} else {
- applicationConfig.setOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey(), scientificCruiseId);
+ applicationConfig.setOption(TuttiConfigOption.CRUISE_ID.getKey(), cruiseId);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -48,8 +48,8 @@
null,
String.class
),
- SCIENTIFIC_CRUISE_ID("tutti.scientificCruiseId",
- n_("tutti.config.scientificCruiseId"),
+ CRUISE_ID("tutti.cruiseId",
+ n_("tutti.config.cruiseId"),
null,
String.class
),
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,94 +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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#splitPane {
- orientation: {JSplitPane.VERTICAL_SPLIT};
- resizeWeight: 0.3;
- oneTouchExpandable: true;
- continuousLayout: true;
-}
-
-#form {
- border: {BorderFactory.createTitledBorder((String)null)};
-}
-
-#nameLabel {
- text: "tutti.label.program.name";
- labelFor: {nameField};
-}
-
-#nameField {
- text: {model.getName()};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {getStringValue(model.getComment())};
-}
-
-#zoneLabel {
- text: "tutti.label.program.zone";
- labelFor: {zoneComboBox};
-}
-
-#zoneComboBox {
- property: "zone";
- selectedItem: {model.getZone()};
-}
-
-#saveButton {
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
- actionIcon: "save";
-}
-
-#cancelButton {
- text: "tutti.action.cancel";
- actionIcon: "cancel";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,125 +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<EditProgramUIModel, EditProgramUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.Zone
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
-
- </import>
-
- <script><![CDATA[
-
- public EditProgramUI(TuttiUIContext context) {
- EditProgramUIHandler handler = new EditProgramUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditProgramUIHandler id='handler'
- initializer='getContextValue(EditProgramUIHandler.class)'/>
-
- <EditProgramUIModel id='model'
- initializer='getContextValue(EditProgramUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='name' component='nameField'/>
- <field name='zone' component='zoneComboBox'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
-
- <Table id='form' fill='both'>
-
- <!-- program name -->
- <row>
- <cell anchor='west'>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- </row>
-
- <!-- program zone -->
- <row>
- <cell>
- <JLabel id='zoneLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='zoneComboBox' constructorParams='this'
- genericType='Zone'/>
- </cell>
- </row>
-
- <!-- program comment -->
- <row weighty='0.8'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- actions -->
- <row anchor='south'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <!-- validation messages -->
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,135 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.data.Program;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Handler of UI {@link EditProgramUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditProgramUIHandler.class);
-
- private final EditProgramUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditProgramUIModel model = new EditProgramUIModel();
-
- String surveyId = context.getProgramId();
- if (surveyId == null) {
-
- if (log.isInfoEnabled()) {
- log.info("Edit new program");
- }
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Edit existing program " + surveyId);
- }
- // load existing program
- Program program = persistenceService.getProgram(surveyId);
-
- model.fromBean(program);
- }
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- EditProgramUIModel model = ui.getModel();
- initBeanComboBox(ui.getZoneComboBox(),
- persistenceService.getAllZone(),
- model.getZone());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new program can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- ui.getValidator().setBean(null);
- }
-
- @Override
- protected EditProgramUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public void save() {
-
- EditProgramUIModel model = ui.getModel();
-
- Program bean = model.toBean();
-
- Program saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createProgram(bean);
- } else {
- saved = persistenceService.saveProgram(bean);
- }
-
- context.setProgramId(saved.getId());
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,97 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- * Bean to edit a program.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ZONE = "zone";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_NAME = "name";
-
- protected String name;
-
- protected String comment;
-
- protected Zone zone;
-
- protected static Binder<EditProgramUIModel, Program> toBeanBinder =
- BinderFactory.newBinder(EditProgramUIModel.class,
- Program.class);
-
- protected static Binder<Program, EditProgramUIModel> fromBeanBinder =
- BinderFactory.newBinder(Program.class, EditProgramUIModel.class);
-
-
- public EditProgramUIModel() {
- super(Program.class, fromBeanBinder, toBeanBinder);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Zone getZone() {
- return zone;
- }
-
- public void setZone(Zone zone) {
- Object oldValue = getZone();
- this.zone = zone;
- firePropertyChange(PROPERTY_ZONE, oldValue, zone);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,223 +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%
- */
-
-JToolBar {
- floatable: false;
-}
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
-}
-
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-#splitPane {
- orientation: {JSplitPane.VERTICAL_SPLIT};
- resizeWeight: 0.3;
- oneTouchExpandable: true;
- continuousLayout: true;
-}
-
-#nameLabel {
- text: "tutti.label.scientificCruise.name";
- labelFor: {nameField};
-}
-
-#nameField {
- text: {model.getName()};
-}
-
-#yearLabel {
- text: "tutti.label.scientificCruise.year";
- labelFor: {yearField};
-}
-
-#yearField {
- property: "year";
- model: {model.getYear()};
- useFloat: false;
- numberPattern: {INT_4_DIGITS_PATTERN};
-}
-
-#surveyPartLabel {
- text: "tutti.label.scientificCruise.surveyPart";
- labelFor: {surveyPartField};
-}
-
-#surveyPartField {
- text: {model.getSurveyPart()};
-}
-
-#countryLabel {
- text: "tutti.label.scientificCruise.country";
- labelFor: {countryComboBox};
-}
-
-#countryComboBox {
- property: "country";
- selectedItem: {model.getCountry()};
-}
-
-#programLabel {
- text: "tutti.label.scientificCruise.program";
- labelFor: {surveyComboBox};
-}
-
-#surveyComboBox {
- property: "program";
- selectedItem: {model.getProgram()};
-}
-
-#beginDateLabel {
- text: "tutti.label.scientificCruise.beginDate";
- labelFor: {beginDateField};
-}
-
-#beginDateField {
- date: {model.getBeginDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#endDateLabel {
- text: "tutti.label.scientificCruise.endDate";
- labelFor: {endDateField};
-}
-
-#endDateField {
- date: {model.getEndDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#pocheLabel {
- text: "tutti.label.scientificCruise.poche";
- labelFor: {pocheField};
-}
-
-#pocheField {
- property: "poche";
- model: {model.getPoche()};
- useFloat: false;
- numberPattern: {INT_1_DIGITS_PATTERN};
-}
-
-#vesselPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#vesselHeader {
- labelText: {_("tutti.label.list.vessel")};
- list: {vesselList};
- beanType: {Vessel.class};
-}
-
-#gearPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#gearHeader {
- labelText: {_("tutti.label.list.gear")};
- list: {gearList};
- beanType: {Gear.class};
-}
-
-#headOfMissionPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfMissionHeader {
- labelText: {_("tutti.label.list.headOfMission")};
- list: {headOfMissionList};
- beanType: {Person.class};
-}
-
-#headOfSortRoomPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfSortRoomHeader {
- labelText: {_("tutti.label.list.headOfSortRoom")};
- list: {headOfSortRoomList};
- beanType: {Person.class};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {model.getComment()};
-}
-
-#saveButton {
- actionIcon: "save";
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon: "cancel";
- text: "tutti.action.cancel";
-}
-
-#generateNameButton {
- actionIcon: "generate";
- text: "tutti.action.generateCampaignName";
- enabled: {model.isCanGenerateName()};
-}
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,238 +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<EditScientificCruiseUIModel, EditScientificCruiseUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Program
- fr.ifremer.tutti.persistence.entities.referential.Country
- fr.ifremer.tutti.persistence.entities.referential.Gear
- fr.ifremer.tutti.persistence.entities.referential.Person
- fr.ifremer.tutti.persistence.entities.referential.Vessel
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
- public EditScientificCruiseUI(TuttiUIContext context) {
- EditScientificCruiseUIHandler handler = new EditScientificCruiseUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditScientificCruiseUIHandler id='handler'
- initializer='getContextValue(EditScientificCruiseUIHandler.class)'/>
-
- <EditScientificCruiseUIModel id='model'
- initializer='getContextValue(EditScientificCruiseUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='program' component='surveyComboBox'/>
- <field name='year' component='yearField'/>
- <field name='surveyPart' component='surveyPartField'/>
- <field name='name' component='nameField'/>
- <field name='poche' component='pocheField'/>
- <field name='country' component='countryComboBox'/>
- <field name='beginDate' component='beginDateField'/>
- <field name='endDate' component='endDateField'/>
- <field name='vessel' component='vesselPane'/>
- <field name='gear' component='gearPane'/>
- <field name='headOfMission' component='headOfMissionPane'/>
- <field name='headOfSortRoom' component='headOfSortRoomPane'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
- <Table fill='both'>
-
- <!-- scientificCruise program / year /program part / name -->
- <row>
- <cell anchor='west'>
- <JLabel id='programLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='surveyComboBox' constructorParams='this'
- genericType='Program'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='yearLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='yearField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='surveyPartLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='surveyPartField'
- onKeyReleased='handler.setText(event, "surveyPart")'/>
- </cell>
- </row>
-
- <!-- scientificCruise name -->
- <row>
- <cell>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- <cell columns='2'>
- <JButton id='generateNameButton'
- onActionPerformed='handler.generateCampaignName()'/>
- </cell>
- <cell>
- <JLabel id='pocheLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='pocheField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- scientificCruise country / begin date / end date -->
- <row>
- <cell>
- <JLabel id='countryLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='countryComboBox' constructorParams='this'
- genericType='Country'/>
- </cell>
- <cell>
- <JLabel id='beginDateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='beginDateField'
- onActionPerformed='handler.setDate(event, "beginDate")'/>
- </cell>
- <cell>
- <JLabel id='endDateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='endDateField'
- onActionPerformed='handler.setDate(event, "endDate")'/>
- </cell>
- </row>
-
- <!-- scientificCruise vessel / gear -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
- onFocusGained='vesselList.requestFocus()'>
- <JList id='vesselList'
- onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>
- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
- onFocusGained='gearList.requestFocus()'>
- <JList id='gearList'
- onValueChanged='handler.selectListData(event, "gear")'/>
- <BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- scientificCruise headOfMission / headOfSortRoom -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
-
- <JScrollPane id='headOfMissionPane'
- columnHeaderView="{headOfMissionHeader}"
- onFocusGained='headOfMissionList.requestFocus()'>
- <JList id='headOfMissionList'
- onValueChanged='handler.selectListData(event, "headOfMission")'/>
- <BeanListHeader id='headOfMissionHeader'
- genericType='Person'/>
- </JScrollPane>
- <JScrollPane id='headOfSortRoomPane'
- columnHeaderView="{headOfSortRoomHeader}"
- onFocusGained='headOfSortRoomList.requestFocus()'>
- <JList id='headOfSortRoomList'
- onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
- <BeanListHeader id='headOfSortRoomHeader'
- genericType='Person'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- scientificCruise comment -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Form Actions -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,176 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.List;
-
-/**
- * Handler of UI {@link EditScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditScientificCruiseUIHandler extends AbstractTuttiUIHandler<EditScientificCruiseUIModel> {
-
- private final EditScientificCruiseUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditScientificCruiseUIHandler(TuttiUIContext context, EditScientificCruiseUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditScientificCruiseUIModel model = new EditScientificCruiseUIModel();
-
- String campaignId = context.getScientificCruiseId();
- if (campaignId == null) {
-
- // create new scientificCruise
- Program program =
- persistenceService.getProgram(context.getProgramId());
- model.setProgram(program);
- model.setPoche(1);
- } else {
-
- // load existing program
- ScientificCruise scientificCruise =
- persistenceService.getScientificCruise(campaignId);
-
- model.fromBean(scientificCruise);
- }
- listModelIsModify(model);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- List<Person> users = persistenceService.getAllPerson();
-
- EditScientificCruiseUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getSurveyComboBox(),
- persistenceService.getAllProgram(),
- model.getProgram());
-
- initBeanComboBox(ui.getCountryComboBox(),
- persistenceService.getAllCountry(),
- model.getCountry());
-
- initBeanList(ui.getVesselHeader(),
- persistenceService.getAllVessel(),
- model.getVessel());
-
- initBeanList(ui.getGearHeader(),
- persistenceService.getAllGear(),
- model.getGear());
-
- initBeanList(ui.getHeadOfMissionHeader(),
- users,
- model.getHeadOfMission());
-
- initBeanList(ui.getHeadOfSortRoomHeader(),
- users,
- model.getHeadOfSortRoom());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new fishingOperation can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected EditScientificCruiseUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
-
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public void save() {
-
- EditScientificCruiseUIModel model = ui.getModel();
-
- ScientificCruise bean = model.toBean();
-
- ScientificCruise saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createScientificCruise(bean);
- } else {
- saved = persistenceService.saveScientificCruise(bean);
- }
-
- context.setProgramId(saved.getProgram().getId());
- context.setScientificCruiseId(saved.getId());
-
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public static final String scientificCruiseNameFormat = "%1$s_%2$s";
-
- public void generateCampaignName() {
-
- EditScientificCruiseUIModel model = getModel();
- Program program = model.getProgram();
- Integer year = model.getYear();
- String name = String.format(scientificCruiseNameFormat, program.getName(), year);
-
- String surveyPart = model.getSurveyPart();
- if (StringUtils.isNotEmpty(surveyPart)) {
- name += "_" + surveyPart;
- }
- model.setName(name);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,247 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model of UI {@link EditScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditScientificCruiseUIModel extends AbstractTuttiBeanUIModel<ScientificCruise, EditScientificCruiseUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_PROGRAM = "program";
-
- public static final String PROPERTY_NAME = "name";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_COUNTRY = "country";
-
- public static final String PROPERTY_SURVEY_PART = "surveyPart";
-
- public static final String PROPERTY_VESSEL = "vessel";
-
- public static final String PROPERTY_GEAR = "gear";
-
- public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
-
- public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
-
- public static final String PROPERTY_YEAR = "year";
-
- public static final String PROPERTY_POCHE = "poche";
-
- public static final String PROPERTY_BEGIN_DATE = "beginDate";
-
- public static final String PROPERTY_END_DATE = "endDate";
-
- public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
-
- protected Program program;
-
- protected Country country;
-
- protected String name;
-
- protected String surveyPart;
-
- protected List<Vessel> vessel;
-
- protected List<Gear> gear;
-
- protected List<Person> headOfMission;
-
- protected List<Person> headOfSortRoom;
-
- protected String comment;
-
- protected Integer year;
-
- protected Integer poche;
-
- protected Date beginDate;
-
- protected Date endDate;
-
- protected static Binder<EditScientificCruiseUIModel, ScientificCruise> toBeanBinder =
- BinderFactory.newBinder(EditScientificCruiseUIModel.class,
- ScientificCruise.class);
-
- protected static Binder<ScientificCruise, EditScientificCruiseUIModel> fromBeanBinder =
- BinderFactory.newBinder(ScientificCruise.class, EditScientificCruiseUIModel.class);
-
- public EditScientificCruiseUIModel() {
- super(ScientificCruise.class, fromBeanBinder, toBeanBinder);
- }
-
- public Program getProgram() {
- return program;
- }
-
- public void setProgram(Program program) {
- Object oldValue = getProgram();
- this.program = program;
- firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
- firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Country getCountry() {
- return country;
- }
-
- public void setCountry(Country country) {
- Object oldValue = getCountry();
- this.country = country;
- firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
- }
-
- public String getSurveyPart() {
- return surveyPart;
- }
-
- public void setSurveyPart(String surveyPart) {
- Object oldValue = getSurveyPart();
- this.surveyPart = surveyPart;
- firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
- }
-
- public Integer getYear() {
- return year;
- }
-
- public void setYear(Integer year) {
- Object oldValue = getYear();
- this.year = year;
- firePropertyChange(PROPERTY_YEAR, oldValue, year);
- firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
- }
-
- public Integer getPoche() {
- return poche;
- }
-
- public void setPoche(Integer poche) {
- Object oldValue = getPoche();
- this.poche = poche;
- firePropertyChange(PROPERTY_POCHE, oldValue, poche);
- }
-
- public Date getBeginDate() {
- return beginDate;
- }
-
- public void setBeginDate(Date beginDate) {
- Object oldValue = getBeginDate();
- this.beginDate = beginDate;
- firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public void setEndDate(Date endDate) {
- Object oldValue = getEndDate();
- this.endDate = endDate;
- firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
- }
-
- public List<Vessel> getVessel() {
- return vessel;
- }
-
- public void setVessel(List<Vessel> vessel) {
- this.vessel = vessel;
- firePropertyChange(PROPERTY_VESSEL, null, vessel);
- }
-
- public List<Gear> getGear() {
- return gear;
- }
-
- public void setGear(List<Gear> gear) {
- this.gear = gear;
- firePropertyChange(PROPERTY_GEAR, null, gear);
- }
-
- public List<Person> getHeadOfMission() {
- return headOfMission;
- }
-
- public void setHeadOfMission(List<Person> headOfMission) {
- this.headOfMission = headOfMission;
- firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
- }
-
- public List<Person> getHeadOfSortRoom() {
- return headOfSortRoom;
- }
-
- public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
- this.headOfSortRoom = headOfSortRoom;
- firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
- }
-
- public boolean isCanGenerateName() {
- return program != null && year != null;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,77 +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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#programLabel {
- text: "tutti.label.program";
-}
-
-#programCombobox {
- property: "program";
- selectedItem: {model.getProgram()};
-}
-
-#editProgramButton {
- enabled: {model.isProgramFound()};
- text: "tutti.action.edit";
- actionIcon: "edit";
-}
-
-#newProgramButton {
- text: "tutti.action.new";
- actionIcon: "add";
-}
-
-#scientificCruiseLabel {
- text: "tutti.label.scientificCruise";
- labelFor: {scientificCruiseCombobox};
-}
-
-#scientificCruiseCombobox {
- property: "scientificCruise";
- enabled: {model.isProgramFound()};
- selectedItem: {model.getScientificCruise()};
-}
-
-#editScientificCruiseButton {
- enabled: {model.isProgramFound() && model.isScientificCruiseFound()};
- text: "tutti.action.edit";
- actionIcon: "edit";
-}
-
-#newScientificCruiseButton {
- actionIcon: "add";
- enabled: {model.isProgramFound()};
- text: "tutti.action.new";
-}
-
-#showFishingOperationsButton {
- text: "tutti.action.catches";
- enabled: {uiContext.isScientificCruiseContextFilled()};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,102 +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<SelectScientificCruiseUIModel, SelectScientificCruiseUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Program
- fr.ifremer.tutti.persistence.entities.data.ScientificCruise
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
- protected TuttiUIContext uiContext;
-
- public SelectScientificCruiseUI(TuttiUIContext context) {
- this.uiContext = context;
- SelectScientificCruiseUIHandler handler =
- new SelectScientificCruiseUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <SelectScientificCruiseUIHandler id='handler'
- initializer='getContextValue(SelectScientificCruiseUIHandler.class)'/>
-
- <SelectScientificCruiseUIModel id='model'
- initializer='getContextValue(SelectScientificCruiseUIModel.class)'/>
-
- <Table fill='both' constraints='BorderLayout.CENTER'>
- <row>
- <cell anchor='west'>
- <JLabel id='programLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='programCombobox' constructorParams='this'
- genericType='Program'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editProgramButton'
- onActionPerformed='handler.showSelectedProgram()'/>
- <JButton id='newProgramButton'
- onActionPerformed='handler.showNewProgram()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='scientificCruiseLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='scientificCruiseCombobox' constructorParams='this'
- genericType='ScientificCruise'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editScientificCruiseButton'
- onActionPerformed='handler.showSelectedScientificCruise()'/>
- <JButton id='newScientificCruiseButton'
- onActionPerformed='handler.showNewScientificCruise()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='3'>
- <JButton id='showFishingOperationsButton'
- onActionPerformed='handler.showFishingOperations()'/>
- </cell>
- </row>
- </Table>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,204 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.swing.editor.bean.BeanComboBox;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Main ui content to select scientificCruise.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectScientificCruiseUIHandler extends AbstractTuttiUIHandler<SelectScientificCruiseUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SelectScientificCruiseUIHandler.class);
-
- protected final PersistenceService persistenceService;
-
- protected final SelectScientificCruiseUI ui;
-
- public SelectScientificCruiseUIHandler(TuttiUIContext context, SelectScientificCruiseUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- protected SelectScientificCruiseUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- public void beforeInitUI() {
- SelectScientificCruiseUIModel model = new SelectScientificCruiseUIModel();
-
- List<Program> allPrograms = persistenceService.getAllProgram();
-
- model.setPrograms(allPrograms);
-
- if (allPrograms.isEmpty()) {
- // do nothing
-
- if (log.isDebugEnabled()) {
- log.debug("No program found.");
- }
- } else {
-
- // get selected program (if any)
-
- String surveyId = context.getProgramId();
- Program selectedProgram = null;
- List<ScientificCruise> allScientificCruises = null;
- if (surveyId != null) {
- selectedProgram = TuttiEntities.findById(allPrograms, surveyId);
- allScientificCruises = persistenceService.getAllScientificCruise(surveyId);
- }
-
- model.setProgram(selectedProgram);
- model.setScientificCruises(allScientificCruises);
-
- if (CollectionUtils.isEmpty(allScientificCruises)) {
-
- // nothing to select
- } else {
- String campaignId = context.getScientificCruiseId();
-
- ScientificCruise selectedCampaign = null;
- if (campaignId != null) {
- selectedCampaign =
- TuttiEntities.findById(allScientificCruises, campaignId);
- }
- model.setScientificCruise(selectedCampaign);
- }
- }
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- SelectScientificCruiseUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getProgramCombobox(),
- model.getPrograms(),
- model.getProgram());
-
- initBeanComboBox(ui.getScientificCruiseCombobox(),
- model.getScientificCruises(),
- model.getScientificCruise());
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Program newValue = (Program) evt.getNewValue();
- boolean noSurvey = newValue == null;
- context.setProgramId(noSurvey ? null : newValue.getId());
- List<ScientificCruise> campaigns;
- if (noSurvey) {
- campaigns = Lists.newArrayList();
- } else {
- campaigns = persistenceService.getAllScientificCruise(newValue.getId());
- }
- SelectScientificCruiseUIModel model = (SelectScientificCruiseUIModel) evt.getSource();
- model.setScientificCruises(campaigns);
- model.setScientificCruise(null);
- }
- });
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- // reload combo box
- BeanComboBox<ScientificCruise> combobox = ui.getScientificCruiseCombobox();
- List<ScientificCruise> campaigns = (List<ScientificCruise>) evt.getNewValue();
- combobox.setData(null);
- combobox.setData(campaigns);
- }
- });
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISE, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- ScientificCruise newValue = (ScientificCruise) evt.getNewValue();
- context.setScientificCruiseId(newValue == null ? null : newValue.getId());
- }
- });
- }
-
- @Override
- public void onCloseUI() {
- PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
- for (PropertyChangeListener listener : listeners) {
- getModel().removePropertyChangeListener(listener);
- }
- }
-
- public void showFishingOperations() {
-
- context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
- }
-
- public void showSelectedProgram() {
-
- Program program = getModel().getProgram();
- context.setProgramId(program.getId());
- context.setScreen(TuttiScreen.EDIT_PROGRAM);
- }
-
- public void showNewProgram() {
- context.setProgramId(null);
- context.setScientificCruiseId(null);
- context.setScreen(TuttiScreen.EDIT_PROGRAM);
- }
-
- public void showSelectedScientificCruise() {
- ScientificCruise scientificCruise = getModel().getScientificCruise();
- context.setScientificCruiseId(scientificCruise.getId());
- context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
- }
-
- public void showNewScientificCruise() {
- context.setScientificCruiseId(null);
- context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%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.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model of ui {@link SelectScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectScientificCruiseUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_PROGRAMS = "programs";
-
- public static final String PROPERTY_PROGRAM = "program";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISES = "scientificCruises";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
-
- public static final String PROPERTY_PROGRAM_FOUND = "programFound";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE_FOUND = "scientificCruiseFound";
-
- protected List<Program> programs;
-
- protected Program program;
-
- protected List<ScientificCruise> scientificCruises;
-
- protected ScientificCruise scientificCruise;
-
- public List<Program> getPrograms() {
- return programs;
- }
-
- public void setPrograms(List<Program> programs) {
- Object oldValue = getPrograms();
- this.programs = programs;
-
- // nullify program
-// setProgram(null);
- firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
- }
-
- public Program getProgram() {
- return program;
- }
-
- public void setProgram(Program program) {
- Program oldValue = getProgram();
- this.program = program;
-
- // nullify scientificCruises
-// setScientificCruises(null);
-
- firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
- firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
- }
-
- public boolean isProgramFound() {
- return program != null;
- }
-
- public List<ScientificCruise> getScientificCruises() {
- return scientificCruises;
- }
-
- public void setScientificCruises(List<ScientificCruise> scientificCruises) {
- Object oldValue = getScientificCruises();
- this.scientificCruises = scientificCruises;
-
- // nullify scientificCruise
-// setScientificCruise(null);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISES, oldValue, scientificCruises);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- ScientificCruise oldValue = getScientificCruise();
- this.scientificCruise = scientificCruise;
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_FOUND, oldValue != null, scientificCruise != null);
- }
-
- public boolean isScientificCruiseFound() {
- return scientificCruise != null;
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,538 +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%
- */
-
-JToolBar {
- floatable: false;
-}
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
-}
-
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-SimpleTimeEditor {
- bean: {model};
-}
-
-#stationNumberLabel {
- text: "tutti.label.fishingOperation.stationNumber";
- labelFor: {stationNumberField};
-}
-
-#stationNumberField {
- property: "stationNumber";
- model: {model.getStationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#fishingOperationNumberLabel {
- text: "tutti.label.fishingOperation.fishingOperationNumber";
- labelFor: {fishingOperationNumberField};
-}
-
-#fishingOperationNumberField {
- property: "fishingOperationNumber";
- model: {model.getFishingOperationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#dateLabel {
- text: "tutti.label.fishingOperation.date";
- labelFor: {dateField};
-}
-
-#dateField {
- date: {model.getDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#strataLabel {
- text: "tutti.label.fishingOperation.strata";
- labelFor: {strataComboBox};
-}
-
-#strataComboBox {
- property: "strata";
- selectedItem: {model.getStrata()};
-}
-
-#subStrataLabel {
- text: "tutti.label.fishingOperation.subStrata";
- labelFor: {subStrataComboBox};
-}
-
-#subStrataComboBox {
- property: "subStrata";
- selectedItem: {model.getSubStrata()};
-}
-
-#localiteLabel {
- text: "tutti.label.fishingOperation.localite";
- labelFor: {localiteField};
-}
-
-#localiteField {
- text: {model.getLocalite()};
-}
-
-#gearLongitudeLabel {
- text: "tutti.label.fishingOperation.gearLongitude";
-}
-
-#gearLatitudeLabel {
- text: "tutti.label.fishingOperation.gearLatitude";
-}
-
-#gearDateLabel {
- text: "tutti.label.fishingOperation.gearDate";
-}
-
-#gearTimeLabel {
- text: "tutti.label.fishingOperation.gearTime";
-}
-
-#gearShootingStartLabel {
- text: "tutti.label.fishingOperation.gearShootingStart";
-}
-
-#gearShootingEndLabel {
- text: "tutti.label.fishingOperation.gearShootingEnd";
-}
-
-#gearShootingStartLongitudeField {
- text: {getStringValue(model.getGearShootingStartLongitude())};
-}
-
-#gearShootingStartLatitudeField {
- text: {getStringValue(model.getGearShootingStartLatitude())};
-}
-
-#gearShootingStartDateField {
- date: {model.getGearShootingStartDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingStartTimeField {
- property: "gearShootingStartDate";
- date: {model.getGearShootingStartDate()};
-}
-
-#gearShootingEndLongitudeField {
- text: {getStringValue(model.getGearShootingEndLongitude())};
-}
-
-#gearShootingEndLatitudeField {
- text: {getStringValue(model.getGearShootingEndLatitude())};
-}
-
-#gearShootingEndDateField {
- date: {model.getGearShootingEndDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingEndTimeField {
- property: "gearShootingEndDate";
- date: {model.getGearShootingEndDate()};
-}
-
-#fishingOperationValidPanel {
- floatable: false;
- borderPainted: false;
- opaque: false;
-}
-
-#resetValidStateButton {
- actionIcon: "reset";
- text: "tutti.action.reset.fishingOperationValidState";
-}
-
-#fishingOperationValidRadio {
- text: "tutti.label.fishingOperation.fishingOperationValid";
- selected: {model.getFishingOperationValid() == Boolean.TRUE};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationInvalidRadio {
- text: "tutti.label.fishingOperation.fishingOperationInvalid";
- selected: {model.getFishingOperationValid() == Boolean.FALSE};
- buttonGroup: "fishingOperationValid";
-}
-#fishingOperationResetRadio {
- selected: {model.getFishingOperationValid() == null};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationRectiligneCheckBox {
- text: "tutti.label.fishingOperation.fishingOperationRectiligne";
- selected: {model.isFishingOperationRectiligne()};
-}
-
-#distanceChaluteeLabel {
- text: "tutti.label.fishingOperation.distanceChalutee";
- labelFor: {distanceChaluteeField};
-}
-
-#distanceChaluteeField {
- property: "distanceChalutee";
- model: {model.getDistanceChalutee()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
- enabled: {!model.isFishingOperationRectiligne()};
-}
-
-#beaufortScaleLabel {
- text: "tutti.label.fishingOperation.beaufortScale";
- labelFor: {beaufortScaleComboBox};
-}
-
-#beaufortScaleComboBox {
- property: "beaufortScale";
- selectedItem: {model.getBeaufortScale()};
-}
-
-#windDirectionLabel {
- text: "tutti.label.fishingOperation.windDirection";
- labelFor: {windDirectionField};
-}
-
-#windDirectionField {
- property: "windDirection";
- model: {model.getWindDirection()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#seaStateLabel {
- text: "tutti.label.fishingOperation.seaState";
- labelFor: {seaStateComboBox};
-}
-
-#seaStateComboBox {
- property: "seaState";
- selectedItem: {model.getSeaState()};
-}
-
-#ouvertureHorizontaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontale";
- labelFor: {ouvertureHorizontaleField};
-}
-
-#ouvertureHorizontaleVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
-}
-
-#ouvertureHorizontaleField {
- property: "ouvertureHorizontale";
- model: {model.getOuvertureHorizontale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#ouvertureVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureVerticale";
- labelFor: {ouvertureVerticaleField};
-}
-
-#ouvertureVerticaleField {
- property: "ouvertureVerticale";
- model: {model.getOuvertureVerticale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#geometrieMesureeCheckBox {
- text: "tutti.label.fishingOperation.geometrieMesuree";
- selected: {model.isGeometrieMesuree()};
-}
-
-#longueurFunesLabel {
- text: "tutti.label.fishingOperation.longueurFunes";
- labelFor: {longueurFunesField};
-}
-
-#longueurFunesBrasLabel {
- text: "tutti.label.fishingOperation.longueurFunesBras";
-}
-
-#longueurFunesField {
- property: "longueurFunes";
- model: {model.getLongueurFunes()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#longueurBrasLabel {
- text: "tutti.label.fishingOperation.longueurBras";
- labelFor: {longueurBrasField};
-}
-
-#longueurBrasField {
- property: "longueurBras";
- model: {model.getLongueurBras()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#systemeFermetureCulCheckBox {
- text: "tutti.label.fishingOperation.systemeFermetureCul";
- selected: {model.isSystemeFermetureCul()};
-}
-
-#dureeLabel {
- text: "tutti.label.fishingOperation.duree";
- labelFor: {dureeField};
-}
-
-#dureeField {
- property: "duree";
- model: {model.getDuree()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#saisisseurPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#saisisseurHeader {
- labelText: {_("tutti.label.list.saisisseur")};
- list: {saisisseurList};
- beanType: {Person.class};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {model.getComment()};
-}
-
-#gearShootingStartDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingStartDepth";
- labelFor: {gearShootingStartDepthField};
-}
-
-#gearShootingStartDepthField {
- property: "gearShootingStartDepth";
- model: {model.getGearShootingStartDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingEndDepth";
- labelFor: {gearShootingEndDepthField};
-}
-
-#gearShootingEndDepthField {
- property: "gearShootingEndDepth";
- model: {model.getGearShootingEndDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
- labelFor: {gearShootingStartSurfaceTemperatureField};
-}
-
-#gearShootingStartSurfaceTemperatureField {
- property: "gearShootingStartSurfaceTemperature";
- model: {model.getGearShootingStartSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
- labelFor: {gearShootingEndSurfaceTemperatureField};
-}
-
-#gearShootingEndSurfaceTemperatureField {
- property: "gearShootingEndSurfaceTemperature";
- model: {model.getGearShootingEndSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
- labelFor: {gearShootingStartBottomTemperatureField};
-}
-
-#gearShootingStartBottomTemperatureField {
- property: "gearShootingStartBottomTemperature";
- model: {model.getGearShootingStartBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
- labelFor: {gearShootingEndBottomTemperatureField};
-}
-
-#gearShootingEndBottomTemperatureField {
- property: "gearShootingEndBottomTemperature";
- model: {model.getGearShootingEndBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.averageBottomTemperature";
- labelFor: {averageBottomTemperatureField};
-}
-
-#averageBottomTemperatureField {
- property: "averageBottomTemperature";
- model: {model.getAverageBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
- labelFor: {gearShootingStartSurfaceSalinityField};
-}
-
-#gearShootingStartSurfaceSalinityField {
- property: "gearShootingStartSurfaceSalinity";
- model: {model.getGearShootingStartSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
- labelFor: {gearShootingEndSurfaceSalinityField};
-}
-
-#gearShootingEndSurfaceSalinityField {
- property: "gearShootingEndSurfaceSalinity";
- model: {model.getGearShootingEndSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
- labelFor: {gearShootingStartBottomSalinityField};
-}
-
-#gearShootingStartBottomSalinityField {
- property: "gearShootingStartBottomSalinity";
- model: {model.getGearShootingStartBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
- labelFor: {gearShootingEndBottomSalinityField};
-}
-
-#gearShootingEndBottomSalinityField {
- property: "gearShootingEndBottomSalinity";
- model: {model.getGearShootingEndBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomSalinityLabel {
- text: "tutti.label.fishingOperation.averageBottomSalinity";
- labelFor: {averageBottomSalinityField};
-}
-
-#averageBottomSalinityField {
- property: "averageBottomSalinity";
- model: {model.getAverageBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#noTraitPane {
- text: "tutti.label.no.fishingOperation.selected";
- horizontalAlignment: {JLabel.CENTER};
-}
-
-#saveButton {
- actionIcon: "save";
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon: "cancel";
- text: "tutti.action.cancel";
- enabled: {model.isModify()};
-}
-
-#importPupitriButton {
- actionIcon: "pupitri-import";
- text: "tutti.action.pupitri-import";
-}
-
-#importCasinoButton {
- actionIcon: "casino-import";
- text: "tutti.action.casino-import";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,550 +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<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
- fr.ifremer.tutti.persistence.entities.referential.SeaState
- fr.ifremer.tutti.persistence.entities.referential.Strata
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
- fr.ifremer.tutti.persistence.entities.referential.Person
-
- fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
- jaxx.runtime.swing.editor.NumberEditor
- jaxx.runtime.swing.editor.TimeEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
-
- java.awt.Dimension
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public FishingOperationTabUI(FishingOperationsUI parentUI) {
- FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <FishingOperationTabUIHandler id='handler'
- initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
-
- <FishingOperationTabUIModel id='model'
- initializer='getContextValue(FishingOperationTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='stationNumber' component='stationNumberField'/>
- <field name='fishingOperationNumber'
- component='fishingOperationNumberField'/>
- <field name='date' component='dateField'/>
- <field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
- </BeanValidator>
-
- <JPanel id='traitPane' constraints='BorderLayout.CENTER'
- layout='{new BorderLayout()}'>
-
- <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitGeneralTab'
- title='tutti.label.tab.fishingOperation.general'>
- <Table fill='both' id='generalForm'>
-
- <!-- Numero station / Numéro trait / Date -->
- <row>
- <cell anchor='west'>
- <JLabel id='stationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='fishingOperationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='fishingOperationNumberField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='dateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='dateField'
- onActionPerformed='handler.setDate(event, "date")'/>
- </cell>
- </row>
-
- <!-- Strate d'association / Sous Strate / Localité -->
- <row>
- <cell>
- <JLabel id='strataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='strataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='subStrataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='subStrataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='localiteLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='localiteField'
- onKeyReleased='handler.setText(event, "localite")'/>
- </cell>
- </row>
-
- <!-- début de traine long-lat-date-heure
- fin de traine long-lat-date-heure -->
- <row>
- <cell columns='6'>
- <JPanel layout="{new BorderLayout()}">
- <Table id="gearCaracteristicsTable" fill="both" weightx='1'
- constraints='BorderLayout.CENTER'>
- <row>
- <cell>
- <JLabel/>
- </cell>
- <cell>
- <JLabel id='gearLongitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearLatitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearDateLabel'/>
- </cell>
- <cell>
- <JLabel id='gearTimeLabel'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLongitudeField'
- onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLatitudeLabel'
- onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingStartDateField'
- onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingStartTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='gearShootingEndLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLongitudeField'
- onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLatitudeLabel'
- onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingEndDateField'
- onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingEndTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
-
- <!-- Fishing operation valid / invalid-->
- <row>
- <cell columns="2">
- <JToolBar id='fishingOperationValidPanel'
- layout='{new BorderLayout()}'>
- <JButton id='resetValidStateButton'
- constraints='BorderLayout.WEST'
- onActionPerformed="model.setFishingOperationValid(null)"/>
- <JRadioButton id='fishingOperationResetRadio'
- constraints='BorderLayout.EAST'/>
- </JToolBar>
- </cell>
- <cell columns="2">
- <JRadioButton id='fishingOperationValidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
- </cell>
- <cell columns="2">
- <JRadioButton id='fishingOperationInvalidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
- </cell>
- </row>
-
- <!-- FishingOperation rectiligne / distance chalutee / durée -->
- <row>
- <cell>
- <JCheckBox id='fishingOperationRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
- </cell>
- <cell columns="3">
- <JPanel layout="{new BorderLayout()}">
- <JLabel id='distanceChaluteeLabel'
- constraints='BorderLayout.WEST'/>
- <NumberEditor id='distanceChaluteeField'
- constraints='BorderLayout.CENTER'
- constructorParams='this'/>
- </JPanel>
- </cell>
- <cell anchor='west'>
- <JLabel id='dureeLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='dureeField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Actions d'import -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- <JButton id='importCasinoButton'
- onActionPerformed='handler.importCasino()'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Saisisseur -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='saisisseurPane'
- columnHeaderView="{saisisseurHeader}"
- onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Commentaire -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitGearShootingTab'
- title='tutti.label.tab.fishingOperation.gearShooting'>
-
- <Table fill='both' id='gearShootingForm'>
-
- <!-- GearShootingStart Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture horizontale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture verticale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur funes -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurFunesLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur bras -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Système de fermeture du cul / Geometrie mesuree -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='environmentTab'
- title='tutti.label.tab.fishingOperation.environment'>
-
- <Table fill='both' id='environmentForm'>
-
- <!-- Beaufort scale -->
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
-
- <!-- Wind direction -->
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Sea state-->
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitHydrologyTabContent'
- title='tutti.label.tab.fishingOperation.hydrology'>
-
- <Table fill='both' id='hydrologyForm'>
-
- <!-- GearShootingStartSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomTemperature -->
- <row>
- <cell>
- <JLabel id='averageBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomSalinity -->
- <row>
- <cell>
- <JLabel id='averageBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- </Table>
- </tab>
- </JTabbedPane>
-
- <!-- Actions -->
- <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
- <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'/>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,242 +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.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import java.awt.BorderLayout;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Handler for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FishingOperationTabUIHandler.class);
-
- private final FishingOperationTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishingOperationTabUIModel model = new FishingOperationTabUIModel();
- model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- JPanel form = ui.getTraitPane();
- JLabel noContentPane = ui.getNoTraitPane();
-
- Boolean empty = (Boolean) evt.getNewValue();
- ui.remove(form);
- ui.remove(noContentPane);
- if (empty) {
- ui.add(noContentPane, BorderLayout.CENTER);
- } else {
- ui.add(form, BorderLayout.CENTER);
- }
- ui.repaint();
- }
- });
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- ui.getFishingOperationValidPanel().remove(
- ui.getFishingOperationResetRadio());
-
- FishingOperationTabUIModel model = ui.getModel();
-
- initUI(ui);
-
- initBeanList(ui.getSaisisseurHeader(),
- persistenceService.getAllPerson(),
- model.getSaisisseur());
-
- initBeanComboBox(ui.getBeaufortScaleComboBox(),
- persistenceService.getAllBeaufortScale(),
- model.getBeaufortScale());
-
- initBeanComboBox(ui.getStrataComboBox(),
- persistenceService.getAllStrata(),
- model.getStrata());
-
- initBeanComboBox(ui.getSeaStateComboBox(),
- persistenceService.getAllSeaState(),
- model.getSeaState());
-
- model.setEmpty(true);
-
- listenValidatorValid(ui.getValidator(), getModel());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected FishingOperationTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- FishingOperationTabUIModel model = getModel();
-
- // clean previous selection
- ui.getSaisisseurHeader().getList().clearSelection();
-
- if (empty) {
-
- model.fromBean(new FishingOperation());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<Person> saisisseur = model.getSaisisseur();
- if (CollectionUtils.isNotEmpty(saisisseur)) {
- updateIndices(ui.getSaisisseurList(), saisisseur);
- }
-
- // update model empty property
- model.setEmpty(empty);
-
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
- }
-
- public void cancel() {
-
- String id = getModel().getId();
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition for fishingOperation: " + id);
- }
- boolean newBean = StringUtils.isBlank(id);
-
- if (newBean) {
-
- // cancel to create a new fishingOperation
- parentUi.getHandler().selectFishingOperation(null);
-
- } else {
-
- // reselect in ui the fishingOperation
- FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
- parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
- }
- }
-
- public void save() {
-
- // get fishingOperation to save
- FishingOperation toSave = getModel().toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Save edition for fishingOperation: " + toSave.getId());
- }
-
- // keep selected tab (to resotre it after save)
- int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
-
- // persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave);
-
- // reselect current tab
- ui.getTraitTabPane().setSelectedIndex(selectedIndex);
-
- getModel().setModify(false);
- }
-
- public void importPupitri() {
- //TODO
- }
-
- public void importCasino() {
- //TODO
- }
-
- public void setGearShootingStartLatitude(String text) {
- getModel().setGearShootingStartLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingStartLongitude(String text) {
- getModel().setGearShootingStartLongitude(Float.valueOf(text));
- }
-
-// public void setGearShootingStartTime(String text) {
-// getModel().setGearShootingStartTime(Integer.valueOf(text));
-// }
-
- public void setGearShootingEndLatitude(String text) {
- getModel().setGearShootingEndLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndLongitude(String text) {
- getModel().setGearShootingEndLongitude(Float.valueOf(text));
- }
-
-// public void setGearShootingEndTime(String text) {
-// getModel().setGearShootingEndTime(Integer.valueOf(text));
-// }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,633 +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.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_EMPTY = "empty";
-
- public static final String PROPERTY_STATION_NUMBER = "stationNumber";
-
- public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
-
- public static final String PROPERTY_DATE = "date";
-
- public static final String PROPERTY_STRATA = "strata";
-
- public static final String PROPERTY_SUB_STRATA = "subStrata";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
-
- public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
-
- public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-
- public static final String PROPERTY_SEA_STATE = "seaState";
-
- public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
-
- public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
-
- public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
-
- public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
-
- public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
-
- public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
-
- public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
-
- public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
-
- public static final String PROPERTY_DUREE = "duree";
-
- public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
-
- public static final String PROPERTY_LOCALITE = "localite";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_SAISISSEUR = "saisisseur";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
-
- protected boolean empty;
-
- protected ScientificCruise scientificCruise;
-
- protected Integer stationNumber;
-
- protected Integer fishingOperationNumber;
-
- protected Date date;
-
- protected Strata strata;
-
- protected Strata subStrata;
-
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartDate;
-
- protected Integer gearShootingStartTime;
-
- protected Float gearShootingStartDepth;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndDate;
-
- protected Integer gearShootingEndTime;
-
- protected Float gearShootingEndDepth;
-
- protected BeaufortScale beaufortScale;
-
- protected Integer windDirection;
-
- protected SeaState seaState;
-
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
- protected boolean fishingOperationRectiligne;
-
- protected Float distanceChalutee;
-
- protected Float duree;
-
- protected Boolean fishingOperationValid;
-
- protected String localite;
-
- protected String comment;
-
- protected List<Person> saisisseur;
-
- protected Float gearShootingStartSurfaceTemperature;
-
- protected Float gearShootingEndSurfaceTemperature;
-
- protected Float gearShootingStartBottomTemperature;
-
- protected Float gearShootingEndBottomTemperature;
-
- protected Float averageBottomTemperature;
-
- protected Float gearShootingStartSurfaceSalinity;
-
- protected Float gearShootingEndSurfaceSalinity;
-
- protected Float gearShootingStartBottomSalinity;
-
- protected Float gearShootingEndBottomSalinity;
-
- protected Float averageBottomSalinity;
-
- protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
- BinderFactory.newBinder(FishingOperationTabUIModel.class,
- FishingOperation.class);
-
- protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
- BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
-
- public FishingOperationTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public boolean isEmpty() {
- return empty;
- }
-
- public void setEmpty(boolean empty) {
- Object oldValue = isEmpty();
- this.empty = empty;
- firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- this.scientificCruise = scientificCruise;
- }
-
- public Integer getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(Integer stationNumber) {
- Object oldValue = getStationNumber();
- this.stationNumber = stationNumber;
- firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
- }
-
- public Integer getFishingOperationNumber() {
- return fishingOperationNumber;
- }
-
- public void setFishingOperationNumber(Integer fishingOperationNumber) {
- Object oldValue = getFishingOperationNumber();
- this.fishingOperationNumber = fishingOperationNumber;
- firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- Object oldValue = getDate();
- this.date = date;
- firePropertyChange(PROPERTY_DATE, oldValue, date);
- }
-
- public Strata getStrata() {
- return strata;
- }
-
- public void setStrata(Strata strata) {
- Object oldValue = getStrata();
- this.strata = strata;
- firePropertyChange(PROPERTY_STRATA, oldValue, strata);
- }
-
- public Strata getSubStrata() {
- return subStrata;
- }
-
- public void setSubStrata(Strata subStrata) {
- Object oldValue = getSubStrata();
- this.subStrata = subStrata;
- firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- Object oldValue = getGearShootingStartLatitude();
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
- }
-
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- Object oldValue = getGearShootingStartLongitude();
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
- }
-
- public Date getGearShootingStartDate() {
- return gearShootingStartDate;
- }
-
- public void setGearShootingStartDate(Date gearShootingStartDate) {
- Object oldValue = getGearShootingStartDate();
- this.gearShootingStartDate = gearShootingStartDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
- }
-
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- Object oldValue = getGearShootingStartDepth();
- this.gearShootingStartDepth = gearShootingStartDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
- }
-
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- Object oldValue = getGearShootingEndLatitude();
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
- }
-
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- Object oldValue = getGearShootingEndLongitude();
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
- }
-
- public Date getGearShootingEndDate() {
- return gearShootingEndDate;
- }
-
- public void setGearShootingEndDate(Date gearShootingEndDate) {
- Object oldValue = getGearShootingEndDate();
- this.gearShootingEndDate = gearShootingEndDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
- }
-
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- Object oldValue = getGearShootingEndDepth();
- this.gearShootingEndDepth = gearShootingEndDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
- }
-
- public BeaufortScale getBeaufortScale() {
- return beaufortScale;
- }
-
- public void setBeaufortScale(BeaufortScale beaufortScale) {
- Object oldValue = getBeaufortScale();
- this.beaufortScale = beaufortScale;
- firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
- }
-
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- Object oldValue = getWindDirection();
- this.windDirection = windDirection;
- firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
- }
-
- public SeaState getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaState seaState) {
- Object oldValue = getSeaState();
- this.seaState = seaState;
- firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
- }
-
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- Object oldValue = getOuvertureHorizontale();
- this.ouvertureHorizontale = ouvertureHorizontale;
- firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- Object oldValue = getOuvertureVerticale();
- this.ouvertureVerticale = ouvertureVerticale;
- firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
- }
-
- public boolean isGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void setGeometrieMesuree(boolean geometrieMesuree) {
- Object oldValue = isGeometrieMesuree();
- this.geometrieMesuree = geometrieMesuree;
- firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- Object oldValue = getLongueurFunes();
- this.longueurFunes = longueurFunes;
- firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- Object oldValue = getLongueurBras();
- this.longueurBras = longueurBras;
- firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
- }
-
- public boolean isSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- Object oldValue = isSystemeFermetureCul();
- this.systemeFermetureCul = systemeFermetureCul;
- firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
- }
-
- public boolean isFishingOperationRectiligne() {
- return fishingOperationRectiligne;
- }
-
- public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
- Object oldValue = isFishingOperationRectiligne();
- this.fishingOperationRectiligne = fishingOperationRectiligne;
- firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
- }
-
- public Float getDistanceChalutee() {
- return distanceChalutee;
- }
-
- public void setDistanceChalutee(Float distanceChalutee) {
- Object oldValue = getDistanceChalutee();
- this.distanceChalutee = distanceChalutee;
- firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
- }
-
- public Float getDuree() {
- return duree;
- }
-
- public void setDuree(Float duree) {
- Object oldValue = getDuree();
- this.duree = duree;
- firePropertyChange(PROPERTY_DUREE, oldValue, duree);
- }
-
- public Boolean getFishingOperationValid() {
- return fishingOperationValid;
- }
-
- public void setFishingOperationValid(Boolean fishingOperationValid) {
- Object oldValue = getFishingOperationValid();
- this.fishingOperationValid = fishingOperationValid;
- firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
- }
-
- public String getLocalite() {
- return localite;
- }
-
- public void setLocalite(String localite) {
- Object oldValue = getLocalite();
- this.localite = localite;
- firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Person> getSaisisseur() {
- return saisisseur;
- }
-
- public void setSaisisseur(List<Person> saisisseur) {
- this.saisisseur = saisisseur;
- firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
- }
-
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- Object oldValue = getGearShootingStartSurfaceTemperature();
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- Object oldValue = getGearShootingEndSurfaceTemperature();
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- Object oldValue = getGearShootingStartBottomTemperature();
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- Object oldValue = getGearShootingEndBottomTemperature();
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- Object oldValue = getAverageBottomTemperature();
- this.averageBottomTemperature = averageBottomTemperature;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- Object oldValue = getGearShootingStartSurfaceSalinity();
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- Object oldValue = getGearShootingEndSurfaceSalinity();
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- Object oldValue = getGearShootingStartBottomSalinity();
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- Object oldValue = getGearShootingEndBottomSalinity();
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- Object oldValue = getAverageBottomSalinity();
- this.averageBottomSalinity = averageBottomSalinity;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,64 +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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#newFishingOperationButton {
- text: "tutti.action.new";
- actionIcon: "add";
-}
-
-#traitComboBox {
- property: "selectedFishingOperation";
- selectedItem: {model.getSelectedFishingOperation()};
-}
-
-#speciesTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#benthosTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#planctonTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#macroDechetTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#accidentelTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#observationIndividuelTab {
- enabled: {false};
- /*enabled: {model.getSelectedFishingOperation() != null};*/
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,99 +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<FishingOperationsUIModel, FishingOperationsUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- 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
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-public FishingOperationsUI(TuttiUIContext context) {
- FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() {
- handler.afterInitUI();
-}
- ]]></script>
-
- <FishingOperationsUIHandler id='handler'
- initializer='getContextValue(FishingOperationsUIHandler.class)'/>
-
- <FishingOperationsUIModel id='model'
- initializer='getContextValue(FishingOperationsUIModel.class)'/>
-
- <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
-
- <!-- FishingOperations fishingOperation -->
- <row>
- <cell anchor='west' weightx='1.0'>
- <BeanComboBox id='traitComboBox' constructorParams='this'
- genericType='FishingOperation'/>
- </cell>
- <cell anchor='east'>
- <JButton id='newFishingOperationButton'
- onActionPerformed='getHandler().createNewFishingOperation()'/>
- </cell>
- </row>
- </Table>
-
- <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
- <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
- </tab>
- <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'>
- <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
- </tab>
- <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
- <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
- </tab>
- <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}'/>
- </tab>
- </JTabbedPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,209 +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.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Handler of UI {@link FishingOperationsUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
-
- private final FishingOperationsUI ui;
-
- private final PersistenceService persistenceService;
-
- public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishingOperationsUIModel model = new FishingOperationsUIModel();
-
- String campaignId = context.getScientificCruiseId();
-
- // load existing scientificCruise
- ScientificCruise scientificCruise = persistenceService.getScientificCruise(campaignId);
- model.setScientificCruise(scientificCruise);
-
- List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(campaignId);
- model.setFishingOperation(fishingOperations);
-
- if (log.isInfoEnabled()) {
- log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
- }
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- FishingOperationsUIModel model = getModel();
-
- initUI(ui);
-
- List<FishingOperation> fishingOperations = model.getFishingOperation();
-
- initBeanComboBox(ui.getTraitComboBox(),
- fishingOperations,
- model.getSelectedFishingOperation());
-
- model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- selectFishingOperation((FishingOperation) evt.getNewValue());
- }
- });
-
- model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
- }
- });
-
- if (!fishingOperations.isEmpty()) {
-
- model.setSelectedFishingOperation(fishingOperations.get(0));
- }
- }
-
- @Override
- public void onCloseUI() {
-
- // ui will be saved so we do not want to keep selected tab indexes
- ui.getTabPane().setSelectedIndex(0);
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // when quitting ui, let's de-select fishingOperation (will save any changes)
- selectFishingOperation(null);
- }
-
- @Override
- protected FishingOperationsUIModel getModel() {
- return ui.getModel();
- }
-
- public void createNewFishingOperation() {
-
- // deselect selected fishingOperation
- getModel().setSelectedFishingOperation(null);
-
- // use a new empty fishingOperation
- FishingOperation newFishingOperation = new FishingOperation();
- newFishingOperation.setScientificCruise(getModel().getScientificCruise());
-
- // by default use the current day with no time information
- Date currentDate = new Date();
- currentDate = DateUtils.setHours(currentDate, 0);
- currentDate = DateUtils.setMinutes(currentDate, 0);
-
- newFishingOperation.setDate(currentDate);
- newFishingOperation.setGearShootingStartDate(currentDate);
- newFishingOperation.setGearShootingEndDate(currentDate);
- selectFishingOperation(newFishingOperation);
- }
-
- public void selectFishingOperation(FishingOperation fishingOperation) {
-
- if (log.isInfoEnabled()) {
- log.info("New selected fishingOperation: " + fishingOperation);
- }
- // back to fishingOperation tab
- ui.getTabPane().setSelectedIndex(0);
-
- // back to general tab of fishingOperation tabs
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // propagate fishingOperation to his tabs
- ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
- ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
- ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
- ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
- ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
- ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
-
- // repaint tabs
- ui.getTabPane().repaint();
-// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
- }
-
- public void saveFishingOperation(FishingOperation toSave) {
-
- // persist the fishingOperation
-
- boolean create = toSave.getId() == null;
-
- FishingOperation savedFishingOperation;
- if (create) {
- savedFishingOperation = persistenceService.createFishingOperation(toSave);
- } else {
- savedFishingOperation = persistenceService.saveFishingOperation(toSave);
- }
-
- FishingOperationsUIModel model = getModel();
-
- // add the saved fishingOperation to fishingOperation list
-
- List<FishingOperation> data = model.getFishingOperation();
-
- FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
- if (existingFishingOperation != null) {
- data.remove(existingFishingOperation);
- }
- data.add(savedFishingOperation);
-
- // update model fishingOperation list
- model.setFishingOperation(data);
-
- // update model selected fishingOperation
- model.setSelectedFishingOperation(savedFishingOperation);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,83 +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.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model fo UI {@link FishingOperationsUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationsUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
-
- public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
-
- protected List<FishingOperation> fishingOperation;
-
- protected FishingOperation selectedFishingOperation;
-
- protected ScientificCruise scientificCruise;
-
- public List<FishingOperation> getFishingOperation() {
- return fishingOperation;
- }
-
- public void setFishingOperation(List<FishingOperation> fishingOperation) {
- this.fishingOperation = fishingOperation;
- firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
- }
-
- public FishingOperation getSelectedFishingOperation() {
- return selectedFishingOperation;
- }
-
- public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) {
- Object oldValue = getSelectedFishingOperation();
- this.selectedFishingOperation = selectedFishingOperation;
- firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- Object oldValue = getScientificCruise();
- this.scientificCruise = scientificCruise;
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
- }
-}
Modified: 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/AccidentelTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: 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/AccidentelTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: 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/BenthosTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: 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/BenthosTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: 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/MacroDechetTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: 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/MacroDechetTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: 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/PlanctonTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: 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/PlanctonTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,223 @@
+/*
+ * #%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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#nameLabel {
+ text: "tutti.label.cruise.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#yearLabel {
+ text: "tutti.label.cruise.year";
+ labelFor: {yearField};
+}
+
+#yearField {
+ property: "year";
+ model: {model.getYear()};
+ useFloat: false;
+ numberPattern: {INT_4_DIGITS_PATTERN};
+}
+
+#surveyPartLabel {
+ text: "tutti.label.cruise.surveyPart";
+ labelFor: {surveyPartField};
+}
+
+#surveyPartField {
+ text: {model.getSurveyPart()};
+}
+
+#countryLabel {
+ text: "tutti.label.cruise.country";
+ labelFor: {countryComboBox};
+}
+
+#countryComboBox {
+ property: "country";
+ selectedItem: {model.getCountry()};
+}
+
+#programLabel {
+ text: "tutti.label.cruise.program";
+ labelFor: {surveyComboBox};
+}
+
+#surveyComboBox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#beginDateLabel {
+ text: "tutti.label.cruise.beginDate";
+ labelFor: {beginDateField};
+}
+
+#beginDateField {
+ date: {model.getBeginDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#endDateLabel {
+ text: "tutti.label.cruise.endDate";
+ labelFor: {endDateField};
+}
+
+#endDateField {
+ date: {model.getEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#pocheLabel {
+ text: "tutti.label.cruise.poche";
+ labelFor: {pocheField};
+}
+
+#pocheField {
+ property: "poche";
+ model: {model.getPoche()};
+ useFloat: false;
+ numberPattern: {INT_1_DIGITS_PATTERN};
+}
+
+#vesselPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#vesselHeader {
+ labelText: {_("tutti.label.list.vessel")};
+ list: {vesselList};
+ beanType: {Vessel.class};
+}
+
+#gearPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#gearHeader {
+ labelText: {_("tutti.label.list.gear")};
+ list: {gearList};
+ beanType: {Gear.class};
+}
+
+#headOfMissionPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfMissionHeader {
+ labelText: {_("tutti.label.list.headOfMission")};
+ list: {headOfMissionList};
+ beanType: {Person.class};
+}
+
+#headOfSortRoomPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfSortRoomHeader {
+ labelText: {_("tutti.label.list.headOfSortRoom")};
+ list: {headOfSortRoomList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+}
+
+#generateNameButton {
+ actionIcon: "generate";
+ text: "tutti.action.generateCampaignName";
+ enabled: {model.isCanGenerateName()};
+}
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.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/cruise/EditCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,238 @@
+<!--
+ #%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<EditCruiseUIModel, EditCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.referential.Country
+ fr.ifremer.tutti.persistence.entities.referential.Gear
+ fr.ifremer.tutti.persistence.entities.referential.Person
+ fr.ifremer.tutti.persistence.entities.referential.Vessel
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+ public EditCruiseUI(TuttiUIContext context) {
+ EditCruiseUIHandler handler = new EditCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditCruiseUIHandler id='handler'
+ initializer='getContextValue(EditCruiseUIHandler.class)'/>
+
+ <EditCruiseUIModel id='model'
+ initializer='getContextValue(EditCruiseUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='program' component='surveyComboBox'/>
+ <field name='year' component='yearField'/>
+ <field name='surveyPart' component='surveyPartField'/>
+ <field name='name' component='nameField'/>
+ <field name='poche' component='pocheField'/>
+ <field name='country' component='countryComboBox'/>
+ <field name='beginDate' component='beginDateField'/>
+ <field name='endDate' component='endDateField'/>
+ <field name='vessel' component='vesselPane'/>
+ <field name='gear' component='gearPane'/>
+ <field name='headOfMission' component='headOfMissionPane'/>
+ <field name='headOfSortRoom' component='headOfSortRoomPane'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+ <Table fill='both'>
+
+ <!-- cruise program / year /program part / name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='surveyComboBox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='yearLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='yearField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='surveyPartLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='surveyPartField'
+ onKeyReleased='handler.setText(event, "surveyPart")'/>
+ </cell>
+ </row>
+
+ <!-- cruise name -->
+ <row>
+ <cell>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ <cell columns='2'>
+ <JButton id='generateNameButton'
+ onActionPerformed='handler.generateCampaignName()'/>
+ </cell>
+ <cell>
+ <JLabel id='pocheLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='pocheField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- cruise country / begin date / end date -->
+ <row>
+ <cell>
+ <JLabel id='countryLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='countryComboBox' constructorParams='this'
+ genericType='Country'/>
+ </cell>
+ <cell>
+ <JLabel id='beginDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='beginDateField'
+ onActionPerformed='handler.setDate(event, "beginDate")'/>
+ </cell>
+ <cell>
+ <JLabel id='endDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='endDateField'
+ onActionPerformed='handler.setDate(event, "endDate")'/>
+ </cell>
+ </row>
+
+ <!-- cruise vessel / gear -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
+ onFocusGained='vesselList.requestFocus()'>
+ <JList id='vesselList'
+ onValueChanged='handler.selectListData(event, "vessel")'/>
+ <BeanListHeader id='vesselHeader' genericType='Vessel'/>
+ </JScrollPane>
+ <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
+ onFocusGained='gearList.requestFocus()'>
+ <JList id='gearList'
+ onValueChanged='handler.selectListData(event, "gear")'/>
+ <BeanListHeader id='gearHeader' genericType='Gear'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- cruise headOfMission / headOfSortRoom -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+
+ <JScrollPane id='headOfMissionPane'
+ columnHeaderView="{headOfMissionHeader}"
+ onFocusGained='headOfMissionList.requestFocus()'>
+ <JList id='headOfMissionList'
+ onValueChanged='handler.selectListData(event, "headOfMission")'/>
+ <BeanListHeader id='headOfMissionHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ <JScrollPane id='headOfSortRoomPane'
+ columnHeaderView="{headOfSortRoomHeader}"
+ onFocusGained='headOfSortRoomList.requestFocus()'>
+ <JList id='headOfSortRoomList'
+ onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
+ <BeanListHeader id='headOfSortRoomHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- cruise comment -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Form Actions -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.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/cruise/EditCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,176 @@
+package fr.ifremer.tutti.ui.swing.content.cruise;
+
+/*
+ * #%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.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+/**
+ * Handler of UI {@link EditCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditCruiseUIHandler extends AbstractTuttiUIHandler<EditCruiseUIModel> {
+
+ private final EditCruiseUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditCruiseUIHandler(TuttiUIContext context, EditCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditCruiseUIModel model = new EditCruiseUIModel();
+
+ String campaignId = context.getCruiseId();
+ if (campaignId == null) {
+
+ // create new cruise
+ Program program =
+ persistenceService.getProgram(context.getProgramId());
+ model.setProgram(program);
+ model.setPoche(1);
+ } else {
+
+ // load existing program
+ Cruise cruise =
+ persistenceService.getCruise(campaignId);
+
+ model.fromBean(cruise);
+ }
+ listModelIsModify(model);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ List<Person> users = persistenceService.getAllPerson();
+
+ EditCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getSurveyComboBox(),
+ persistenceService.getAllProgram(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getCountryComboBox(),
+ persistenceService.getAllCountry(),
+ model.getCountry());
+
+ initBeanList(ui.getVesselHeader(),
+ persistenceService.getAllVessel(),
+ model.getVessel());
+
+ initBeanList(ui.getGearHeader(),
+ persistenceService.getAllGear(),
+ model.getGear());
+
+ initBeanList(ui.getHeadOfMissionHeader(),
+ users,
+ model.getHeadOfMission());
+
+ initBeanList(ui.getHeadOfSortRoomHeader(),
+ users,
+ model.getHeadOfSortRoom());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditCruiseUIModel model = ui.getModel();
+
+ Cruise bean = model.toBean();
+
+ Cruise saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createCruise(bean);
+ } else {
+ saved = persistenceService.saveCruise(bean);
+ }
+
+ context.setProgramId(saved.getProgram().getId());
+ context.setCruiseId(saved.getId());
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public static final String cruiseNameFormat = "%1$s_%2$s";
+
+ public void generateCampaignName() {
+
+ EditCruiseUIModel model = getModel();
+ Program program = model.getProgram();
+ Integer year = model.getYear();
+ String name = String.format(cruiseNameFormat, program.getName(), year);
+
+ String surveyPart = model.getSurveyPart();
+ if (StringUtils.isNotEmpty(surveyPart)) {
+ name += "_" + surveyPart;
+ }
+ model.setName(name);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.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/cruise/EditCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,247 @@
+package fr.ifremer.tutti.ui.swing.content.cruise;
+
+/*
+ * #%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.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model of UI {@link EditCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditCruiseUIModel extends AbstractTuttiBeanUIModel<Cruise, EditCruiseUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_NAME = "name";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_COUNTRY = "country";
+
+ public static final String PROPERTY_SURVEY_PART = "surveyPart";
+
+ public static final String PROPERTY_VESSEL = "vessel";
+
+ public static final String PROPERTY_GEAR = "gear";
+
+ public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
+
+ public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
+
+ public static final String PROPERTY_YEAR = "year";
+
+ public static final String PROPERTY_POCHE = "poche";
+
+ public static final String PROPERTY_BEGIN_DATE = "beginDate";
+
+ public static final String PROPERTY_END_DATE = "endDate";
+
+ public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
+
+ protected Program program;
+
+ protected Country country;
+
+ protected String name;
+
+ protected String surveyPart;
+
+ protected List<Vessel> vessel;
+
+ protected List<Gear> gear;
+
+ protected List<Person> headOfMission;
+
+ protected List<Person> headOfSortRoom;
+
+ protected String comment;
+
+ protected Integer year;
+
+ protected Integer poche;
+
+ protected Date beginDate;
+
+ protected Date endDate;
+
+ protected static Binder<EditCruiseUIModel, Cruise> toBeanBinder =
+ BinderFactory.newBinder(EditCruiseUIModel.class,
+ Cruise.class);
+
+ protected static Binder<Cruise, EditCruiseUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class);
+
+ public EditCruiseUIModel() {
+ super(Cruise.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Object oldValue = getProgram();
+ this.program = program;
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ Object oldValue = getCountry();
+ this.country = country;
+ firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
+ }
+
+ public String getSurveyPart() {
+ return surveyPart;
+ }
+
+ public void setSurveyPart(String surveyPart) {
+ Object oldValue = getSurveyPart();
+ this.surveyPart = surveyPart;
+ firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
+ }
+
+ public Integer getYear() {
+ return year;
+ }
+
+ public void setYear(Integer year) {
+ Object oldValue = getYear();
+ this.year = year;
+ firePropertyChange(PROPERTY_YEAR, oldValue, year);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public Integer getPoche() {
+ return poche;
+ }
+
+ public void setPoche(Integer poche) {
+ Object oldValue = getPoche();
+ this.poche = poche;
+ firePropertyChange(PROPERTY_POCHE, oldValue, poche);
+ }
+
+ public Date getBeginDate() {
+ return beginDate;
+ }
+
+ public void setBeginDate(Date beginDate) {
+ Object oldValue = getBeginDate();
+ this.beginDate = beginDate;
+ firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ Object oldValue = getEndDate();
+ this.endDate = endDate;
+ firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
+ }
+
+ public List<Vessel> getVessel() {
+ return vessel;
+ }
+
+ public void setVessel(List<Vessel> vessel) {
+ this.vessel = vessel;
+ firePropertyChange(PROPERTY_VESSEL, null, vessel);
+ }
+
+ public List<Gear> getGear() {
+ return gear;
+ }
+
+ public void setGear(List<Gear> gear) {
+ this.gear = gear;
+ firePropertyChange(PROPERTY_GEAR, null, gear);
+ }
+
+ public List<Person> getHeadOfMission() {
+ return headOfMission;
+ }
+
+ public void setHeadOfMission(List<Person> headOfMission) {
+ this.headOfMission = headOfMission;
+ firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
+ }
+
+ public List<Person> getHeadOfSortRoom() {
+ return headOfSortRoom;
+ }
+
+ public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
+ this.headOfSortRoom = headOfSortRoom;
+ firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
+ }
+
+ public boolean isCanGenerateName() {
+ return program != null && year != null;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.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/home/SelectCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,77 @@
+/*
+ * #%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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#programLabel {
+ text: "tutti.label.program";
+}
+
+#programCombobox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#editProgramButton {
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newProgramButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#cruiseLabel {
+ text: "tutti.label.cruise";
+ labelFor: {cruiseCombobox};
+}
+
+#cruiseCombobox {
+ property: "cruise";
+ enabled: {model.isProgramFound()};
+ selectedItem: {model.getCruise()};
+}
+
+#editCruiseButton {
+ enabled: {model.isProgramFound() && model.isCruiseFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newCruiseButton {
+ actionIcon: "add";
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.new";
+}
+
+#showFishingOperationsButton {
+ text: "tutti.action.catches";
+ enabled: {uiContext.isCruiseContextFilled()};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.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/home/SelectCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,102 @@
+<!--
+ #%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<SelectCruiseUIModel, SelectCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.data.Cruise
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+ protected TuttiUIContext uiContext;
+
+ public SelectCruiseUI(TuttiUIContext context) {
+ this.uiContext = context;
+ SelectCruiseUIHandler handler =
+ new SelectCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SelectCruiseUIHandler id='handler'
+ initializer='getContextValue(SelectCruiseUIHandler.class)'/>
+
+ <SelectCruiseUIModel id='model'
+ initializer='getContextValue(SelectCruiseUIModel.class)'/>
+
+ <Table fill='both' constraints='BorderLayout.CENTER'>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='programCombobox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editProgramButton'
+ onActionPerformed='handler.showSelectedProgram()'/>
+ <JButton id='newProgramButton'
+ onActionPerformed='handler.showNewProgram()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='cruiseLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='cruiseCombobox' constructorParams='this'
+ genericType='Cruise'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editCruiseButton'
+ onActionPerformed='handler.showSelectedCruise()'/>
+ <JButton id='newCruiseButton'
+ onActionPerformed='handler.showNewCruise()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3'>
+ <JButton id='showFishingOperationsButton'
+ onActionPerformed='handler.showFishingOperations()'/>
+ </cell>
+ </row>
+ </Table>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.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/home/SelectCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,204 @@
+package fr.ifremer.tutti.ui.swing.content.home;
+
+/*
+ * #%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.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.swing.editor.bean.BeanComboBox;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Main ui content to select cruise.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectCruiseUIHandler extends AbstractTuttiUIHandler<SelectCruiseUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectCruiseUIHandler.class);
+
+ protected final PersistenceService persistenceService;
+
+ protected final SelectCruiseUI ui;
+
+ public SelectCruiseUIHandler(TuttiUIContext context, SelectCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ protected SelectCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ public void beforeInitUI() {
+ SelectCruiseUIModel model = new SelectCruiseUIModel();
+
+ List<Program> allPrograms = persistenceService.getAllProgram();
+
+ model.setPrograms(allPrograms);
+
+ if (allPrograms.isEmpty()) {
+ // do nothing
+
+ if (log.isDebugEnabled()) {
+ log.debug("No program found.");
+ }
+ } else {
+
+ // get selected program (if any)
+
+ String programId = context.getProgramId();
+ Program selectedProgram = null;
+ List<Cruise> allCruises = null;
+ if (programId != null) {
+ selectedProgram = TuttiEntities.findById(allPrograms, programId);
+ allCruises = persistenceService.getAllCruise(programId);
+ }
+
+ model.setProgram(selectedProgram);
+ model.setCruises(allCruises);
+
+ if (CollectionUtils.isEmpty(allCruises)) {
+
+ // nothing to select
+ } else {
+ String cruiseId = context.getCruiseId();
+
+ Cruise selectedCampaign = null;
+ if (cruiseId != null) {
+ selectedCampaign =
+ TuttiEntities.findById(allCruises, cruiseId);
+ }
+ model.setCruise(selectedCampaign);
+ }
+ }
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ SelectCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getProgramCombobox(),
+ model.getPrograms(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getCruiseCombobox(),
+ model.getCruises(),
+ model.getCruise());
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Program newValue = (Program) evt.getNewValue();
+ boolean noProgram = newValue == null;
+ context.setProgramId(noProgram ? null : newValue.getId());
+ List<Cruise> campaigns;
+ if (noProgram) {
+ campaigns = Lists.newArrayList();
+ } else {
+ campaigns = persistenceService.getAllCruise(newValue.getId());
+ }
+ SelectCruiseUIModel model = (SelectCruiseUIModel) evt.getSource();
+ model.setCruises(campaigns);
+ model.setCruise(null);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ // reload combo box
+ BeanComboBox<Cruise> combobox = ui.getCruiseCombobox();
+ List<Cruise> campaigns = (List<Cruise>) evt.getNewValue();
+ combobox.setData(null);
+ combobox.setData(campaigns);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISE, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Cruise newValue = (Cruise) evt.getNewValue();
+ context.setCruiseId(newValue == null ? null : newValue.getId());
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
+ for (PropertyChangeListener listener : listeners) {
+ getModel().removePropertyChangeListener(listener);
+ }
+ }
+
+ public void showFishingOperations() {
+
+ context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
+ }
+
+ public void showSelectedProgram() {
+
+ Program program = getModel().getProgram();
+ context.setProgramId(program.getId());
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showNewProgram() {
+ context.setProgramId(null);
+ context.setCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showSelectedCruise() {
+ Cruise cruise = getModel().getCruise();
+ context.setCruiseId(cruise.getId());
+ context.setScreen(TuttiScreen.EDIT_CRUISE);
+ }
+
+ public void showNewCruise() {
+ context.setCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.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/home/SelectCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,123 @@
+package fr.ifremer.tutti.ui.swing.content.home;
+
+/*
+ * #%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.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model of ui {@link SelectCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectCruiseUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAMS = "programs";
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_CRUISES = "cruises";
+
+ public static final String PROPERTY_CRUISE = "cruise";
+
+ public static final String PROPERTY_PROGRAM_FOUND = "programFound";
+
+ public static final String PROPERTY_CRUISE_FOUND = "cruiseFound";
+
+ protected List<Program> programs;
+
+ protected Program program;
+
+ protected List<Cruise> cruises;
+
+ protected Cruise cruise;
+
+ public List<Program> getPrograms() {
+ return programs;
+ }
+
+ public void setPrograms(List<Program> programs) {
+ Object oldValue = getPrograms();
+ this.programs = programs;
+
+ // nullify program
+// setProgram(null);
+ firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Program oldValue = getProgram();
+ this.program = program;
+
+ // nullify cruises
+// setCruises(null);
+
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
+ }
+
+ public boolean isProgramFound() {
+ return program != null;
+ }
+
+ public List<Cruise> getCruises() {
+ return cruises;
+ }
+
+ public void setCruises(List<Cruise> cruises) {
+ Object oldValue = getCruises();
+ this.cruises = cruises;
+
+ // nullify cruise
+// setCruise(null);
+ firePropertyChange(PROPERTY_CRUISES, oldValue, cruises);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ Cruise oldValue = getCruise();
+ this.cruise = cruise;
+ firePropertyChange(PROPERTY_CRUISE, oldValue, cruise);
+ firePropertyChange(PROPERTY_CRUISE_FOUND, oldValue != null, cruise != null);
+ }
+
+ public boolean isCruiseFound() {
+ return cruise != null;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.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/operation/FishingOperationTabUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,538 @@
+/*
+ * #%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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+SimpleTimeEditor {
+ bean: {model};
+}
+
+#stationNumberLabel {
+ text: "tutti.label.fishingOperation.stationNumber";
+ labelFor: {stationNumberField};
+}
+
+#stationNumberField {
+ property: "stationNumber";
+ model: {model.getStationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#fishingOperationNumberLabel {
+ text: "tutti.label.fishingOperation.fishingOperationNumber";
+ labelFor: {fishingOperationNumberField};
+}
+
+#fishingOperationNumberField {
+ property: "fishingOperationNumber";
+ model: {model.getFishingOperationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#dateLabel {
+ text: "tutti.label.fishingOperation.date";
+ labelFor: {dateField};
+}
+
+#dateField {
+ date: {model.getDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#strataLabel {
+ text: "tutti.label.fishingOperation.strata";
+ labelFor: {strataComboBox};
+}
+
+#strataComboBox {
+ property: "strata";
+ selectedItem: {model.getStrata()};
+}
+
+#subStrataLabel {
+ text: "tutti.label.fishingOperation.subStrata";
+ labelFor: {subStrataComboBox};
+}
+
+#subStrataComboBox {
+ property: "subStrata";
+ selectedItem: {model.getSubStrata()};
+}
+
+#localiteLabel {
+ text: "tutti.label.fishingOperation.localite";
+ labelFor: {localiteField};
+}
+
+#localiteField {
+ text: {model.getLocalite()};
+}
+
+#gearLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearLongitude";
+}
+
+#gearLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearLatitude";
+}
+
+#gearDateLabel {
+ text: "tutti.label.fishingOperation.gearDate";
+}
+
+#gearTimeLabel {
+ text: "tutti.label.fishingOperation.gearTime";
+}
+
+#gearShootingStartLabel {
+ text: "tutti.label.fishingOperation.gearShootingStart";
+}
+
+#gearShootingEndLabel {
+ text: "tutti.label.fishingOperation.gearShootingEnd";
+}
+
+#gearShootingStartLongitudeField {
+ text: {getStringValue(model.getGearShootingStartLongitude())};
+}
+
+#gearShootingStartLatitudeField {
+ text: {getStringValue(model.getGearShootingStartLatitude())};
+}
+
+#gearShootingStartDateField {
+ date: {model.getGearShootingStartDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingStartTimeField {
+ property: "gearShootingStartDate";
+ date: {model.getGearShootingStartDate()};
+}
+
+#gearShootingEndLongitudeField {
+ text: {getStringValue(model.getGearShootingEndLongitude())};
+}
+
+#gearShootingEndLatitudeField {
+ text: {getStringValue(model.getGearShootingEndLatitude())};
+}
+
+#gearShootingEndDateField {
+ date: {model.getGearShootingEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingEndTimeField {
+ property: "gearShootingEndDate";
+ date: {model.getGearShootingEndDate()};
+}
+
+#fishingOperationValidPanel {
+ floatable: false;
+ borderPainted: false;
+ opaque: false;
+}
+
+#resetValidStateButton {
+ actionIcon: "reset";
+ text: "tutti.action.reset.fishingOperationValidState";
+}
+
+#fishingOperationValidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationValid";
+ selected: {model.getFishingOperationValid() == Boolean.TRUE};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationInvalidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationInvalid";
+ selected: {model.getFishingOperationValid() == Boolean.FALSE};
+ buttonGroup: "fishingOperationValid";
+}
+#fishingOperationResetRadio {
+ selected: {model.getFishingOperationValid() == null};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationRectiligneCheckBox {
+ text: "tutti.label.fishingOperation.fishingOperationRectiligne";
+ selected: {model.isFishingOperationRectiligne()};
+}
+
+#distanceChaluteeLabel {
+ text: "tutti.label.fishingOperation.distanceChalutee";
+ labelFor: {distanceChaluteeField};
+}
+
+#distanceChaluteeField {
+ property: "distanceChalutee";
+ model: {model.getDistanceChalutee()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+ enabled: {!model.isFishingOperationRectiligne()};
+}
+
+#beaufortScaleLabel {
+ text: "tutti.label.fishingOperation.beaufortScale";
+ labelFor: {beaufortScaleComboBox};
+}
+
+#beaufortScaleComboBox {
+ property: "beaufortScale";
+ selectedItem: {model.getBeaufortScale()};
+}
+
+#windDirectionLabel {
+ text: "tutti.label.fishingOperation.windDirection";
+ labelFor: {windDirectionField};
+}
+
+#windDirectionField {
+ property: "windDirection";
+ model: {model.getWindDirection()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#seaStateLabel {
+ text: "tutti.label.fishingOperation.seaState";
+ labelFor: {seaStateComboBox};
+}
+
+#seaStateComboBox {
+ property: "seaState";
+ selectedItem: {model.getSeaState()};
+}
+
+#ouvertureHorizontaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontale";
+ labelFor: {ouvertureHorizontaleField};
+}
+
+#ouvertureHorizontaleVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
+}
+
+#ouvertureHorizontaleField {
+ property: "ouvertureHorizontale";
+ model: {model.getOuvertureHorizontale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#ouvertureVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureVerticale";
+ labelFor: {ouvertureVerticaleField};
+}
+
+#ouvertureVerticaleField {
+ property: "ouvertureVerticale";
+ model: {model.getOuvertureVerticale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#geometrieMesureeCheckBox {
+ text: "tutti.label.fishingOperation.geometrieMesuree";
+ selected: {model.isGeometrieMesuree()};
+}
+
+#longueurFunesLabel {
+ text: "tutti.label.fishingOperation.longueurFunes";
+ labelFor: {longueurFunesField};
+}
+
+#longueurFunesBrasLabel {
+ text: "tutti.label.fishingOperation.longueurFunesBras";
+}
+
+#longueurFunesField {
+ property: "longueurFunes";
+ model: {model.getLongueurFunes()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#longueurBrasLabel {
+ text: "tutti.label.fishingOperation.longueurBras";
+ labelFor: {longueurBrasField};
+}
+
+#longueurBrasField {
+ property: "longueurBras";
+ model: {model.getLongueurBras()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#systemeFermetureCulCheckBox {
+ text: "tutti.label.fishingOperation.systemeFermetureCul";
+ selected: {model.isSystemeFermetureCul()};
+}
+
+#dureeLabel {
+ text: "tutti.label.fishingOperation.duree";
+ labelFor: {dureeField};
+}
+
+#dureeField {
+ property: "duree";
+ model: {model.getDuree()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#saisisseurPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#saisisseurHeader {
+ labelText: {_("tutti.label.list.saisisseur")};
+ list: {saisisseurList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#gearShootingStartDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartDepth";
+ labelFor: {gearShootingStartDepthField};
+}
+
+#gearShootingStartDepthField {
+ property: "gearShootingStartDepth";
+ model: {model.getGearShootingStartDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndDepth";
+ labelFor: {gearShootingEndDepthField};
+}
+
+#gearShootingEndDepthField {
+ property: "gearShootingEndDepth";
+ model: {model.getGearShootingEndDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
+ labelFor: {gearShootingStartSurfaceTemperatureField};
+}
+
+#gearShootingStartSurfaceTemperatureField {
+ property: "gearShootingStartSurfaceTemperature";
+ model: {model.getGearShootingStartSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
+ labelFor: {gearShootingEndSurfaceTemperatureField};
+}
+
+#gearShootingEndSurfaceTemperatureField {
+ property: "gearShootingEndSurfaceTemperature";
+ model: {model.getGearShootingEndSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
+ labelFor: {gearShootingStartBottomTemperatureField};
+}
+
+#gearShootingStartBottomTemperatureField {
+ property: "gearShootingStartBottomTemperature";
+ model: {model.getGearShootingStartBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
+ labelFor: {gearShootingEndBottomTemperatureField};
+}
+
+#gearShootingEndBottomTemperatureField {
+ property: "gearShootingEndBottomTemperature";
+ model: {model.getGearShootingEndBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.averageBottomTemperature";
+ labelFor: {averageBottomTemperatureField};
+}
+
+#averageBottomTemperatureField {
+ property: "averageBottomTemperature";
+ model: {model.getAverageBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
+ labelFor: {gearShootingStartSurfaceSalinityField};
+}
+
+#gearShootingStartSurfaceSalinityField {
+ property: "gearShootingStartSurfaceSalinity";
+ model: {model.getGearShootingStartSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
+ labelFor: {gearShootingEndSurfaceSalinityField};
+}
+
+#gearShootingEndSurfaceSalinityField {
+ property: "gearShootingEndSurfaceSalinity";
+ model: {model.getGearShootingEndSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
+ labelFor: {gearShootingStartBottomSalinityField};
+}
+
+#gearShootingStartBottomSalinityField {
+ property: "gearShootingStartBottomSalinity";
+ model: {model.getGearShootingStartBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
+ labelFor: {gearShootingEndBottomSalinityField};
+}
+
+#gearShootingEndBottomSalinityField {
+ property: "gearShootingEndBottomSalinity";
+ model: {model.getGearShootingEndBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.averageBottomSalinity";
+ labelFor: {averageBottomSalinityField};
+}
+
+#averageBottomSalinityField {
+ property: "averageBottomSalinity";
+ model: {model.getAverageBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#noTraitPane {
+ text: "tutti.label.no.fishingOperation.selected";
+ horizontalAlignment: {JLabel.CENTER};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+ enabled: {model.isModify()};
+}
+
+#importPupitriButton {
+ actionIcon: "pupitri-import";
+ text: "tutti.action.pupitri-import";
+}
+
+#importCasinoButton {
+ actionIcon: "casino-import";
+ text: "tutti.action.casino-import";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.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/operation/FishingOperationTabUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,550 @@
+<!--
+ #%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<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+ fr.ifremer.tutti.persistence.entities.referential.SeaState
+ fr.ifremer.tutti.persistence.entities.referential.Strata
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+ fr.ifremer.tutti.persistence.entities.referential.Person
+
+ fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.TimeEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ java.awt.Dimension
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public FishingOperationTabUI(FishingOperationsUI parentUI) {
+ FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <FishingOperationTabUIHandler id='handler'
+ initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
+
+ <FishingOperationTabUIModel id='model'
+ initializer='getContextValue(FishingOperationTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='stationNumber' component='stationNumberField'/>
+ <field name='fishingOperationNumber'
+ component='fishingOperationNumberField'/>
+ <field name='date' component='dateField'/>
+ <field name='comment' component='commentField'/>
+ <field name='saisisseur' component='saisisseurPane'/>
+ </BeanValidator>
+
+ <JPanel id='traitPane' constraints='BorderLayout.CENTER'
+ layout='{new BorderLayout()}'>
+
+ <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitGeneralTab'
+ title='tutti.label.tab.fishingOperation.general'>
+ <Table fill='both' id='generalForm'>
+
+ <!-- Numero station / Numéro trait / Date -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='stationNumberField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='fishingOperationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='fishingOperationNumberField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='dateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='dateField'
+ onActionPerformed='handler.setDate(event, "date")'/>
+ </cell>
+ </row>
+
+ <!-- Strate d'association / Sous Strate / Localité -->
+ <row>
+ <cell>
+ <JLabel id='strataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='strataComboBox' constructorParams='this'
+ genericType='Strata'/>
+ </cell>
+ <cell>
+ <JLabel id='subStrataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='subStrataComboBox' constructorParams='this'
+ genericType='Strata'/>
+ </cell>
+ <cell>
+ <JLabel id='localiteLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='localiteField'
+ onKeyReleased='handler.setText(event, "localite")'/>
+ </cell>
+ </row>
+
+ <!-- début de traine long-lat-date-heure
+ fin de traine long-lat-date-heure -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout="{new BorderLayout()}">
+ <Table id="gearCaracteristicsTable" fill="both" weightx='1'
+ constraints='BorderLayout.CENTER'>
+ <row>
+ <cell>
+ <JLabel/>
+ </cell>
+ <cell>
+ <JLabel id='gearLongitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearLatitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearDateLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearTimeLabel'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLongitudeField'
+ onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLatitudeLabel'
+ onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingStartDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingStartTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLongitudeField'
+ onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLatitudeLabel'
+ onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingEndDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingEndTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Fishing operation valid / invalid-->
+ <row>
+ <cell columns="2">
+ <JToolBar id='fishingOperationValidPanel'
+ layout='{new BorderLayout()}'>
+ <JButton id='resetValidStateButton'
+ constraints='BorderLayout.WEST'
+ onActionPerformed="model.setFishingOperationValid(null)"/>
+ <JRadioButton id='fishingOperationResetRadio'
+ constraints='BorderLayout.EAST'/>
+ </JToolBar>
+ </cell>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationValidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
+ </cell>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationInvalidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
+ </cell>
+ </row>
+
+ <!-- FishingOperation rectiligne / distance chalutee / durée -->
+ <row>
+ <cell>
+ <JCheckBox id='fishingOperationRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
+ </cell>
+ <cell columns="3">
+ <JPanel layout="{new BorderLayout()}">
+ <JLabel id='distanceChaluteeLabel'
+ constraints='BorderLayout.WEST'/>
+ <NumberEditor id='distanceChaluteeField'
+ constraints='BorderLayout.CENTER'
+ constructorParams='this'/>
+ </JPanel>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='dureeLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='dureeField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Actions d'import -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ <JButton id='importCasinoButton'
+ onActionPerformed='handler.importCasino()'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Saisisseur -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='saisisseurPane'
+ columnHeaderView="{saisisseurHeader}"
+ onFocusGained='saisisseurList.requestFocus()'>
+ <JList id='saisisseurList'
+ onValueChanged='handler.selectListData(event, "saisisseur")'/>
+ <BeanListHeader id='saisisseurHeader' genericType='Person'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Commentaire -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitGearShootingTab'
+ title='tutti.label.tab.fishingOperation.gearShooting'>
+
+ <Table fill='both' id='gearShootingForm'>
+
+ <!-- GearShootingStart Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture horizontale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureHorizontaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureHorizontaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture verticale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureVerticaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureVerticaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur funes -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurFunesLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurFunesField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur bras -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurBrasLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Système de fermeture du cul / Geometrie mesuree -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='systemeFermetureCulCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='environmentTab'
+ title='tutti.label.tab.fishingOperation.environment'>
+
+ <Table fill='both' id='environmentForm'>
+
+ <!-- Beaufort scale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
+ </cell>
+ </row>
+
+ <!-- Wind direction -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Sea state-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitHydrologyTabContent'
+ title='tutti.label.tab.fishingOperation.hydrology'>
+
+ <Table fill='both' id='hydrologyForm'>
+
+ <!-- GearShootingStartSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ </Table>
+ </tab>
+ </JTabbedPane>
+
+ <!-- Actions -->
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+ <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'/>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.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/operation/FishingOperationTabUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,242 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%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.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Handler for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FishingOperationTabUIHandler.class);
+
+ private final FishingOperationTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationTabUIModel model = new FishingOperationTabUIModel();
+ model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ JPanel form = ui.getTraitPane();
+ JLabel noContentPane = ui.getNoTraitPane();
+
+ Boolean empty = (Boolean) evt.getNewValue();
+ ui.remove(form);
+ ui.remove(noContentPane);
+ if (empty) {
+ ui.add(noContentPane, BorderLayout.CENTER);
+ } else {
+ ui.add(form, BorderLayout.CENTER);
+ }
+ ui.repaint();
+ }
+ });
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ ui.getFishingOperationValidPanel().remove(
+ ui.getFishingOperationResetRadio());
+
+ FishingOperationTabUIModel model = ui.getModel();
+
+ initUI(ui);
+
+ initBeanList(ui.getSaisisseurHeader(),
+ persistenceService.getAllPerson(),
+ model.getSaisisseur());
+
+ initBeanComboBox(ui.getBeaufortScaleComboBox(),
+ persistenceService.getAllBeaufortScale(),
+ model.getBeaufortScale());
+
+ initBeanComboBox(ui.getStrataComboBox(),
+ persistenceService.getAllStrata(),
+ model.getStrata());
+
+ initBeanComboBox(ui.getSeaStateComboBox(),
+ persistenceService.getAllSeaState(),
+ model.getSeaState());
+
+ model.setEmpty(true);
+
+ listenValidatorValid(ui.getValidator(), getModel());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected FishingOperationTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ FishingOperationTabUIModel model = getModel();
+
+ // clean previous selection
+ ui.getSaisisseurHeader().getList().clearSelection();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ if (CollectionUtils.isNotEmpty(saisisseur)) {
+ updateIndices(ui.getSaisisseurList(), saisisseur);
+ }
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // reload bean in validator (? really mandatory?)
+// ui.getValidator().reloadBean();
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
+ }
+
+ public void cancel() {
+
+ String id = getModel().getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition for fishingOperation: " + id);
+ }
+ boolean newBean = StringUtils.isBlank(id);
+
+ if (newBean) {
+
+ // cancel to create a new fishingOperation
+ parentUi.getHandler().selectFishingOperation(null);
+
+ } else {
+
+ // reselect in ui the fishingOperation
+ FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
+ parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
+ }
+ }
+
+ public void save() {
+
+ // get fishingOperation to save
+ FishingOperation toSave = getModel().toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Save edition for fishingOperation: " + toSave.getId());
+ }
+
+ // keep selected tab (to resotre it after save)
+ int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
+
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave);
+
+ // reselect current tab
+ ui.getTraitTabPane().setSelectedIndex(selectedIndex);
+
+ getModel().setModify(false);
+ }
+
+ public void importPupitri() {
+ //TODO
+ }
+
+ public void importCasino() {
+ //TODO
+ }
+
+ public void setGearShootingStartLatitude(String text) {
+ getModel().setGearShootingStartLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingStartLongitude(String text) {
+ getModel().setGearShootingStartLongitude(Float.valueOf(text));
+ }
+
+// public void setGearShootingStartTime(String text) {
+// getModel().setGearShootingStartTime(Integer.valueOf(text));
+// }
+
+ public void setGearShootingEndLatitude(String text) {
+ getModel().setGearShootingEndLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndLongitude(String text) {
+ getModel().setGearShootingEndLongitude(Float.valueOf(text));
+ }
+
+// public void setGearShootingEndTime(String text) {
+// getModel().setGearShootingEndTime(Integer.valueOf(text));
+// }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.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/operation/FishingOperationTabUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,633 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%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.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_EMPTY = "empty";
+
+ public static final String PROPERTY_STATION_NUMBER = "stationNumber";
+
+ public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
+
+ public static final String PROPERTY_DATE = "date";
+
+ public static final String PROPERTY_STRATA = "strata";
+
+ public static final String PROPERTY_SUB_STRATA = "subStrata";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
+
+ public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+
+ public static final String PROPERTY_WIND_DIRECTION = "windDirection";
+
+ public static final String PROPERTY_SEA_STATE = "seaState";
+
+ public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
+
+ public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
+
+ public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
+
+ public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
+
+ public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
+
+ public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
+
+ public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
+
+ public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
+
+ public static final String PROPERTY_DUREE = "duree";
+
+ public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
+
+ public static final String PROPERTY_LOCALITE = "localite";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_SAISISSEUR = "saisisseur";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
+
+ protected boolean empty;
+
+ protected Cruise cruise;
+
+ protected Integer stationNumber;
+
+ protected Integer fishingOperationNumber;
+
+ protected Date date;
+
+ protected Strata strata;
+
+ protected Strata subStrata;
+
+ protected Float gearShootingStartLatitude;
+
+ protected Float gearShootingStartLongitude;
+
+ protected Date gearShootingStartDate;
+
+ protected Integer gearShootingStartTime;
+
+ protected Float gearShootingStartDepth;
+
+ protected Float gearShootingEndLatitude;
+
+ protected Float gearShootingEndLongitude;
+
+ protected Date gearShootingEndDate;
+
+ protected Integer gearShootingEndTime;
+
+ protected Float gearShootingEndDepth;
+
+ protected BeaufortScale beaufortScale;
+
+ protected Integer windDirection;
+
+ protected SeaState seaState;
+
+ protected Float ouvertureHorizontale;
+
+ protected Float ouvertureVerticale;
+
+ protected boolean geometrieMesuree;
+
+ protected Float longueurFunes;
+
+ protected Float longueurBras;
+
+ protected boolean systemeFermetureCul;
+
+ protected boolean fishingOperationRectiligne;
+
+ protected Float distanceChalutee;
+
+ protected Float duree;
+
+ protected Boolean fishingOperationValid;
+
+ protected String localite;
+
+ protected String comment;
+
+ protected List<Person> saisisseur;
+
+ protected Float gearShootingStartSurfaceTemperature;
+
+ protected Float gearShootingEndSurfaceTemperature;
+
+ protected Float gearShootingStartBottomTemperature;
+
+ protected Float gearShootingEndBottomTemperature;
+
+ protected Float averageBottomTemperature;
+
+ protected Float gearShootingStartSurfaceSalinity;
+
+ protected Float gearShootingEndSurfaceSalinity;
+
+ protected Float gearShootingStartBottomSalinity;
+
+ protected Float gearShootingEndBottomSalinity;
+
+ protected Float averageBottomSalinity;
+
+ protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
+ BinderFactory.newBinder(FishingOperationTabUIModel.class,
+ FishingOperation.class);
+
+ protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
+ BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
+
+ public FishingOperationTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public boolean isEmpty() {
+ return empty;
+ }
+
+ public void setEmpty(boolean empty) {
+ Object oldValue = isEmpty();
+ this.empty = empty;
+ firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ this.cruise = cruise;
+ }
+
+ public Integer getStationNumber() {
+ return stationNumber;
+ }
+
+ public void setStationNumber(Integer stationNumber) {
+ Object oldValue = getStationNumber();
+ this.stationNumber = stationNumber;
+ firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
+ }
+
+ public Integer getFishingOperationNumber() {
+ return fishingOperationNumber;
+ }
+
+ public void setFishingOperationNumber(Integer fishingOperationNumber) {
+ Object oldValue = getFishingOperationNumber();
+ this.fishingOperationNumber = fishingOperationNumber;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ Object oldValue = getDate();
+ this.date = date;
+ firePropertyChange(PROPERTY_DATE, oldValue, date);
+ }
+
+ public Strata getStrata() {
+ return strata;
+ }
+
+ public void setStrata(Strata strata) {
+ Object oldValue = getStrata();
+ this.strata = strata;
+ firePropertyChange(PROPERTY_STRATA, oldValue, strata);
+ }
+
+ public Strata getSubStrata() {
+ return subStrata;
+ }
+
+ public void setSubStrata(Strata subStrata) {
+ Object oldValue = getSubStrata();
+ this.subStrata = subStrata;
+ firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
+ }
+
+ public Float getGearShootingStartLatitude() {
+ return gearShootingStartLatitude;
+ }
+
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ Object oldValue = getGearShootingStartLatitude();
+ this.gearShootingStartLatitude = gearShootingStartLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
+ }
+
+ public Float getGearShootingStartLongitude() {
+ return gearShootingStartLongitude;
+ }
+
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ Object oldValue = getGearShootingStartLongitude();
+ this.gearShootingStartLongitude = gearShootingStartLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
+ }
+
+ public Date getGearShootingStartDate() {
+ return gearShootingStartDate;
+ }
+
+ public void setGearShootingStartDate(Date gearShootingStartDate) {
+ Object oldValue = getGearShootingStartDate();
+ this.gearShootingStartDate = gearShootingStartDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
+ }
+
+ public Float getGearShootingStartDepth() {
+ return gearShootingStartDepth;
+ }
+
+ public void setGearShootingStartDepth(Float gearShootingStartDepth) {
+ Object oldValue = getGearShootingStartDepth();
+ this.gearShootingStartDepth = gearShootingStartDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
+ }
+
+ public Float getGearShootingEndLatitude() {
+ return gearShootingEndLatitude;
+ }
+
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ Object oldValue = getGearShootingEndLatitude();
+ this.gearShootingEndLatitude = gearShootingEndLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
+ }
+
+ public Float getGearShootingEndLongitude() {
+ return gearShootingEndLongitude;
+ }
+
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ Object oldValue = getGearShootingEndLongitude();
+ this.gearShootingEndLongitude = gearShootingEndLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
+ }
+
+ public Date getGearShootingEndDate() {
+ return gearShootingEndDate;
+ }
+
+ public void setGearShootingEndDate(Date gearShootingEndDate) {
+ Object oldValue = getGearShootingEndDate();
+ this.gearShootingEndDate = gearShootingEndDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
+ }
+
+ public Float getGearShootingEndDepth() {
+ return gearShootingEndDepth;
+ }
+
+ public void setGearShootingEndDepth(Float gearShootingEndDepth) {
+ Object oldValue = getGearShootingEndDepth();
+ this.gearShootingEndDepth = gearShootingEndDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
+ }
+
+ public BeaufortScale getBeaufortScale() {
+ return beaufortScale;
+ }
+
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
+ Object oldValue = getBeaufortScale();
+ this.beaufortScale = beaufortScale;
+ firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+ }
+
+ public Integer getWindDirection() {
+ return windDirection;
+ }
+
+ public void setWindDirection(Integer windDirection) {
+ Object oldValue = getWindDirection();
+ this.windDirection = windDirection;
+ firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
+ }
+
+ public SeaState getSeaState() {
+ return seaState;
+ }
+
+ public void setSeaState(SeaState seaState) {
+ Object oldValue = getSeaState();
+ this.seaState = seaState;
+ firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
+ }
+
+ public Float getOuvertureHorizontale() {
+ return ouvertureHorizontale;
+ }
+
+ public void setOuvertureHorizontale(Float ouvertureHorizontale) {
+ Object oldValue = getOuvertureHorizontale();
+ this.ouvertureHorizontale = ouvertureHorizontale;
+ firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
+ }
+
+ public Float getOuvertureVerticale() {
+ return ouvertureVerticale;
+ }
+
+ public void setOuvertureVerticale(Float ouvertureVerticale) {
+ Object oldValue = getOuvertureVerticale();
+ this.ouvertureVerticale = ouvertureVerticale;
+ firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
+ }
+
+ public boolean isGeometrieMesuree() {
+ return geometrieMesuree;
+ }
+
+ public void setGeometrieMesuree(boolean geometrieMesuree) {
+ Object oldValue = isGeometrieMesuree();
+ this.geometrieMesuree = geometrieMesuree;
+ firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
+ }
+
+ public Float getLongueurFunes() {
+ return longueurFunes;
+ }
+
+ public void setLongueurFunes(Float longueurFunes) {
+ Object oldValue = getLongueurFunes();
+ this.longueurFunes = longueurFunes;
+ firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
+ }
+
+ public Float getLongueurBras() {
+ return longueurBras;
+ }
+
+ public void setLongueurBras(Float longueurBras) {
+ Object oldValue = getLongueurBras();
+ this.longueurBras = longueurBras;
+ firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
+ }
+
+ public boolean isSystemeFermetureCul() {
+ return systemeFermetureCul;
+ }
+
+ public void setSystemeFermetureCul(boolean systemeFermetureCul) {
+ Object oldValue = isSystemeFermetureCul();
+ this.systemeFermetureCul = systemeFermetureCul;
+ firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
+ }
+
+ public boolean isFishingOperationRectiligne() {
+ return fishingOperationRectiligne;
+ }
+
+ public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
+ Object oldValue = isFishingOperationRectiligne();
+ this.fishingOperationRectiligne = fishingOperationRectiligne;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
+ }
+
+ public Float getDistanceChalutee() {
+ return distanceChalutee;
+ }
+
+ public void setDistanceChalutee(Float distanceChalutee) {
+ Object oldValue = getDistanceChalutee();
+ this.distanceChalutee = distanceChalutee;
+ firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
+ }
+
+ public Float getDuree() {
+ return duree;
+ }
+
+ public void setDuree(Float duree) {
+ Object oldValue = getDuree();
+ this.duree = duree;
+ firePropertyChange(PROPERTY_DUREE, oldValue, duree);
+ }
+
+ public Boolean getFishingOperationValid() {
+ return fishingOperationValid;
+ }
+
+ public void setFishingOperationValid(Boolean fishingOperationValid) {
+ Object oldValue = getFishingOperationValid();
+ this.fishingOperationValid = fishingOperationValid;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
+ }
+
+ public String getLocalite() {
+ return localite;
+ }
+
+ public void setLocalite(String localite) {
+ Object oldValue = getLocalite();
+ this.localite = localite;
+ firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Person> getSaisisseur() {
+ return saisisseur;
+ }
+
+ public void setSaisisseur(List<Person> saisisseur) {
+ this.saisisseur = saisisseur;
+ firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
+ }
+
+ public Float getGearShootingStartSurfaceTemperature() {
+ return gearShootingStartSurfaceTemperature;
+ }
+
+ public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
+ Object oldValue = getGearShootingStartSurfaceTemperature();
+ this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
+ }
+
+ public Float getGearShootingEndSurfaceTemperature() {
+ return gearShootingEndSurfaceTemperature;
+ }
+
+ public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
+ Object oldValue = getGearShootingEndSurfaceTemperature();
+ this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
+ }
+
+ public Float getGearShootingStartBottomTemperature() {
+ return gearShootingStartBottomTemperature;
+ }
+
+ public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
+ Object oldValue = getGearShootingStartBottomTemperature();
+ this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
+ }
+
+ public Float getGearShootingEndBottomTemperature() {
+ return gearShootingEndBottomTemperature;
+ }
+
+ public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
+ Object oldValue = getGearShootingEndBottomTemperature();
+ this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
+ }
+
+ public Float getAverageBottomTemperature() {
+ return averageBottomTemperature;
+ }
+
+ public void setAverageBottomTemperature(Float averageBottomTemperature) {
+ Object oldValue = getAverageBottomTemperature();
+ this.averageBottomTemperature = averageBottomTemperature;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
+ }
+
+ public Float getGearShootingStartSurfaceSalinity() {
+ return gearShootingStartSurfaceSalinity;
+ }
+
+ public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
+ Object oldValue = getGearShootingStartSurfaceSalinity();
+ this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
+ }
+
+ public Float getGearShootingEndSurfaceSalinity() {
+ return gearShootingEndSurfaceSalinity;
+ }
+
+ public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
+ Object oldValue = getGearShootingEndSurfaceSalinity();
+ this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
+ }
+
+ public Float getGearShootingStartBottomSalinity() {
+ return gearShootingStartBottomSalinity;
+ }
+
+ public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
+ Object oldValue = getGearShootingStartBottomSalinity();
+ this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
+ }
+
+ public Float getGearShootingEndBottomSalinity() {
+ return gearShootingEndBottomSalinity;
+ }
+
+ public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
+ Object oldValue = getGearShootingEndBottomSalinity();
+ this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
+ }
+
+ public Float getAverageBottomSalinity() {
+ return averageBottomSalinity;
+ }
+
+ public void setAverageBottomSalinity(Float averageBottomSalinity) {
+ Object oldValue = getAverageBottomSalinity();
+ this.averageBottomSalinity = averageBottomSalinity;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.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/operation/FishingOperationsUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,64 @@
+/*
+ * #%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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#newFishingOperationButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#traitComboBox {
+ property: "selectedFishingOperation";
+ selectedItem: {model.getSelectedFishingOperation()};
+}
+
+#speciesTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#benthosTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#planctonTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#macroDechetTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#accidentelTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#observationIndividuelTab {
+ enabled: {false};
+ /*enabled: {model.getSelectedFishingOperation() != null};*/
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.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/operation/FishingOperationsUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -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<FishingOperationsUIModel, FishingOperationsUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ 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
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+public FishingOperationsUI(TuttiUIContext context) {
+ FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+ ]]></script>
+
+ <FishingOperationsUIHandler id='handler'
+ initializer='getContextValue(FishingOperationsUIHandler.class)'/>
+
+ <FishingOperationsUIModel id='model'
+ initializer='getContextValue(FishingOperationsUIModel.class)'/>
+
+ <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
+
+ <!-- FishingOperations fishingOperation -->
+ <row>
+ <cell anchor='west' weightx='1.0'>
+ <BeanComboBox id='traitComboBox' constructorParams='this'
+ genericType='FishingOperation'/>
+ </cell>
+ <cell anchor='east'>
+ <JButton id='newFishingOperationButton'
+ onActionPerformed='getHandler().createNewFishingOperation()'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
+ <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
+ </tab>
+ <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'>
+ <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
+ <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
+ </tab>
+ <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}'/>
+ </tab>
+ </JTabbedPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.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/operation/FishingOperationsUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,209 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%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.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Handler of UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
+
+ private final FishingOperationsUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationsUIModel model = new FishingOperationsUIModel();
+
+ String cruiseId = context.getCruiseId();
+
+ // load existing cruise
+ Cruise cruise = persistenceService.getCruise(cruiseId);
+ model.setCruise(cruise);
+
+ List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(cruiseId);
+ model.setFishingOperation(fishingOperations);
+
+ if (log.isInfoEnabled()) {
+ log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
+ }
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ FishingOperationsUIModel model = getModel();
+
+ initUI(ui);
+
+ List<FishingOperation> fishingOperations = model.getFishingOperation();
+
+ initBeanComboBox(ui.getTraitComboBox(),
+ fishingOperations,
+ model.getSelectedFishingOperation());
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ selectFishingOperation((FishingOperation) evt.getNewValue());
+ }
+ });
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ ui.getTraitComboBox().setData(null);
+ ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
+ }
+ });
+
+ if (!fishingOperations.isEmpty()) {
+
+ model.setSelectedFishingOperation(fishingOperations.get(0));
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+
+ // ui will be saved so we do not want to keep selected tab indexes
+ ui.getTabPane().setSelectedIndex(0);
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // when quitting ui, let's de-select fishingOperation (will save any changes)
+ selectFishingOperation(null);
+ }
+
+ @Override
+ protected FishingOperationsUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void createNewFishingOperation() {
+
+ // deselect selected fishingOperation
+ getModel().setSelectedFishingOperation(null);
+
+ // use a new empty fishingOperation
+ FishingOperation newFishingOperation = new FishingOperation();
+ newFishingOperation.setCruise(getModel().getCruise());
+
+ // by default use the current day with no time information
+ Date currentDate = new Date();
+ currentDate = DateUtils.setHours(currentDate, 0);
+ currentDate = DateUtils.setMinutes(currentDate, 0);
+
+ newFishingOperation.setDate(currentDate);
+ newFishingOperation.setGearShootingStartDate(currentDate);
+ newFishingOperation.setGearShootingEndDate(currentDate);
+ selectFishingOperation(newFishingOperation);
+ }
+
+ public void selectFishingOperation(FishingOperation fishingOperation) {
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected fishingOperation: " + fishingOperation);
+ }
+ // back to fishingOperation tab
+ ui.getTabPane().setSelectedIndex(0);
+
+ // back to general tab of fishingOperation tabs
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // propagate fishingOperation to his tabs
+ ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
+ ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
+ ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
+ ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
+ ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
+ ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
+
+ // repaint tabs
+ ui.getTabPane().repaint();
+// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
+ }
+
+ public void saveFishingOperation(FishingOperation toSave) {
+
+ // persist the fishingOperation
+
+ boolean create = toSave.getId() == null;
+
+ FishingOperation savedFishingOperation;
+ if (create) {
+ savedFishingOperation = persistenceService.createFishingOperation(toSave);
+ } else {
+ savedFishingOperation = persistenceService.saveFishingOperation(toSave);
+ }
+
+ FishingOperationsUIModel model = getModel();
+
+ // add the saved fishingOperation to fishingOperation list
+
+ List<FishingOperation> data = model.getFishingOperation();
+
+ FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
+ if (existingFishingOperation != null) {
+ data.remove(existingFishingOperation);
+ }
+ data.add(savedFishingOperation);
+
+ // update model fishingOperation list
+ model.setFishingOperation(data);
+
+ // update model selected fishingOperation
+ model.setSelectedFishingOperation(savedFishingOperation);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.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/operation/FishingOperationsUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,83 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%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.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model fo UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
+
+ public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation";
+
+ public static final String PROPERTY_CRUISE = "cruise";
+
+ protected List<FishingOperation> fishingOperation;
+
+ protected FishingOperation selectedFishingOperation;
+
+ protected Cruise cruise;
+
+ public List<FishingOperation> getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(List<FishingOperation> fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
+ }
+
+ public FishingOperation getSelectedFishingOperation() {
+ return selectedFishingOperation;
+ }
+
+ public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) {
+ Object oldValue = getSelectedFishingOperation();
+ this.selectedFishingOperation = selectedFishingOperation;
+ firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ Object oldValue = getCruise();
+ this.cruise = cruise;
+ firePropertyChange(PROPERTY_CRUISE, oldValue, cruise);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.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/program/EditProgramUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,94 @@
+/*
+ * #%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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#form {
+ border: {BorderFactory.createTitledBorder((String)null)};
+}
+
+#nameLabel {
+ text: "tutti.label.program.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {getStringValue(model.getComment())};
+}
+
+#zoneLabel {
+ text: "tutti.label.program.zone";
+ labelFor: {zoneComboBox};
+}
+
+#zoneComboBox {
+ property: "zone";
+ selectedItem: {model.getZone()};
+}
+
+#saveButton {
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+ actionIcon: "save";
+}
+
+#cancelButton {
+ text: "tutti.action.cancel";
+ actionIcon: "cancel";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.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/program/EditProgramUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,125 @@
+<!--
+ #%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<EditProgramUIModel, EditProgramUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+
+ </import>
+
+ <script><![CDATA[
+
+ public EditProgramUI(TuttiUIContext context) {
+ EditProgramUIHandler handler = new EditProgramUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditProgramUIHandler id='handler'
+ initializer='getContextValue(EditProgramUIHandler.class)'/>
+
+ <EditProgramUIModel id='model'
+ initializer='getContextValue(EditProgramUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='name' component='nameField'/>
+ <field name='zone' component='zoneComboBox'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+
+ <Table id='form' fill='both'>
+
+ <!-- program name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ </row>
+
+ <!-- program zone -->
+ <row>
+ <cell>
+ <JLabel id='zoneLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='zoneComboBox' constructorParams='this'
+ genericType='Zone'/>
+ </cell>
+ </row>
+
+ <!-- program comment -->
+ <row weighty='0.8'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- actions -->
+ <row anchor='south'>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <!-- validation messages -->
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.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/program/EditProgramUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,135 @@
+package fr.ifremer.tutti.ui.swing.content.program;
+
+/*
+ * #%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.data.Program;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handler of UI {@link EditProgramUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditProgramUIHandler.class);
+
+ private final EditProgramUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditProgramUIModel model = new EditProgramUIModel();
+
+ String surveyId = context.getProgramId();
+ if (surveyId == null) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit new program");
+ }
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit existing program " + surveyId);
+ }
+ // load existing program
+ Program program = persistenceService.getProgram(surveyId);
+
+ model.fromBean(program);
+ }
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ EditProgramUIModel model = ui.getModel();
+ initBeanComboBox(ui.getZoneComboBox(),
+ persistenceService.getAllZone(),
+ model.getZone());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new program can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ ui.getValidator().setBean(null);
+ }
+
+ @Override
+ protected EditProgramUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditProgramUIModel model = ui.getModel();
+
+ Program bean = model.toBean();
+
+ Program saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProgram(bean);
+ } else {
+ saved = persistenceService.saveProgram(bean);
+ }
+
+ context.setProgramId(saved.getId());
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.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/program/EditProgramUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,97 @@
+package fr.ifremer.tutti.ui.swing.content.program;
+
+/*
+ * #%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.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Bean to edit a program.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_ZONE = "zone";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_NAME = "name";
+
+ protected String name;
+
+ protected String comment;
+
+ protected Zone zone;
+
+ protected static Binder<EditProgramUIModel, Program> toBeanBinder =
+ BinderFactory.newBinder(EditProgramUIModel.class,
+ Program.class);
+
+ protected static Binder<Program, EditProgramUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Program.class, EditProgramUIModel.class);
+
+
+ public EditProgramUIModel() {
+ super(Program.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Zone getZone() {
+ return zone;
+ }
+
+ public void setZone(Zone zone) {
+ Object oldValue = getZone();
+ this.zone = zone;
+ firePropertyChange(PROPERTY_ZONE, oldValue, zone);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.program.name.required</message>
- </field-validator>
-
- </field>
-
- <field name="zone">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.program.zone.required</message>
- </field-validator>
-
- </field>
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.name.required</message>
- </field-validator>
- </field>
-
- <field name="program">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.program.required</message>
- </field-validator>
- </field>
-
- <field name="year">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.year.required</message>
- </field-validator>
- </field>
-
- <field name="poche">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.poche.required</message>
- </field-validator>
- </field>
-
- <field name="beginDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.beginDate.required</message>
- </field-validator>
- </field>
-
- <field name="endDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.endDate.required</message>
- </field-validator>
- </field>
-
-
- <field name="country">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.country.required</message>
- </field-validator>
- </field>
-
- <field name="vessel">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ vessel != null && !vessel.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.vessel.required</message>
- </field-validator>
- </field>
-
- <field name="gear">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gear != null && !gear.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.gear.required</message>
- </field-validator>
- </field>
-
- <field name="headOfMission">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.headOfMission.required</message>
- </field-validator>
- </field>
-
- <field name="headOfSortRoom">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.headOfSortRoom.required</message>
- </field-validator>
- </field>
-
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
- </field-validator>
-
- </field>
-
- <field name="date">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.required</message>
- </field-validator>
-
- </field>
-</validators>
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.cruise.name.required</message>
+ </field-validator>
+ </field>
+
+ <field name="program">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.program.required</message>
+ </field-validator>
+ </field>
+
+ <field name="year">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.year.required</message>
+ </field-validator>
+ </field>
+
+ <field name="poche">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.poche.required</message>
+ </field-validator>
+ </field>
+
+ <field name="beginDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.beginDate.required</message>
+ </field-validator>
+ </field>
+
+ <field name="endDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.endDate.required</message>
+ </field-validator>
+ </field>
+
+
+ <field name="country">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.country.required</message>
+ </field-validator>
+ </field>
+
+ <field name="vessel">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ vessel != null && !vessel.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.vessel.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gear">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gear != null && !gear.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.gear.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfMission">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfMission.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfSortRoom">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfSortRoom.required</message>
+ </field-validator>
+ </field>
+
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="date">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.program.name.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="zone">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.program.zone.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
___________________________________________________________________
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-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -36,8 +36,8 @@
tutti.config.category.other.description=Autres options
tutti.config.category.shortcuts=Raccourcis
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
+tutti.config.cruiseId=Identifiant de la dernière campagne utilisée
tutti.config.programId=Identifiant de la dernière série de campagne utilisée
-tutti.config.scientificCruiseId=Identifiant de la dernière campagne utilisée
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
@@ -46,6 +46,15 @@
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
+tutti.label.cruise=Campagne
+tutti.label.cruise.beginDate=Date de début
+tutti.label.cruise.country=Pays
+tutti.label.cruise.endDate=Date de fin
+tutti.label.cruise.name=Nom
+tutti.label.cruise.poche=Nombre de poches
+tutti.label.cruise.program=Série
+tutti.label.cruise.surveyPart=Série partielle
+tutti.label.cruise.year=Année
tutti.label.fishingOperation.averageBottomSalinity=Salinité de fond moyenne
tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne
tutti.label.fishingOperation.beaufortScale=Force du vent
@@ -116,15 +125,6 @@
tutti.label.program=Série de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
-tutti.label.scientificCruise=Campagne
-tutti.label.scientificCruise.beginDate=Date de début
-tutti.label.scientificCruise.country=Pays
-tutti.label.scientificCruise.endDate=Date de fin
-tutti.label.scientificCruise.name=Nom
-tutti.label.scientificCruise.poche=Nombre de poches
-tutti.label.scientificCruise.program=Série
-tutti.label.scientificCruise.surveyPart=Série partielle
-tutti.label.scientificCruise.year=Année
tutti.label.species.sampleVracWeight=Poids total vrac échant.
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
@@ -188,30 +188,30 @@
tutti.table.species.frequency.header.weight=Poids observé
tutti.timeeditor.H=H
tutti.title.about=À propos de Tutti
+tutti.title.create.cruise=Créer une nouvelle campagne
tutti.title.create.program=Créer une nouvelle série de campagne
-tutti.title.create.scientificCruise=Créer une nouvelle campagne
+tutti.title.edit.cruise=Editer une campagne existante
tutti.title.edit.program=Editer une série de campagne existante
-tutti.title.edit.scientificCruise=Editer une campagne existante
tutti.title.fill.catches=Saisie des captures
tutti.title.frequency=Saisie des mensurations
tutti.title.home=Sélection de la campagne
+tutti.title.noSelectedCruise=Pas de campagne sélectionné
tutti.title.noSelectedProgram=Pas de série de campagne sélectionné
-tutti.title.noSelectedScientificCruise=Pas de campagne sélectionné
+tutti.title.selectedCruise=Campagne %s
tutti.title.selectedProgram=Série de campagne %s
-tutti.title.selectedScientificCruise=Campagne %s
tutti.to.be.done=< A FAIRE >
+tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
+tutti.validator.error.cruise.country.required=Le pays est obligatoire
+tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire
+tutti.validator.error.cruise.gear.required=Au moins un engin doit être sélectionné
+tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
+tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
+tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire
+tutti.validator.error.cruise.poche.required=Le nombre de poche est obligatoire
+tutti.validator.error.cruise.program.required=La série est obligatoire
+tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné
+tutti.validator.error.cruise.year.required=L'année est obligatoire
tutti.validator.error.fishingOperation.date.required=La date du fishingOperation est obligatoire
tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
tutti.validator.error.program.name.required=Le nom de la série est obligatoire
tutti.validator.error.program.zone.required=La zone de la série est obligatoire
-tutti.validator.error.scientificCruise.beginDate.required=La date de début est obligatoire
-tutti.validator.error.scientificCruise.country.required=Le pays est obligatoire
-tutti.validator.error.scientificCruise.endDate.required=La date de fin est obligatoire
-tutti.validator.error.scientificCruise.gear.required=Au moins un engin doit être sélectionné
-tutti.validator.error.scientificCruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
-tutti.validator.error.scientificCruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
-tutti.validator.error.scientificCruise.name.required=Le nom de la campagne est obligatoire
-tutti.validator.error.scientificCruise.poche.required=Le nombre de poche est obligatoire
-tutti.validator.error.scientificCruise.program.required=La série est obligatoire
-tutti.validator.error.scientificCruise.vessel.required=Au moins un bateau doit être sélectionné
-tutti.validator.error.scientificCruise.year.required=L'année est obligatoire
1
0